Restructure and cleaned up in preparation of new backup logic

This commit is contained in:
2025-07-15 23:51:51 +02:00
parent c8054ffbc3
commit af3ea9039c
106 changed files with 703 additions and 429 deletions

View File

@@ -1,12 +1,9 @@
images:
mastodon: "ghcr.io/mastodon/mastodon:latest"
streaming: "ghcr.io/mastodon/mastodon-streaming:latest"
single_user_mode: false # Set true for initial setup
setup: false # Set true in inventory file to execute the setup and initializing procedures
setup: false # Set true in inventory file to execute the setup and initializing procedures, don't know if this is still necessary @todo test it
features:
matomo: true
css: true
port-ui-desktop: true
port-ui-desktop: true
oidc: true
central_database: true
domains:
@@ -21,4 +18,14 @@ docker:
redis:
enabled: true
database:
enabled: true
enabled: true
mastodon:
image: "ghcr.io/mastodon/mastodon"
version: latest
no_stop_required: true
name: "mastodon"
streaming:
image: "ghcr.io/mastodon/mastodon-streaming"
version: latest
volumes:
data: "mastodon_data"

View File

@@ -18,13 +18,13 @@
- name: flush docker service
meta: flush_handlers
when: applications.mastodon.setup |bool
when: mastodon_setup |bool
- name: setup routine for mastodon
command:
cmd: "docker-compose run --rm web bundle exec rails db:migrate"
chdir: "{{docker_compose.directories.instance}}"
when: applications.mastodon.setup |bool
when: mastodon_setup |bool
- name: "include create-administrator.yml for mastodon"
include_tasks: create-administrator.yml

View File

@@ -3,7 +3,8 @@
web:
{% set container_port = 3000 %}
{% set container_healthcheck = 'health' %}
image: "{{ applications | get_app_conf(application_id, 'images.' ~ application_id, True) }}"
container_name: {{ mastodon_name }}
image: "{{ mastodon_image }}:{{ mastodon_version }}"
{% include 'roles/docker-container/templates/base.yml.j2' %}
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p {{ container_port }}"
{% include 'roles/docker-container/templates/healthcheck/wget.yml.j2' %}
@@ -17,7 +18,8 @@
streaming:
{% set container_port = 4000 %}
{% set container_healthcheck = 'api/v1/streaming/health' %}
image: "{{ applications | get_app_conf(application_id, 'images.streaming', True) }}"
container_name: {{ mastodon_streaming_name }}
image: "{{ mastodon_streaming_image }}:{{ mastodon_streaming_version }}"
{% include 'roles/docker-container/templates/base.yml.j2' %}
command: node ./streaming
{% include 'roles/docker-container/templates/healthcheck/wget.yml.j2' %}
@@ -27,7 +29,8 @@
{% include 'roles/docker-container/templates/networks.yml.j2' %}
sidekiq:
image: "{{ applications | get_app_conf(application_id, 'images.mastodon', True) }}"
container_name: {{ mastodon_sidekiq_name }}
image: "{{ mastodon_image }}:{{ mastodon_version }}"
{% include 'roles/docker-container/templates/base.yml.j2' %}
command: bundle exec sidekiq
{% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %}
@@ -40,5 +43,5 @@
{% include 'roles/docker-compose/templates/volumes.yml.j2' %}
redis:
data:
name: "{{ mastodon_volume }}"
{% include 'roles/docker-compose/templates/networks.yml.j2' %}

View File

@@ -5,7 +5,7 @@
LOCAL_DOMAIN={{domains | get_domain(application_id)}}
ALTERNATE_DOMAINS="{{ domains.mastodon[1:] | join(',') }}"
SINGLE_USER_MODE={{applications.mastodon.single_user_mode}}
SINGLE_USER_MODE={{ applications | get_app_conf(application_id, 'single_user_mode', True) }}
# Credentials
@@ -13,15 +13,15 @@ SINGLE_USER_MODE={{applications.mastodon.single_user_mode}}
# -------
# Make sure to use `bundle exec rails secret` to generate secrets
# -------
SECRET_KEY_BASE= {{applications.mastodon.credentials.secret_key_base}}
OTP_SECRET= {{applications.mastodon.credentials.otp_secret}}
SECRET_KEY_BASE= {{ applications | get_app_conf(application_id, 'credentials.secret_key_base') }}
OTP_SECRET= {{ applications | get_app_conf(application_id, 'credentials.otp_secret') }}
# Web Push
# --------
# Generate with `bundle exec rails mastodon:webpush:generate_vapid_key`
# --------
VAPID_PRIVATE_KEY= {{applications.mastodon.credentials.vapid_private_key}}
VAPID_PUBLIC_KEY= {{applications.mastodon.credentials.vapid_public_key}}
VAPID_PRIVATE_KEY= {{ applications | get_app_conf(application_id, 'credentials.vapid_private_key') }}
VAPID_PUBLIC_KEY= {{ applications | get_app_conf(application_id, 'credentials.vapid_public_key') }}
# Encryption secrets
# ------------------
@@ -29,9 +29,9 @@ VAPID_PUBLIC_KEY= {{applications.mastodon.credentials.vapid_public_key}}
# These are private/secret values, do not share outside hosting environment
# Use `bin/rails db:encryption:init` to generate fresh secrets
# Do NOT change these secrets once in use, as this would cause data loss and other issues
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY= {{applications.mastodon.credentials.active_record_encryption_deterministic_key}}
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT= {{applications.mastodon.credentials.active_record_encryption_key_derivation_salt}}
ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY= {{applications.mastodon.credentials.active_record_encryption_primary_key}}
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY= {{ applications | get_app_conf(application_id, 'credentials.active_record_encryption_deterministic_key') }}
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT= {{ applications | get_app_conf(application_id, 'credentials.active_record_encryption_key_derivation_salt') }}
ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY= {{ applications | get_app_conf(application_id, 'credentials.active_record_encryption_primary_key') }}
DB_HOST={{ database_host }}
DB_PORT={{ database_port }}

View File

@@ -1,2 +1,11 @@
application_id: "mastodon"
database_type: "postgres"
application_id: "web-app-mastodon"
database_type: "postgres"
mastodon_version: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.version', True) }}"
mastodon_image: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.image', True) }}"
mastodon_name: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.name', True) }}"
mastodon_volume: "{{ applications | get_app_conf(application_id, 'docker.services.volumes.data', True) }}"
mastodon_streaming_version: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.version', True) }}"
mastodon_streaming_image: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.image', True) }}"
mastodon_streaming_name: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.name', True) }}_streaming"
mastodon_sidekiq_name: "{{ applications | get_app_conf(application_id, 'docker.services.mastodon.name', True) }}_sidekiq"
mastodon_setup: "{{ applications | get_app_conf(application_id, 'setup', True) }}"