2022-12-29 21:13:31 +00:00
|
|
|
# vim: ft=yaml.ansible
|
|
|
|
---
|
2022-05-07 20:53:18 +00:00
|
|
|
- name: create mastodon volume folders
|
|
|
|
file:
|
2022-11-26 08:15:18 +00:00
|
|
|
name: "{{ services.mastodon.volume_folder }}/{{ volume }}"
|
2022-05-07 20:53:18 +00:00
|
|
|
state: directory
|
|
|
|
owner: "991"
|
|
|
|
group: "991"
|
|
|
|
loop:
|
|
|
|
- "postgres_data"
|
2022-12-04 21:45:32 +00:00
|
|
|
- "postgres_config"
|
2022-05-07 20:53:18 +00:00
|
|
|
- "redis_data"
|
|
|
|
- "mastodon_data"
|
|
|
|
loop_control:
|
|
|
|
loop_var: volume
|
|
|
|
|
|
|
|
- name: Copy mastodon environment file
|
|
|
|
template:
|
|
|
|
src: files/configs/mastodon/env_file.j2
|
2022-11-26 08:15:18 +00:00
|
|
|
dest: "{{ services.mastodon.volume_folder }}/env_file"
|
2022-05-07 20:53:18 +00:00
|
|
|
|
2022-12-02 22:10:15 +00:00
|
|
|
- name: Upload vhost config for root domain
|
2022-05-07 20:53:18 +00:00
|
|
|
template:
|
|
|
|
src: files/configs/mastodon/vhost-mastodon
|
2022-11-26 08:15:18 +00:00
|
|
|
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.mastodon.domain }}"
|
2022-05-07 20:53:18 +00:00
|
|
|
|
2022-12-04 21:45:32 +00:00
|
|
|
- name: Copy PostgreSQL config
|
2022-12-02 22:10:15 +00:00
|
|
|
copy:
|
|
|
|
src: files/configs/mastodon/postgresql.conf
|
2022-12-04 21:45:32 +00:00
|
|
|
dest: "{{ services.mastodon.volume_folder }}/postgres_config/postgresql.conf"
|
2022-12-02 22:10:15 +00:00
|
|
|
|
2022-12-04 21:45:32 +00:00
|
|
|
- name: Set up Mastodon
|
2022-05-07 20:53:18 +00:00
|
|
|
docker_compose:
|
|
|
|
project_name: mastodon
|
2022-12-04 21:45:32 +00:00
|
|
|
pull: true
|
2022-12-04 21:55:00 +00:00
|
|
|
restarted: true
|
2022-05-07 20:53:18 +00:00
|
|
|
definition:
|
2022-12-02 22:10:15 +00:00
|
|
|
x-sidekiq: &sidekiq
|
|
|
|
image: "tootsuite/mastodon:{{ services.mastodon.version }}"
|
|
|
|
restart: always
|
|
|
|
env_file: "{{ services.mastodon.volume_folder }}/env_file"
|
|
|
|
depends_on:
|
|
|
|
db:
|
|
|
|
condition: "service_healthy"
|
|
|
|
redis:
|
|
|
|
condition: "service_healthy"
|
|
|
|
networks:
|
|
|
|
- postfix
|
|
|
|
- external_services
|
|
|
|
- internal_network
|
|
|
|
volumes:
|
|
|
|
- "{{ services.mastodon.volume_folder }}/mastodon_data:/mastodon/public/system"
|
|
|
|
healthcheck:
|
|
|
|
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
|
|
|
|
|
2022-05-07 20:53:18 +00:00
|
|
|
version: '3'
|
|
|
|
services:
|
|
|
|
db:
|
|
|
|
restart: always
|
|
|
|
image: postgres:14-alpine
|
|
|
|
shm_size: 256mb
|
|
|
|
networks:
|
|
|
|
- internal_network
|
|
|
|
healthcheck:
|
|
|
|
test: ['CMD', 'pg_isready', '-U', 'postgres']
|
|
|
|
volumes:
|
2022-11-26 08:15:18 +00:00
|
|
|
- "{{ services.mastodon.volume_folder }}/postgres_data:/var/lib/postgresql/data"
|
2022-12-04 21:45:32 +00:00
|
|
|
- "{{ services.mastodon.volume_folder }}/postgres_config:/config:ro"
|
|
|
|
command: postgres -c config_file=/config/postgresql.conf
|
2022-05-07 20:53:18 +00:00
|
|
|
environment:
|
|
|
|
- 'POSTGRES_HOST_AUTH_METHOD=trust'
|
|
|
|
|
|
|
|
redis:
|
|
|
|
restart: always
|
|
|
|
image: redis:6-alpine
|
|
|
|
networks:
|
|
|
|
- internal_network
|
|
|
|
healthcheck:
|
|
|
|
test: ['CMD', 'redis-cli', 'ping']
|
|
|
|
volumes:
|
2022-11-26 08:15:18 +00:00
|
|
|
- "{{ services.mastodon.volume_folder }}/redis_data:/data"
|
2022-05-07 20:53:18 +00:00
|
|
|
|
|
|
|
web:
|
2022-11-26 08:15:18 +00:00
|
|
|
image: "tootsuite/mastodon:{{ services.mastodon.version }}"
|
2022-05-07 20:53:18 +00:00
|
|
|
restart: always
|
2022-11-26 08:15:18 +00:00
|
|
|
env_file: "{{ services.mastodon.volume_folder }}/env_file"
|
2022-05-07 20:53:18 +00:00
|
|
|
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
|
|
|
|
networks:
|
|
|
|
- external_services
|
|
|
|
- internal_network
|
|
|
|
healthcheck:
|
|
|
|
# prettier-ignore
|
|
|
|
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
|
|
|
|
depends_on:
|
2022-11-26 16:18:31 +00:00
|
|
|
db:
|
|
|
|
condition: "service_healthy"
|
|
|
|
redis:
|
|
|
|
condition: "service_healthy"
|
2022-05-07 20:53:18 +00:00
|
|
|
volumes:
|
2022-11-26 08:15:18 +00:00
|
|
|
- "{{ services.mastodon.volume_folder }}/mastodon_data:/mastodon/public/system"
|
2022-05-07 20:53:18 +00:00
|
|
|
environment:
|
2022-12-02 22:10:15 +00:00
|
|
|
MAX_THREADS: 10
|
|
|
|
WEB_CONCURRENCY: 3
|
2022-11-26 08:15:18 +00:00
|
|
|
VIRTUAL_HOST: "{{ services.mastodon.domain }}"
|
2022-05-07 20:53:18 +00:00
|
|
|
VIRTUAL_PORT: "3000"
|
2022-11-22 13:38:46 +00:00
|
|
|
VIRTUAL_PATH: "/"
|
2022-11-26 08:15:18 +00:00
|
|
|
LETSENCRYPT_HOST: "{{ services.mastodon.domain }}"
|
2022-05-07 20:53:18 +00:00
|
|
|
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
|
|
|
|
|
|
|
|
streaming:
|
2022-11-26 08:15:18 +00:00
|
|
|
image: "tootsuite/mastodon:{{ services.mastodon.version }}"
|
2022-05-07 20:53:18 +00:00
|
|
|
restart: always
|
2022-11-26 08:15:18 +00:00
|
|
|
env_file: "{{ services.mastodon.volume_folder }}/env_file"
|
2022-05-07 20:53:18 +00:00
|
|
|
command: node ./streaming
|
|
|
|
networks:
|
|
|
|
- external_services
|
|
|
|
- internal_network
|
|
|
|
healthcheck:
|
|
|
|
# prettier-ignore
|
|
|
|
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
|
|
|
|
ports:
|
|
|
|
- '127.0.0.1:4000:4000'
|
|
|
|
depends_on:
|
2022-11-26 16:18:31 +00:00
|
|
|
db:
|
|
|
|
condition: "service_healthy"
|
|
|
|
redis:
|
|
|
|
condition: "service_healthy"
|
2022-11-22 13:38:46 +00:00
|
|
|
environment:
|
2022-12-02 22:10:15 +00:00
|
|
|
DB_POOL: 15
|
2022-11-26 08:15:18 +00:00
|
|
|
VIRTUAL_HOST: "{{ services.mastodon.domain }}"
|
2022-11-22 13:38:46 +00:00
|
|
|
VIRTUAL_PORT: "4000"
|
|
|
|
VIRTUAL_PATH: "/api/v1/streaming"
|
2022-05-07 20:53:18 +00:00
|
|
|
|
2022-12-02 22:10:15 +00:00
|
|
|
# sidekiq-default-push-pull: DB_POOL = 25, -c 25 for 25 connections
|
|
|
|
sidekiq-default-push-pull:
|
|
|
|
<<: *sidekiq
|
|
|
|
command: bundle exec sidekiq -c 25 -q default -q push -q pull
|
2022-11-22 08:36:36 +00:00
|
|
|
environment:
|
2022-12-02 22:10:15 +00:00
|
|
|
DB_POOL: 25
|
|
|
|
|
|
|
|
# sidekiq-default-pull-push: DB_POOL = 25, -c 25 for 25 connections
|
|
|
|
sidekiq-default-pull-push:
|
|
|
|
<<: *sidekiq
|
|
|
|
command: bundle exec sidekiq -c 25 -q default -q pull -q push
|
|
|
|
environment:
|
|
|
|
DB_POOL: 25
|
|
|
|
|
|
|
|
# sidekiq-pull-default-push: DB_POOL = 25, -c 25 for 25 connections
|
|
|
|
sidekiq-pull-default-push:
|
|
|
|
<<: *sidekiq
|
|
|
|
command: bundle exec sidekiq -c 25 -q pull -q default -q push
|
|
|
|
environment:
|
|
|
|
DB_POOL: 25
|
|
|
|
|
|
|
|
# sidekiq-push-default-pull: DB_POOL = 25, -c 25 for 25 connections
|
|
|
|
sidekiq-push-default-pull:
|
|
|
|
<<: *sidekiq
|
|
|
|
command: bundle exec sidekiq -c 25 -q push -q default -q pull
|
|
|
|
environment:
|
|
|
|
DB_POOL: 25
|
|
|
|
|
|
|
|
# sidekiq-push-scheduler: DB_POOL = 5, -c 5 for 5 connections
|
|
|
|
sidekiq-push-scheduler:
|
|
|
|
<<: *sidekiq
|
|
|
|
command: bundle exec sidekiq -c 5 -q push -q scheduler
|
|
|
|
environment:
|
|
|
|
DB_POOL: 5
|
|
|
|
|
|
|
|
# sidekiq-push-mailers: DB_POOL = 5, -c 5 for 5 connections
|
|
|
|
sidekiq-push-mailers:
|
|
|
|
<<: *sidekiq
|
|
|
|
command: bundle exec sidekiq -c 5 -q push -q mailers
|
|
|
|
environment:
|
|
|
|
DB_POOL: 5
|
|
|
|
|
|
|
|
# sidekiq-push-ingress: DB_POOL = 10, -c 10 for 10 connections
|
|
|
|
sidekiq-push-ingress:
|
|
|
|
<<: *sidekiq
|
|
|
|
command: bundle exec sidekiq -c 10 -q push -q ingress
|
|
|
|
environment:
|
|
|
|
DB_POOL: 10
|
2022-05-07 20:53:18 +00:00
|
|
|
|
|
|
|
networks:
|
|
|
|
external_services:
|
|
|
|
external: true
|
|
|
|
postfix:
|
|
|
|
external: true
|
|
|
|
internal_network:
|
2022-11-26 16:18:31 +00:00
|
|
|
internal: true
|