From 65546413ea57d2f21f97e5acdc909350342a38b1 Mon Sep 17 00:00:00 2001 From: share2kanna Date: Thu, 22 Sep 2022 00:47:41 +0530 Subject: [PATCH] added resources to agent and client services in manual testing --- Notes.md | 65 ++++++++++++++++++++++++++++++++- docker-compose_manual_test.yaml | 16 ++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/Notes.md b/Notes.md index 2f30de8..7a0f93c 100644 --- a/Notes.md +++ b/Notes.md @@ -103,4 +103,67 @@ So have to tag with localhost:5001 prefix path - Add data source for clickhouse -- \ No newline at end of file +# local environment with cpu&mem + +## Docker + +Reference: https://docs.docker.com/config/containers/resource_constraints/ + +``` +docker run -it --cpus="0.5" --memory=256m container-bridge-agent:0.1.1 +docker run -it --cpus="0.5" --memory=256m container-bridge-client:0.1.1 +``` + +## Docker compose + +Reference: https://docs.docker.com/compose/compose-file/compose-file-v3/#resources + +``` +For example: +version: "3.9" +services: + agent: + image: container-bridge-agent:0.1.1 + deploy: + resources: + limits: + cpus: '0.50' + memory: 256M + reservations: + cpus: '0.25' + memory: 256M +``` + +# Example docker event payload + +``` +{ + "events": [ + { + "id": "d539f3c5-5734-47f0-a2a8-d27de5f9edb1", + "timestamp": "2022-09-21T19:00:49.658010356Z", + "action": "push", + "target": { + "mediaType": "application/octet-stream", + "size": 29136663, + "digest": "sha256:12f42424f10d587d02674c8a0dab1c08d3fd81ab6bac5b7f5e3799215c6c52e6", + "length": 29136663, + "repository": "ubuntu", + "url": "http://localhost:5001/v2/ubuntu/blobs/sha256:12f42424f10d587d02674c8a0dab1c08d3fd81ab6bac5b7f5e3799215c6c52e6" + }, + "request": { + "id": "3784878a-5075-4ea5-a51b-5288ebc54c9c", + "addr": "172.22.0.1:36222", + "host": "localhost:5001", + "method": "PUT", + "useragent": "containers/5.16.0 (github.com/containers/image)" + }, + "actor": {}, + "source": { + "addr": "5b458294602c:5000", + "instanceID": "da4bdd5f-3f85-45c6-a37d-bc97a82fbd39" + } + } + ] +} +``` diff --git a/docker-compose_manual_test.yaml b/docker-compose_manual_test.yaml index eb39594..b383535 100755 --- a/docker-compose_manual_test.yaml +++ b/docker-compose_manual_test.yaml @@ -56,6 +56,14 @@ services: STREAM_NAME: "CONTAINERMETRICS" ports: - "8090:8090" + deploy: + resources: + limits: + cpus: '0.50' + memory: 256M + reservations: + cpus: '0.25' + memory: 64M # depends_on: # web: # condition: service_healthy @@ -76,6 +84,14 @@ services: STREAM_NAME: "CONTAINERMETRICS" ports: - "8091:8091" + deploy: + resources: + limits: + cpus: '0.50' + memory: 256M + reservations: + cpus: '0.25' + memory: 64M # depends_on: # ch_server: # condition: service_healthy