Files
kevinveenbirkenbachandClaude Opus 5.5 2d80ad5f1b fix(web-app-openproject): wait for the swarm seeder and detect dead DB sockets
Compose gates web, worker and cron on the seeder via depends_on
service_completed_successfully. Swarm ignores depends_on, so nothing
waited for the one-shot seeder there. In CI (store-i18n run 40979252521,
OpenProject#0 swarm) an overlay flap reset the seeder's Postgres
connection; Postgres rolled back RootSeeder's transaction, but the
seeder never noticed and sat idle on the dead socket forever
("Executing database seed..."). No UserCustomFieldSection rows were
committed, so /my/account rendered without fieldsets and the deploy
still reported green.

- 01_manager_ops.yml: in swarm, after the handler flush deploys the
  stack, poll job_state.sh on the seeder service until its newest task
  is Complete (fail on Shutdown, give up after 20 minutes), mirroring
  web-app-zammad's init-job wait. Compose keeps relying on depends_on.
- env.j2: add libpq TCP keepalives (idle 60s, interval 10s, count 6)
  and tcp_user_timeout=120000 to DATABASE_URL, so a connection whose
  peer vanished errors out within about two minutes instead of hanging.
  The seeder then exits non-zero and swarm's on-failure restart policy
  reruns the seed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:51:56 +01:00

41 lines
2.0 KiB
Django/Jinja

{% include 'roles/sys-svc-container/templates/env.j2' %}
OPENPROJECT_HTTPS={{ lookup('tls', application_id, 'enabled') | string | lower }}
OPENPROJECT_HOST__NAME={{ lookup('domain',application_id) }}
OPENPROJECT_RAILS__RELATIVE__URL__ROOT=
IMAP_ENABLED=false
SECRET_KEY_BASE={{ lookup('config', application_id, 'secrets.credentials.secret_key_base') }}
OPENPROJECT_HSTS={{ lookup('tls', application_id, 'enabled') | string | lower }}
RAILS_CACHE_STORE=memcache
OPENPROJECT_CACHE__MEMCACHE__SERVER=cache:11211
{% if OPENPROJECT_HEADER_SSO_ENABLED | bool %}
OPENPROJECT_AUTH__SOURCE__SSO_HEADER={{ OPENPROJECT_SSO_HEADER }}
OPENPROJECT_AUTH__SOURCE__SSO_SECRET={{ OPENPROJECT_SSO_SECRET | dotenv_quote }}
OPENPROJECT_AUTH__SOURCE__SSO_OPTIONAL=true
{% if OPENPROJECT_SSO_LOGOUT_URL %}
OPENPROJECT_AUTH__SOURCE__SSO_LOGOUT__URL={{ OPENPROJECT_SSO_LOGOUT_URL }}
{% endif %}
{% endif %}
POSTGRES_PASSWORD={{ lookup('database', application_id, 'password') | dotenv_quote }}
DATABASE_URL={{ lookup('database', application_id, 'url_full') }}?pool=20&encoding=unicode&reconnect=true&keepalives=1&keepalives_idle=60&keepalives_interval=10&keepalives_count=6&tcp_user_timeout=120000
DB_POOL={{ OPENPROJECT_DB_POOL }}
RAILS_MAX_THREADS={{ OPENPROJECT_RAILS_MAX_THREADS }}
RAILS_MIN_THREADS=4
{% if lookup('objstore', application_id, 'enabled') | bool %}
OPENPROJECT_ATTACHMENTS__STORAGE=fog
OPENPROJECT_DIRECT__UPLOADS=false
OPENPROJECT_FOG_DIRECTORY={{ lookup('objstore', application_id, 'bucket') }}
OPENPROJECT_FOG_CREDENTIALS_PROVIDER=AWS
OPENPROJECT_FOG_CREDENTIALS_AWS__ACCESS__KEY__ID={{ lookup('objstore', application_id, 'access_key') }}
OPENPROJECT_FOG_CREDENTIALS_AWS__SECRET__ACCESS__KEY={{ lookup('objstore', application_id, 'secret_key') | dotenv_quote }}
OPENPROJECT_FOG_CREDENTIALS_REGION={{ lookup('objstore', application_id, 'region') }}
OPENPROJECT_FOG_CREDENTIALS_HOST={{ lookup('objstore', application_id, 'host') }}
OPENPROJECT_FOG_CREDENTIALS_ENDPOINT={{ lookup('objstore', application_id, 'url') }}
OPENPROJECT_FOG_CREDENTIALS_PATH__STYLE=true
{% endif %}
RAILS_ENV=production