mastodon: tighten resources, robust exec tasks, and env defaults

- resources: per-service cpus/mem/pids for mastodon/streaming/sidekiq/redis/db
- compose: rename service key to "mastodon" (was: web), set service_name blocks
- tasks(01_setup): run rails db:migrate via docker exec (non-tty, login shell)
- tasks(02_administrator): healthchecks for 'mastodon', sed with absolute path,
  tootctl as user 'mastodon' (non-tty), optional re-health wait
- env.j2: add RAILS_ENV={{ ENVIRONMENT | default('production') }}
- resource.yml.j2: fix get_app_conf path (service_name default spacing)
- docs: remove outdated Installation/Administration files

Context: https://chatgpt.com/share/68d332a0-ae98-800f-b418-c0d0262eaa2e
This commit is contained in:
2025-09-24 01:52:18 +02:00
parent 426ba32c11
commit 9bf77e1e35
10 changed files with 51 additions and 96 deletions

View File

@@ -14,7 +14,7 @@
delay: 5
until: healthcheck.stdout == "healthy"
loop:
- web
- mastodon
- streaming
- sidekiq
loop_control:
@@ -23,14 +23,12 @@
- name: Remove line containing "- administrator" from config/settings.yml to allow creating administrator account
command:
cmd: "docker compose exec -u root web sed -i '/- administrator/d' config/settings.yml"
chdir: "{{ docker_compose.directories.instance }}"
cmd: "docker exec -u root {{ MASTODON_CONTAINER }} sed -i '/- administrator/d' config/settings.yml"
when: users.administrator.username == "administrator"
- name: Create admin account via tootctl
command:
cmd: 'docker compose exec -u root web bash -c "RAILS_ENV=production bin/tootctl accounts create {{users.administrator.username}} --email {{ users.administrator.email }} --confirmed --role Owner"'
chdir: "{{ docker_compose.directories.instance }}"
cmd: 'docker exec -u root {{ MASTODON_CONTAINER }} bash -c "bin/tootctl accounts create {{users.administrator.username}} --email {{ users.administrator.email }} --confirmed --role Owner"'
register: tootctl_create
changed_when: tootctl_create.rc == 0
failed_when: >
@@ -41,7 +39,6 @@
- name: Approve the administrator account in Mastodon
command:
cmd: docker compose exec -u root web bash -c "RAILS_ENV=production bin/tootctl accounts modify {{users.administrator.username}} --approve"
chdir: "{{ docker_compose.directories.instance }}"
cmd: docker exec -u root {{ MASTODON_CONTAINER }} bash -c "bin/tootctl accounts modify {{users.administrator.username}} --approve"
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"