mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-19 16:17:56 +00:00
fix: retry transient database startup errors
This commit is contained in:
@@ -49,6 +49,20 @@ volumes:
|
||||
redis_data:
|
||||
```
|
||||
|
||||
## Startup and Database Recovery
|
||||
|
||||
Sub2API runs database migrations while starting. PostgreSQL may still be
|
||||
recovering briefly after a host or Docker daemon restart. The application
|
||||
retries transient PostgreSQL startup and connection errors with bounded
|
||||
exponential backoff, then continues startup when the database is ready.
|
||||
Permanent errors such as invalid credentials, migration checksum mismatches,
|
||||
SQL errors, and incompatible data fail immediately.
|
||||
|
||||
The Compose deployment also checks PostgreSQL readiness with both `pg_isready`
|
||||
and a simple SQL query. `depends_on: condition: service_healthy` helps order a
|
||||
fresh Compose start, but application-level retries are still required when
|
||||
Docker restores existing containers after a host restart.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Description | Required | Default |
|
||||
|
||||
Reference in New Issue
Block a user