Files
computer-playbook/roles/web-app-openproject/tasks/01_manager_ops.yml
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

53 lines
1.5 KiB
YAML

---
- name: "📁 Create {{ OPENPROJECT_PLUGINS_FOLDER }}"
file:
path: "{{ OPENPROJECT_PLUGINS_FOLDER }}"
state: directory
mode: "0755"
- name: "📁 Transferring Gemfile to {{ OPENPROJECT_PLUGINS_FOLDER }} as Gemfile.plugins"
copy:
src: Gemfile
dest: "{{ [OPENPROJECT_PLUGINS_FOLDER,'Gemfile.plugins'] | path_join }}"
notify:
- compose-up
- compose-build
- name: "⏳ Transferring await_migrations.sh to {{ OPENPROJECT_AWAIT_MIGRATIONS_ABS }}"
stack_host_copy:
src: shell/await_migrations.sh
dest: "{{ OPENPROJECT_AWAIT_MIGRATIONS_ABS }}"
mode: "0555"
notify: compose-up
- name: "📁 create {{ OPENPROJECT_DUMMY_DIR }}"
file:
path: "{{ OPENPROJECT_DUMMY_DIR }}"
state: directory
mode: "0755"
- name: 🚿 flush docker service
meta: flush_handlers
- name: ⏳ Wait until the seeder has committed the seed (swarm)
ansible.builtin.script: "{{ lookup('path_absolute', 'roles/sys-svc-compose/files/shell/swarm/job_state.sh') }}"
environment:
JOB: "{{ lookup('container_service', application_id, OPENPROJECT_SEEDER_SERVICE) }}"
register: openproject_seeder_state
changed_when: false
retries: 120
delay: 10
until: openproject_seeder_state.rc != 1
failed_when: openproject_seeder_state.rc != 0
when: DEPLOYMENT_MODE == 'swarm'
- name: 🚀 Deploy Settings
include_tasks: 02_settings.yml
- name: 🔧 Setup LDAP
include_tasks: 03_ldap.yml
when: OPENPROJECT_LDAP_ENABLED | bool
- name: 📁 Create OpenProject Administrator
include_tasks: 04_admin.yml