From f24755f31999389af605bd353cce81debcb660af Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Fri, 6 Dec 2024 22:31:40 +0000 Subject: [PATCH 1/2] feat(compose): add profile for elasticstack services services with a profile aren't started unless the profile is activated environment variable COMPOSE_PROFILES can be used to activate profiles --- .env.sample | 3 +++ compose.yml | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/.env.sample b/.env.sample index ef21e4f..9472e86 100644 --- a/.env.sample +++ b/.env.sample @@ -1,3 +1,6 @@ +# uncomment to start the elasticstack services with compose +# COMPOSE_PROFILES=elasticstack + # Version of Elastic products ELASTIC_STACK_VERSION=8.16.1 diff --git a/compose.yml b/compose.yml index 39c2345..eb8c5ab 100644 --- a/compose.yml +++ b/compose.yml @@ -19,6 +19,7 @@ services: - ./:/home/caltrans/src esconfig: + profiles: ["elasticstack"] image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_STACK_VERSION} user: "0" command: ["bash", "/.local/config/setup.sh"] @@ -34,6 +35,7 @@ services: retries: 120 es01: + profiles: ["elasticstack"] depends_on: esconfig: condition: service_healthy @@ -78,6 +80,7 @@ services: retries: 120 kibana: + profiles: ["elasticstack"] depends_on: es01: condition: service_healthy @@ -111,6 +114,7 @@ services: retries: 120 metricbeat01: + profiles: ["elasticstack"] depends_on: es01: condition: service_healthy @@ -139,6 +143,7 @@ services: - --strict.perms=false filebeat01: + profiles: ["elasticstack"] depends_on: es01: condition: service_healthy @@ -163,6 +168,7 @@ services: - --strict.perms=false logstash01: + profiles: ["elasticstack"] depends_on: es01: condition: service_healthy From 35149c849e84c2e78b7ea0b2303e2a56be1627b7 Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Fri, 6 Dec 2024 14:42:51 -0800 Subject: [PATCH 2/2] feat(devcontainer): remove explicit service start now relying on profiles to determine which services start --- .devcontainer/devcontainer.json | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 73d75d6..c72df84 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,15 +2,6 @@ "name": "caltrans/pems", "dockerComposeFile": ["../compose.yml"], "service": "dev", - "runServices": [ - "dev", - "docs", - "es01", - "kibana", - "metricbeat01", - "filebeat01", - "logstash01" - ], "forwardPorts": ["docs:8000", "kibana:5601"], "workspaceFolder": "/home/caltrans/src", "postAttachCommand": ["/bin/bash", ".devcontainer/postAttach.sh"],