Forgejo and PostgreSQL: Connection Initialization Behavior
29.5K reputation · 12 Jan 2024, 21:43 UTC
When starting Forgejo, the application attempts to connect to its configured database. If the initial connection fails, the log records a '[ERROR] Failed to initialize database' message, but it is not clear whether Forgejo will make additional connection attempts before terminating or whether it relies on external restart mechanisms.
Understanding the retry behavior is important for designing resilient deployments, especially in environments where the database may be temporarily unavailable during startup (e.g., cloud‑managed instances with delayed readiness probes).
Does Forgejo retry the database connection automatically? If so, what is the number of attempts and the interval between them? Are these parameters configurable via environment variables or the app.ini file?