Fix API deploy healthcheck by starting Kestrel before migrate/seed.
Compose was marking the API unhealthy because bootstrap blocked app.Run(), so /health/live never answered within the HEALTHCHECK window.
This commit is contained in:
+11
-4
@@ -73,9 +73,10 @@ jobs:
|
||||
# Postgres lives on the deploy host's shared-services network and is not
|
||||
# reachable from act_runner, so the bundle is copied there and executed in
|
||||
# a one-shot container joined to that network (Host=postgres resolves).
|
||||
# NOTE: Program.cs also runs db.Database.MigrateAsync() on API startup, so
|
||||
# this job is a defense-in-depth pre-deploy step using a DDL-privileged
|
||||
# credential the API container never sees, not the only migration path.
|
||||
# NOTE: AppBootstrapHostedService also runs db.Database.MigrateAsync() after
|
||||
# Kestrel listens, so this job is a defense-in-depth pre-deploy step using a
|
||||
# DDL-privileged credential the API container never sees, not the only
|
||||
# migration path.
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -162,7 +163,13 @@ jobs:
|
||||
fi
|
||||
|
||||
docker compose -f docker-compose.prod.yml --env-file .env pull
|
||||
docker compose -f docker-compose.prod.yml --env-file .env up -d --remove-orphans
|
||||
if ! docker compose -f docker-compose.prod.yml --env-file .env up -d --remove-orphans; then
|
||||
echo "Compose up failed — dumping API status/logs:"
|
||||
docker inspect --format 'status={{.State.Status}} health={{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}}' \
|
||||
vigilcare_records_api || true
|
||||
docker compose -f docker-compose.prod.yml --env-file .env logs --tail 100 api || true
|
||||
exit 1
|
||||
fi
|
||||
docker image prune -f
|
||||
EOF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user