Files
computer-playbook/roles/web-app-listmonk/tasks/01_database.yml
kevinveenbirkenbachandClaude Opus 4.8 cc5f13b7a7 fix(web-app-listmonk): let the container self-install and pin to v6.2.0
The stock image CMD exits on an empty DB ("Run --install."), so the server
crash-looped on first deploy while the role exec'd 'yes | ./listmonk --install'
into that same crashing container, which was SIGKILLed (rc 137) and never
converged. Adopt listmonk's own recommended container command (idempotent
install, upgrade, then serve; the super admin is seeded from LISTMONK_ADMIN_USER
/ _PASSWORD), and replace the exec dance with a DB-reachability probe plus a
wait for the users table to be seeded. Pin latest to the current stable v6.2.0
so the CLI/schema contract cannot drift. Same flow in compose and swarm.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 00:26:05 +02:00

26 lines
846 B
YAML

---
- name: 🔎 Check that the Listmonk database is reachable
shell: '{{ LISTMONK_EXEC_DATABASE }} -c "SELECT 1"'
register: listmonk_db_probe
changed_when: false
failed_when: false
- name: 🛑 Abort if Listmonk database is not reachable
fail:
msg: |
Listmonk database is not reachable.
Container: {{ lookup('database', application_id, 'container') }}
Database: {{ lookup('database', application_id, 'name') }}
Please ensure the shared PostgreSQL stack is running.
when: listmonk_db_probe.rc != 0
- name: ⏳ Wait for the listmonk container to seed schema and admin user
shell: "{{ LISTMONK_EXEC_DATABASE }} -tAc 'SELECT COUNT(*) FROM users'"
register: listmonk_seeded
changed_when: false
retries: 150
delay: 2
until: listmonk_seeded.rc == 0 and (listmonk_seeded.stdout | trim | int) > 0