mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-11-27 07:06:36 +00:00
Fix Mastodon role: run DB migrations before health checks, restructure setup/wait tasks, introduce service name variables, and update docker-compose templates.
Reference: https://chatgpt.com/share/6925e87d-3e0c-800f-bfff-902d1faa122e
This commit is contained in:
4
roles/web-app-mastodon/tasks/01_setup.yml
Normal file
4
roles/web-app-mastodon/tasks/01_setup.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
- name: "Execute migration for '{{ application_id }}'"
|
||||
command:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
cmd: "docker compose run --rm {{ MASTODON_SERVICE_NAME }} bundle exec rails db:migrate"
|
||||
@@ -11,9 +11,9 @@
|
||||
delay: 5
|
||||
until: healthcheck.stdout == "healthy"
|
||||
loop:
|
||||
- mastodon
|
||||
- streaming
|
||||
- sidekiq
|
||||
- "{{ MASTODON_SERVICE_NAME }}"
|
||||
- "{{ MASTODON_STREAMING_SERVICE_NAME }}"
|
||||
- "{{ MASTODON_SIDEKIQ_SERVICE_NAME }}"
|
||||
loop_control:
|
||||
label: "{{ item }}"
|
||||
changed_when: false
|
||||
@@ -1,3 +0,0 @@
|
||||
- name: "Execute migration for '{{ application_id }}'"
|
||||
command:
|
||||
cmd: "docker exec {{ MASTODON_CONTAINER }} bundle exec rails db:migrate"
|
||||
@@ -18,15 +18,15 @@
|
||||
vars:
|
||||
docker_compose_flush_handlers: true
|
||||
|
||||
- name: "start setup procedures for mastodon"
|
||||
include_tasks: 01_setup.yml
|
||||
|
||||
- name: "Wait for Mastodon"
|
||||
include_tasks: 01_wait.yml
|
||||
include_tasks: 02_wait.yml
|
||||
|
||||
- name: "Cleanup Mastodon caches when MODE_CLEANUP is true"
|
||||
include_tasks: 02_cleanup.yml
|
||||
include_tasks: 03_cleanup.yml
|
||||
when: MODE_CLEANUP | bool
|
||||
|
||||
- name: "start setup procedures for mastodon"
|
||||
include_tasks: 03_setup.yml
|
||||
|
||||
- name: "Include administrator routines for '{{ application_id }}'"
|
||||
include_tasks: 04_administrator.yml
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{% include 'roles/docker-compose/templates/base.yml.j2' %}
|
||||
|
||||
mastodon:
|
||||
{% set service_name = 'mastodon' %}
|
||||
{% set service_name = MASTODON_SERVICE_NAME %}
|
||||
{% set container_port = 3000 %}
|
||||
{% set container_healthcheck = 'health' %}
|
||||
{{ service_name }}:
|
||||
container_name: {{ MASTODON_CONTAINER }}
|
||||
image: "{{ MASTODON_IMAGE }}:{{ MASTODON_VERSION }}"
|
||||
{% include 'roles/docker-container/templates/base.yml.j2' %}
|
||||
@@ -16,10 +16,10 @@
|
||||
- data:/mastodon/public/system
|
||||
{% include 'roles/docker-container/templates/networks.yml.j2' %}
|
||||
|
||||
streaming:
|
||||
{% set service_name = 'streaming' %}
|
||||
{% set service_name = MASTODON_STREAMING_SERVICE_NAME %}
|
||||
{% set container_port = 4000 %}
|
||||
{% set container_healthcheck = 'api/v1/streaming/health' %}
|
||||
{{ service_name }}:
|
||||
container_name: {{ MASTODON_STREAMING_CONTAINER }}
|
||||
image: "{{ MASTODON_STREAMING_IMAGE }}:{{ MASTODON_STREAMING_VERSION }}"
|
||||
{% include 'roles/docker-container/templates/base.yml.j2' %}
|
||||
@@ -30,8 +30,8 @@
|
||||
{% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %}
|
||||
{% include 'roles/docker-container/templates/networks.yml.j2' %}
|
||||
|
||||
sidekiq:
|
||||
{% set service_name = 'sidekiq' %}
|
||||
{% set service_name = MASTODON_SIDEKIQ_SERVICE_NAME %}
|
||||
{{ service_name }}:
|
||||
container_name: {{ MASTODON_SIDEKIQ_CONTAINER }}
|
||||
image: "{{ MASTODON_IMAGE }}:{{ MASTODON_VERSION }}"
|
||||
{% include 'roles/docker-container/templates/base.yml.j2' %}
|
||||
|
||||
@@ -2,13 +2,24 @@
|
||||
application_id: "web-app-mastodon"
|
||||
database_type: "postgres"
|
||||
|
||||
# Mastodon Specific
|
||||
# Mastodon
|
||||
|
||||
## Main
|
||||
MASTODON_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.version') }}"
|
||||
MASTODON_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.image') }}"
|
||||
MASTODON_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.name') }}"
|
||||
MASTODON_VOLUME: "{{ applications | get_app_conf(application_id, 'docker.volumes.data') }}"
|
||||
MASTODON_SERVICE_NAME: "mastodon"
|
||||
|
||||
## Streaming
|
||||
MASTODON_STREAMING_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.streaming.version') }}"
|
||||
MASTODON_STREAMING_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.streaming.image') }}"
|
||||
MASTODON_STREAMING_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.streaming.name') }}"
|
||||
MASTODON_SIDEKIQ_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.name') }}_sidekiq"
|
||||
MASTODON_STREAMING_SERVICE_NAME: "streaming"
|
||||
|
||||
## Sidekiq
|
||||
MASTODON_SIDEKIQ_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.name') }}-sidekiq"
|
||||
MASTODON_SIDEKIQ_SERVICE_NAME: "sidekiq"
|
||||
|
||||
## General
|
||||
MASTODON_ALLOWED_PRIVATE_ADDRESSES: "{{ networks.local['svc-db-postgres'].subnet if 'web-app-chess' in group_names else ''}}"
|
||||
Reference in New Issue
Block a user