Skip to content

Commit 12ea1a8

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 12ea1a8

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

README.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,36 @@ services:
3838
image: openbao/openbao:latest
3939
command: server -dev
4040
environment:
41-
BAO_DEV_ROOT_TOKEN_ID: dev-only-root-token
42-
BAO_DEV_LISTEN_ADDRESS: 0.0.0.0:8200
41+
- BAO_DEV_ROOT_TOKEN_ID=${OPENBAO_DEV_TOKEN:-dev-only-root-token}
42+
- BAO_DEV_LISTEN_ADDRESS=0.0.0.0:8200
4343
cap_add:
4444
- IPC_LOCK
4545
ports:
4646
- 127.0.0.1:8200:8200
47-
networks:
48-
- internal
47+
healthcheck:
48+
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8200/v1/sys/health"]
49+
interval: 5s
50+
timeout: 3s
51+
retries: 12
52+
start_period: 5s
53+
54+
# One-shot init: creates the 'nfse' KV v2 mount and enables AppRole auth.
55+
# Runs once after openbao is healthy; idempotent (|| true) so safe on restart.
56+
openbao-init:
57+
image: openbao/openbao:latest
58+
depends_on:
59+
openbao:
60+
condition: service_healthy
61+
environment:
62+
- BAO_ADDR=http://openbao:8200
63+
- BAO_TOKEN=${OPENBAO_DEV_TOKEN:-dev-only-root-token}
64+
command: >
65+
sh -c "
66+
bao secrets enable -path=nfse kv-v2 2>/dev/null || true &&
67+
bao auth enable approle 2>/dev/null || true &&
68+
echo 'OpenBao: mount nfse (kv-v2) e AppRole habilitados.'
69+
"
70+
restart: on-failure
4971

5072
dufs:
5173
image: sigoden/dufs:latest
@@ -54,8 +76,6 @@ services:
5476
- ./volumes/webdav:/data
5577
ports:
5678
- 127.0.0.1:5000:5000
57-
networks:
58-
- internal
5979
```
6080
6181
> **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)