ansible-role-mastodon/templates/docker-compose.yml.j2

169 lines
3.8 KiB
Text
Raw Normal View History

2022-11-19 17:24:45 +01:00
version: '3'
2022-11-19 21:55:50 +01:00
2022-11-19 17:24:45 +01:00
services:
2022-11-19 21:55:50 +01:00
postgresql:
2022-11-19 17:25:47 +01:00
image: postgres:14-alpine
2022-11-24 08:53:59 +01:00
env_file: env.production
2022-11-19 21:55:50 +01:00
restart: always
2022-11-19 17:24:45 +01:00
shm_size: 256mb
healthcheck:
2022-11-19 17:56:21 +01:00
test: ['CMD', 'pg_isready', '-U', 'postgres']
2022-11-19 17:24:45 +01:00
volumes:
2022-11-19 21:55:50 +01:00
- postgresql:/var/lib/postgresql/data
networks:
- internal_network
# pgbouncer:
# image: edoburu/pgbouncer:1.12.0
2022-11-24 08:53:59 +01:00
# env_file: env.production
2022-11-19 21:55:50 +01:00
# depends_on:
# - postgresql
# healthcheck:
# test: ['CMD', 'pg_isready', '-h', 'localhost']
# networks:
# - internal_network
2022-11-19 17:24:45 +01:00
redis:
2022-11-19 17:56:21 +01:00
image: redis:7-alpine
2022-11-19 21:55:50 +01:00
restart: always
2022-11-19 17:24:45 +01:00
healthcheck:
2022-11-19 17:56:21 +01:00
test: ['CMD', 'redis-cli', 'ping']
2022-11-19 17:24:45 +01:00
volumes:
2022-11-19 21:55:50 +01:00
- redis:/data
networks:
- internal_network
2022-11-19 17:24:45 +01:00
2022-11-19 21:55:50 +01:00
redis-volatile:
image: redis:7-alpine
2022-11-19 17:24:45 +01:00
restart: always
2022-11-19 21:55:50 +01:00
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
2022-11-19 17:24:45 +01:00
networks:
- internal_network
2022-11-19 21:55:50 +01:00
{% if es_enabled %}
elasticsearch:
2022-11-19 22:00:24 +01:00
image: elasticsearch:{{ es_version | default('7.17.7') }}
2022-11-19 21:55:50 +01:00
restart: always
2022-11-24 08:53:59 +01:00
env_file: env.production
2022-11-19 21:55:50 +01:00
environment:
- cluster.name=elasticsearch-mastodon
- discovery.type=single-node
- bootstrap.memory_lock=true
- xpack.security.enabled=true
- ingest.geoip.downloader.enabled=false
ulimits:
memlock:
soft: -1
hard: -1
2022-11-19 17:24:45 +01:00
healthcheck:
2022-11-19 21:55:50 +01:00
test: ["CMD-SHELL", "nc -z elasticsearch 9200"]
volumes:
- elasticsearch:/usr/share/elasticsearch/data
networks:
- internal_network
{% endif %}
website:
image: tootsuite/mastodon:latest
env_file:
2022-11-24 08:53:59 +01:00
- env.production
- env.production
2022-11-19 21:55:50 +01:00
command: bash -c "bundle exec rails s -p 3000"
restart: always
2022-11-19 17:24:45 +01:00
depends_on:
2022-11-19 21:55:50 +01:00
- postgresql
# - pgbouncer
2022-11-19 17:24:45 +01:00
- redis
2022-11-19 21:55:50 +01:00
- redis-volatile
- elasticsearch
ports:
- '127.0.0.1:3000:3000'
networks:
- internal_network
- external_network
healthcheck:
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
2022-11-19 17:24:45 +01:00
volumes:
2022-11-19 21:55:50 +01:00
- uploads:/mastodon/public/system
shell:
image: tootsuite/mastodon:latest
env_file:
2022-11-24 08:53:59 +01:00
- env.production
- env.production
2022-11-19 21:55:50 +01:00
command: /bin/bash
restart: "no"
networks:
- internal_network
- external_network
volumes:
- uploads:/mastodon/public/system
2022-11-19 17:24:45 +01:00
streaming:
2022-11-19 21:55:50 +01:00
image: tootsuite/mastodon:latest
env_file:
2022-11-24 08:53:59 +01:00
- env.production
- env.production
2022-11-19 17:24:45 +01:00
command: node ./streaming
2022-11-19 21:55:50 +01:00
restart: always
depends_on:
- postgresql
# - pgbouncer
- redis
- redis-volatile
- elasticsearch
ports:
- '127.0.0.1:4000:4000'
2022-11-19 17:24:45 +01:00
networks:
- internal_network
2022-11-19 21:55:50 +01:00
- external_network
2022-11-19 17:24:45 +01:00
healthcheck:
2022-11-19 17:56:21 +01:00
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
2022-11-19 17:24:45 +01:00
sidekiq:
2022-11-19 21:55:50 +01:00
image: tootsuite/mastodon:latest
env_file:
2022-11-24 08:53:59 +01:00
- env.production
- env.production
2022-11-19 17:24:45 +01:00
command: bundle exec sidekiq
2022-11-19 21:55:50 +01:00
restart: always
2022-11-19 17:24:45 +01:00
depends_on:
2022-11-19 21:55:50 +01:00
- postgresql
# - pgbouncer
2022-11-19 17:24:45 +01:00
- redis
2022-11-19 21:55:50 +01:00
- redis-volatile
- website
2022-11-19 17:24:45 +01:00
networks:
- internal_network
2022-11-19 21:55:50 +01:00
- external_network
2022-11-19 17:56:21 +01:00
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
2022-11-19 21:55:50 +01:00
volumes:
- uploads:/mastodon/public/system
2022-11-19 17:24:45 +01:00
networks:
external_network:
internal_network:
internal: true
2022-11-19 21:55:50 +01:00
volumes:
postgresql:
driver_opts:
type: none
device: {{ mastodon_composer_folder }}/database/postgresql
o: bind
redis:
driver_opts:
type: none
device: {{ mastodon_composer_folder }}/database/redis
o: bind
{% if es_enabled %} elasticsearch:
driver_opts:
type: none
device: {{ mastodon_composer_folder }}/database/elasticsearch
o: bind
{% endif %} uploads:
driver_opts:
type: none
device: {{ mastodon_composer_folder }}/web/system
o: bind