This repository has been archived on 2023-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
max/ansible/roles/mastodon/templates/docker-compose.yml.j2

104 lines
3.1 KiB
Text
Raw Normal View History

2022-12-06 21:20:54 +00:00
version: '3'
services:
db:
restart: always
image: postgres:14-alpine
container_name: mastodon-db
2022-12-06 21:20:54 +00:00
shm_size: 256mb
networks:
2023-01-02 16:18:29 +00:00
- default
2022-12-06 21:20:54 +00:00
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
2023-01-07 19:32:42 +00:00
- {{ data_dir }}/postgres14:/var/lib/postgresql/data
2022-12-06 21:20:54 +00:00
environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust'
- 'POSTGRES_PASSWORD={{ mastodon_postgres_password }}'
- 'POSTGRES_DB=mastodon_production'
- 'POSTGRES_USER=mastodon'
redis:
restart: always
image: redis:7-alpine
container_name: mastodon-redis
2022-12-06 21:20:54 +00:00
networks:
2023-01-02 16:18:29 +00:00
- default
2022-12-06 21:20:54 +00:00
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
volumes:
2023-01-07 19:32:42 +00:00
- {{ data_dir }}/redis:/data
2022-12-06 21:20:54 +00:00
environment:
- 'REDIS_PASSWORD={{ mastodon_redis_password }}'
web:
image: tootsuite/mastodon:v3.5.3
container_name: mastodon-web
2022-12-06 21:20:54 +00:00
restart: always
env_file: .env.production
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
networks:
2023-01-02 16:18:29 +00:00
- default
- traefik
2022-12-06 21:20:54 +00:00
healthcheck:
# prettier-ignore
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
depends_on:
- db
- redis
volumes:
2023-01-07 19:32:42 +00:00
- {{ data_dir }}/public/system:/mastodon/public/system
- {{ service_dir }}/cache:/mastodon/public/system/cache
2023-01-02 16:18:29 +00:00
labels:
- traefik.enable=true
2023-01-02 16:18:29 +00:00
- traefik.http.routers.mastodon.entrypoints=websecure
- traefik.http.routers.mastodon.rule=Host(`social.pizzapim.nl`)
- traefik.http.routers.mastodon.tls=true
2023-02-08 07:27:30 +00:00
- traefik.http.routers.mastodon.tls.certresolver=letsencrypt
2023-01-02 16:18:29 +00:00
- traefik.http.services.mastodon.loadbalancer.server.port=3000
- traefik.http.routers.mastodon.service=mastodon
- traefik.docker.network=traefik
2022-12-06 21:20:54 +00:00
streaming:
image: tootsuite/mastodon:v3.5.3
container_name: mastodon-streaming
2022-12-06 21:20:54 +00:00
restart: always
env_file: .env.production
command: node ./streaming
networks:
2023-01-02 16:18:29 +00:00
- default
- traefik
2022-12-06 21:20:54 +00:00
healthcheck:
# prettier-ignore
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
depends_on:
- db
- redis
2023-01-02 16:18:29 +00:00
labels:
- traefik.enable=true
2023-01-02 16:18:29 +00:00
- traefik.http.routers.mastodon-streaming.entrypoints=websecure
- "traefik.http.routers.mastodon-streaming.rule=(Host(`social.pizzapim.nl`) && PathPrefix(`/api/v1/streaming`))"
- traefik.http.routers.mastodon-streaming.service=mastodon-streaming
- traefik.http.services.mastodon-streaming.loadbalancer.server.port=4000
- traefik.docker.network=traefik
2022-12-06 21:20:54 +00:00
sidekiq:
image: tootsuite/mastodon:v3.5.3
container_name: mastodon-sidekiq
2022-12-06 21:20:54 +00:00
restart: always
env_file: .env.production
command: bundle exec sidekiq
depends_on:
- db
- redis
networks:
2023-01-02 16:18:29 +00:00
- default
2022-12-06 21:20:54 +00:00
volumes:
2023-01-07 19:32:42 +00:00
- {{ data_dir }}/public/system:/mastodon/public/system
- {{ service_dir }}/cache:/mastodon/public/system/cache
2022-12-06 21:20:54 +00:00
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
networks:
2023-01-02 16:18:29 +00:00
traefik:
external: true