23 lines
1.4 KiB
Bash
23 lines
1.4 KiB
Bash
#!/bin/sh
|
|
# Оператор: запуск стенда lab7 из готовых secrets (повторный запуск безопасен и идемпотентен).
|
|
# 1) сборка образа приложения; 2) OpenBao: старт → init (только первый раз) → unseal → bootstrap
|
|
# (policies/AppRole/KV, role_id+SecretID в secrets/bao/<svc>); 3) остальные сервисы, ожидание healthy.
|
|
# Материал оператора OpenBao (unseal shares, root token) — в $MTUSI_OPERATOR_DIR (~/.mtusi-lab7-operator),
|
|
# значения не печатаются. Профили: PROFILES="--profile ttl" ./scripts/up.sh
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
ENV_FILE=${ENV_FILE:-.env}
|
|
dc() { docker compose --env-file "$ENV_FILE" "$@"; }
|
|
[ -f secrets/tls/trust/ca.crt ] || { echo "нет secrets/tls: сначала ./scripts/init-secrets.sh" >&2; exit 2; }
|
|
export NO_PROXY="127.0.0.1,localhost${NO_PROXY:+,$NO_PROXY}" no_proxy="127.0.0.1,localhost${no_proxy:+,$no_proxy}"
|
|
dc build -q
|
|
dc up -d openbao
|
|
python3 scripts/bao_admin.py wait --timeout 90
|
|
python3 scripts/bao_admin.py init
|
|
python3 scripts/bao_admin.py unseal
|
|
python3 scripts/bao_admin.py bootstrap
|
|
# shellcheck disable=SC2086
|
|
dc ${PROFILES:-} up -d --wait --wait-timeout 300
|
|
dc ps --format 'table {{.Service}}\t{{.Status}}\t{{.Ports}}'
|
|
echo "ready: https://127.0.0.1:${API_PORT:-8443} (CA: secrets/tls/trust/ca.crt)"
|