@@ -30,8 +30,12 @@ services:
3030 retries : 10
3131 start_period : 20s
3232 depends_on :
33+ vault-setup :
34+ condition : service_completed_successfully
3335 keycloak :
3436 condition : service_healthy
37+ vault :
38+ condition : service_healthy
3539 alloy :
3640 condition : service_started
3741 networks :
@@ -61,10 +65,14 @@ services:
6165 # Mount the agent JAR into a known location in the container.
6266 - ./config/otel/opentelemetry-javaagent.jar:/app/opentelemetry-javaagent.jar:ro
6367 depends_on :
68+ vault-setup :
69+ condition : service_completed_successfully
6470 keycloak :
6571 condition : service_healthy
6672 resource-server :
6773 condition : service_healthy
74+ vault :
75+ condition : service_healthy
6876 alloy :
6977 condition : service_started
7078 networks :
@@ -142,6 +150,55 @@ services:
142150 networks :
143151 - lab-net
144152
153+ # --------------------------------------------------------------------------
154+ # Secrets Management Service: HashiCorp Vault
155+ # --------------------------------------------------------------------------
156+ vault :
157+ image : " hashicorp/vault:1.20.3"
158+ container_name : vault
159+ ports :
160+ - " 8200:8200"
161+ environment :
162+ # Root token for the dev server
163+ VAULT_DEV_ROOT_TOKEN_ID : " dev-root-token"
164+ # Target address for the vault CLI tool inside the container
165+ VAULT_ADDR : " http://127.0.0.1:8200"
166+ # Auth token for the vault CLI, enabling `docker exec` commands
167+ VAULT_TOKEN : " dev-root-token"
168+ cap_add :
169+ # Grants mlock capability to prevent secrets from being swapped to disk
170+ - IPC_LOCK
171+ command : " server -dev"
172+ healthcheck :
173+ test : ["CMD-SHELL", "wget -q --spider http://127.0.0.1:8200/v1/sys/health || exit 1"]
174+ interval : 5s
175+ timeout : 2s
176+ retries : 5
177+ start_period : 5s
178+ networks :
179+ - lab-net
180+
181+ # --------------------------------------------------------------------------
182+ # Vault Setup Service
183+ # --------------------------------------------------------------------------
184+ vault-setup :
185+ image : " hashicorp/vault:1.20.3"
186+ container_name : vault-setup
187+ volumes :
188+ # Mount the script into the container to be executed
189+ - ./scripts/populate-vault.sh:/usr/local/bin/populate-vault.sh:ro
190+ environment :
191+ - VAULT_ADDR=http://vault:8200
192+ - VAULT_TOKEN=dev-root-token
193+ env_file :
194+ - .secrets.env
195+ command : " sh /usr/local/bin/populate-vault.sh"
196+ depends_on :
197+ vault :
198+ condition : service_healthy
199+ networks :
200+ - lab-net
201+
145202 # --------------------------------------------------------------------------
146203 # Prometheus Service: For metrics collection.
147204 # --------------------------------------------------------------------------
@@ -266,9 +323,9 @@ services:
266323
267324secrets :
268325 actuator_username :
269- environment : " ACTUATOR_USERNAME "
326+ environment : " PROMETHEUS_SCRAP_USER "
270327 actuator_password :
271- environment : " ACTUATOR_PASSWORD "
328+ environment : " PROMETHEUS_SCRAP_PASSWORD "
272329
273330volumes :
274331 grafana-data :
0 commit comments