Skip to content

Commit ba5c900

Browse files
committed
docs(readme): add healthcheck and openbao-init to override example
The previous example lacked: - healthcheck on the openbao service (required for depends_on condition) - openbao-init one-shot service to create the 'nfse' KV v2 mount and enable AppRole auth automatically on first start - networks: internal on mailpit service - env var interpolation form (${VAR:-default}) for the dev token Without this init step, any module operation that writes or reads PFX secrets fails because the 'nfse' mount does not exist in OpenBao. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 4f421a8 commit ba5c900

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,47 @@ services:
3333
ports:
3434
- 127.0.0.1:8025:8025
3535
- 127.0.0.1:1025:1025
36+
networks:
37+
- internal
3638

3739
openbao:
3840
image: openbao/openbao:latest
3941
command: server -dev
4042
environment:
41-
BAO_DEV_ROOT_TOKEN_ID: dev-only-root-token
42-
BAO_DEV_LISTEN_ADDRESS: 0.0.0.0:8200
43+
- BAO_DEV_ROOT_TOKEN_ID=${OPENBAO_DEV_TOKEN:-dev-only-root-token}
44+
- BAO_DEV_LISTEN_ADDRESS=0.0.0.0:8200
4345
cap_add:
4446
- IPC_LOCK
4547
ports:
4648
- 127.0.0.1:8200:8200
4749
networks:
4850
- internal
51+
healthcheck:
52+
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8200/v1/sys/health"]
53+
interval: 5s
54+
timeout: 3s
55+
retries: 12
56+
start_period: 5s
57+
58+
# One-shot init: creates the 'nfse' KV v2 mount and enables AppRole auth.
59+
# Runs once after openbao is healthy; idempotent (|| true) so safe on restart.
60+
openbao-init:
61+
image: openbao/openbao:latest
62+
depends_on:
63+
openbao:
64+
condition: service_healthy
65+
environment:
66+
- BAO_ADDR=http://openbao:8200
67+
- BAO_TOKEN=${OPENBAO_DEV_TOKEN:-dev-only-root-token}
68+
command: >
69+
sh -c "
70+
bao secrets enable -path=nfse kv-v2 2>/dev/null || true &&
71+
bao auth enable approle 2>/dev/null || true &&
72+
echo 'OpenBao: mount nfse (kv-v2) e AppRole habilitados.'
73+
"
74+
restart: on-failure
75+
networks:
76+
- internal
4977

5078
dufs:
5179
image: sigoden/dufs:latest

0 commit comments

Comments
 (0)