102 lines
2.7 KiB
YAML
102 lines
2.7 KiB
YAML
---
|
|
- name: Create mastodon docker network
|
|
become: true
|
|
community.docker.docker_network:
|
|
name: mastodon
|
|
- name: Create redis container
|
|
include_role:
|
|
name: redis
|
|
vars:
|
|
preset: persistent
|
|
container_name: redis-mastodon
|
|
docker_networks:
|
|
- name: mastodon
|
|
docker_volume: redis-mastodon
|
|
- name: Create redis cache container
|
|
include_role:
|
|
name: redis
|
|
vars:
|
|
preset: cache
|
|
container_name: redis-mastodon-cache
|
|
docker_networks:
|
|
- name: mastodon
|
|
- name: Create mastodon's public volume
|
|
become: true
|
|
community.docker.docker_volume:
|
|
name: mastodon-public-system
|
|
- name: Create mastodon config directory
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: /etc/mastodon
|
|
state: directory
|
|
mode: '1750'
|
|
owner: root
|
|
group: root
|
|
- name: Copy env file
|
|
become: true
|
|
ansible.builtin.template:
|
|
src: mastodon.env.j2
|
|
dest: /etc/mastodon/.env
|
|
mode: '0660'
|
|
owner: root
|
|
group: root
|
|
- name: Create web container
|
|
become: true
|
|
community.docker.docker_container:
|
|
name: mastodon-web-{{ item }}
|
|
image: ghcr.io/mastodon/mastodon:{{ version }}
|
|
env_file: /etc/mastodon/.env
|
|
command: ["bundle", "exec", "puma", "-C", "config/puma.rb"]
|
|
networks:
|
|
- name: mastodon
|
|
- name: postgresql
|
|
- name: minio
|
|
- name: haproxy
|
|
- name: authentik
|
|
volumes:
|
|
- mastodon-public-system:/mastodon/public/system
|
|
restart_policy: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "--fail", "127.0.0.1:3000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
# TODO: enable after ansible update
|
|
# state: healthy
|
|
loop: ["1", "2"]
|
|
- name: Create streaming container
|
|
become: true
|
|
community.docker.docker_container:
|
|
name: mastodon-streaming
|
|
image: ghcr.io/mastodon/mastodon-streaming:{{ version }}
|
|
env_file: /etc/mastodon/.env
|
|
command: ["node", "./streaming/index.js"]
|
|
networks:
|
|
- name: mastodon
|
|
- name: postgresql
|
|
- name: haproxy
|
|
restart_policy: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "--fail", "127.0.0.1:4000/api/v1/streaming/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
# TODO: enable after ansible update
|
|
# state: healthy
|
|
- name: Create sidekiq container
|
|
become: true
|
|
community.docker.docker_container:
|
|
name: mastodon-sidekiq
|
|
image: ghcr.io/mastodon/mastodon:{{ version }}
|
|
env_file: /etc/mastodon/.env
|
|
command: ["bundle", "exec", "sidekiq"]
|
|
networks:
|
|
- name: mastodon
|
|
- name: postgresql
|
|
- name: minio
|
|
- name: authentik
|
|
volumes:
|
|
- mastodon-public-system:/mastodon/public/system
|
|
restart_policy: unless-stopped
|