Skip to content

Commit 5ab6394

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 41d3f58 commit 5ab6394

1 file changed

Lines changed: 28 additions & 6 deletions

File tree

README.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,43 @@ 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
47-
networks:
48-
- internal
49+
healthcheck:
50+
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8200/v1/sys/health"]
51+
interval: 5s
52+
timeout: 3s
53+
retries: 12
54+
start_period: 5s
55+
56+
# One-shot init: creates the 'nfse' KV v2 mount and enables AppRole auth.
57+
# Runs once after openbao is healthy; idempotent (|| true) so safe on restart.
58+
openbao-init:
59+
image: openbao/openbao:latest
60+
depends_on:
61+
openbao:
62+
condition: service_healthy
63+
environment:
64+
- BAO_ADDR=http://openbao:8200
65+
- BAO_TOKEN=${OPENBAO_DEV_TOKEN:-dev-only-root-token}
66+
command: >
67+
sh -c "
68+
bao secrets enable -path=nfse kv-v2 2>/dev/null || true &&
69+
bao auth enable approle 2>/dev/null || true &&
70+
echo 'OpenBao: mount nfse (kv-v2) e AppRole habilitados.'
71+
"
72+
restart: on-failure
4973

5074
dufs:
5175
image: sigoden/dufs:latest
@@ -54,8 +78,6 @@ services:
5478
- ./volumes/webdav:/data
5579
ports:
5680
- 127.0.0.1:5000:5000
57-
networks:
58-
- internal
5981
```
6082
6183
> **PS**: After finish setup you will see two `.env` files: one on root of repository only used to setup Akaunting and other on `volumes/akaunting/.env`

0 commit comments

Comments
 (0)