From fc719f1eda4ec9b0246a0e11c8ed25710b446e1f Mon Sep 17 00:00:00 2001 From: khoaguin Date: Fri, 29 Sep 2023 17:29:01 +0700 Subject: [PATCH] - add labels to syft's containers - only remove syft's containers when doing `hagrid land all` --- packages/grid/docker-compose.yml | 16 ++++++++++++++++ packages/hagrid/hagrid/cli.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/grid/docker-compose.yml b/packages/grid/docker-compose.yml index 9a84b79028c..c02868028e9 100644 --- a/packages/grid/docker-compose.yml +++ b/packages/grid/docker-compose.yml @@ -26,6 +26,8 @@ services: - "${HTTP_PORT}:81" extra_hosts: - "host.docker.internal:host-gateway" + labels: + - "orgs.openmined.syft=this is a syft proxy container" # depends_on: # - "docker-host" @@ -51,6 +53,8 @@ services: depends_on: - proxy network_mode: service:proxy + labels: + - "orgs.openmined.syft=this is a syft tailscale container" frontend: restart: always @@ -72,6 +76,8 @@ services: - VITE_PUBLIC_API_BASE_URL=${VITE_PUBLIC_API_BASE_URL} extra_hosts: - "host.docker.internal:host-gateway" + labels: + - "orgs.openmined.syft=this is a syft frontend container" # redis: # restart: always @@ -131,6 +137,8 @@ services: - ${BACKEND_STORAGE_PATH}:/storage stdin_open: true tty: true + labels: + - "orgs.openmined.syft=this is a syft backend container" # backend_stream: # restart: always @@ -213,6 +221,8 @@ services: - RELEASE=${RELEASE:-production} - NETWORK_NAME=omnet - STACK_API_KEY=$STACK_API_KEY + labels: + - "orgs.openmined.syft=this is a syft headscale container" seaweedfs: profiles: @@ -233,6 +243,8 @@ services: - seaweedfs-data-2:/data - ./seaweedfs/filer.toml:/etc/seaweedfs/filer.toml - ./seaweedfs/start.sh:/etc/seaweedfs/start.sh + labels: + - "orgs.openmined.syft=this is a syft seaweedfs container" mongo: image: "${MONGO_IMAGE}:${MONGO_VERSION}" @@ -243,6 +255,8 @@ services: volumes: - mongo-data:/data/db - mongo-config-data:/data/configdb + labels: + - "orgs.openmined.syft=this is a syft mongo container" jaeger: profiles: @@ -266,6 +280,8 @@ services: # - "9411:9411" volumes: - jaeger-data:/tmp + labels: + - "orgs.openmined.syft=this is a syft jaeger container" volumes: credentials-data: diff --git a/packages/hagrid/hagrid/cli.py b/packages/hagrid/hagrid/cli.py index 36f8642bc98..b51770a2e11 100644 --- a/packages/hagrid/hagrid/cli.py +++ b/packages/hagrid/hagrid/cli.py @@ -3154,7 +3154,7 @@ def create_land_cmd(verb: GrammarVerb, kwargs: TypeDict[str, Any]) -> str: if target == "all": # land all syft nodes if prune_volumes: - land_cmd = "docker rm `docker ps -aq` --force " + land_cmd = "docker rm `docker ps --filter label=orgs.openmined.syft -q` --force " land_cmd += "&& docker volume rm " land_cmd += "$(docker volume ls --filter label=orgs.openmined.syft -q)" return land_cmd