Skip to content

feat(openbao): add healthcheck and openbao-init service to override example#14

Open
vitormattos wants to merge 1 commit intomainfrom
feat/openbao-mount-init
Open

feat(openbao): add healthcheck and openbao-init service to override example#14
vitormattos wants to merge 1 commit intomainfrom
feat/openbao-mount-init

Conversation

@vitormattos
Copy link
Copy Markdown
Member

Problema

Ao subir o ambiente com docker-compose.override.yml, o OpenBao iniciava em modo dev sem criar o mount KV v2 nfse/. Qualquer operação do módulo NFS-e que tentasse gravar ou ler segredos (ex: senha do PFX) falhava silenciosamente porque o mount não existia.

Além disso, o serviço openbao não tinha healthcheck, então não era possível garantir que outros serviços esperassem ele estar pronto.

O que foi corrigido

No exemplo do README:

  • healthcheck adicionado ao serviço openbao (verifica /v1/sys/health via HTTP a cada 5s)
  • serviço openbao-init adicionado:
    • aguarda o openbao estar saudável (condition: service_healthy)
    • executa bao secrets enable -path=nfse kv-v2 e bao auth enable approle
    • comandos são idempotentes (|| true) — seguros em restart
    • restart: on-failure para não ficar em loop depois que o init completa com sucesso
  • Formato de env vars corrigido para interpolação (${VAR:-default})
  • networks: internal adicionado ao mailpit

Como testar

# copie o exemplo para docker-compose.override.yml local
# e execute:
docker compose up -d
docker compose logs openbao-init
# deve exibir: 'OpenBao: mount nfse (kv-v2) e AppRole habilitados.'

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant