reynir
728cffc453
Co-authored-by: Reynir Björnsson <reynir@reynir.dk> Co-authored-by: Víðir Valberg Guðmundsson <valberg@orn.li> Reviewed-on: #124 Co-authored-by: reynir <data.coop@reynir.dk> Co-committed-by: reynir <data.coop@reynir.dk>
125 lines
3.7 KiB
YAML
125 lines
3.7 KiB
YAML
- name: create mastodon volume folders
|
|
file:
|
|
name: "{{ mastodon.volume_folder }}/{{ volume }}"
|
|
state: directory
|
|
owner: "991"
|
|
group: "991"
|
|
loop:
|
|
- "postgres_data"
|
|
- "redis_data"
|
|
- "mastodon_data"
|
|
loop_control:
|
|
loop_var: volume
|
|
|
|
- name: Copy mastodon environment file
|
|
template:
|
|
src: files/configs/mastodon/env_file.j2
|
|
dest: "{{ mastodon.volume_folder }}/env_file"
|
|
|
|
- name: upload vhost config for root domain
|
|
template:
|
|
src: files/configs/mastodon/vhost-mastodon
|
|
dest: "{{ nginx.volume_folder }}/vhost/{{ mastodon.domain }}"
|
|
|
|
- name: set up mastodon
|
|
docker_compose:
|
|
project_name: mastodon
|
|
pull: yes
|
|
definition:
|
|
version: '3'
|
|
services:
|
|
db:
|
|
restart: always
|
|
image: postgres:14-alpine
|
|
shm_size: 256mb
|
|
networks:
|
|
- internal_network
|
|
healthcheck:
|
|
test: ['CMD', 'pg_isready', '-U', 'postgres']
|
|
volumes:
|
|
- "{{ mastodon.volume_folder }}/postgres_data:/var/lib/postgresql/data"
|
|
environment:
|
|
- 'POSTGRES_HOST_AUTH_METHOD=trust'
|
|
|
|
redis:
|
|
restart: always
|
|
image: redis:6-alpine
|
|
networks:
|
|
- internal_network
|
|
healthcheck:
|
|
test: ['CMD', 'redis-cli', 'ping']
|
|
volumes:
|
|
- "{{ mastodon.volume_folder }}/redis_data:/data"
|
|
|
|
web:
|
|
image: "tootsuite/mastodon:{{ mastodon_version }}"
|
|
restart: always
|
|
env_file: "{{ mastodon.volume_folder }}/env_file"
|
|
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:
|
|
- db
|
|
- redis
|
|
volumes:
|
|
- "{{ mastodon.volume_folder }}/mastodon_data:/mastodon/public/system"
|
|
environment:
|
|
VIRTUAL_HOST: "{{ mastodon.domain }}"
|
|
VIRTUAL_PORT: "3000"
|
|
VIRTUAL_PATH: "/"
|
|
LETSENCRYPT_HOST: "{{ mastodon.domain }}"
|
|
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
|
|
|
|
streaming:
|
|
image: "tootsuite/mastodon:{{ mastodon_version }}"
|
|
restart: always
|
|
env_file: "{{ mastodon.volume_folder }}/env_file"
|
|
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:
|
|
- db
|
|
- redis
|
|
environment:
|
|
VIRTUAL_HOST: "{{ mastodon.domain }}"
|
|
VIRTUAL_PORT: "4000"
|
|
VIRTUAL_PATH: "/api/v1/streaming"
|
|
|
|
sidekiq:
|
|
image: "tootsuite/mastodon:{{ mastodon_version }}"
|
|
restart: always
|
|
env_file: "{{ mastodon.volume_folder }}/env_file"
|
|
command: bundle exec sidekiq -c 32
|
|
environment:
|
|
DB_POOL: 32
|
|
depends_on:
|
|
- db
|
|
- redis
|
|
networks:
|
|
- postfix
|
|
- external_services
|
|
- internal_network
|
|
volumes:
|
|
- "{{ mastodon.volume_folder }}/mastodon_data:/mastodon/public/system"
|
|
healthcheck:
|
|
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
|
|
|
|
networks:
|
|
external_services:
|
|
external: true
|
|
postfix:
|
|
external: true
|
|
internal_network:
|
|
internal: true
|
|
vars:
|
|
mastodon_version: "v4.0.2" |