ansible-role-mastodon/templates/docker-compose.yml.j2
2023-07-07 21:51:29 +03:00

190 lines
4.4 KiB
Django/Jinja

version: '3'
services:
postgresql:
restart: always
image: postgres:14-alpine
env_file: env.production
shm_size: 256mb
networks:
- internal_network
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
- postgresql:/var/lib/postgresql/data
environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust'
# pgbouncer:
# image: edoburu/pgbouncer:1.12.0
# env_file: env.production
# depends_on:
# - postgresql
# healthcheck:
# test: ['CMD', 'pg_isready', '-h', 'localhost']
# networks:
# - internal_network
tor:
image: sirboops/tor
networks:
- external_network
- internal_network
privoxy:
image: sirboops/privoxy
volumes:
- ./priv-config:/opt/config
networks:
- external_network
- internal_network
redis:
restart: always
image: redis:7-alpine
networks:
- internal_network
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
volumes:
- redis:/data
redis-volatile:
image: redis:7-alpine
restart: always
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
networks:
- internal_network
{% if es_enabled %}
elasticsearch:
image: elasticsearch:{{ es_version | default('7.17.7') }}
restart: always
env_file: env.production
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
healthcheck:
test: ["CMD-SHELL", "nc -z elasticsearch 9200"]
volumes:
- elasticsearch:/usr/share/elasticsearch/data
networks:
- internal_network
{% endif %}
website:
build: .
restart: always
#image: tootsuite/mastodon:latest
image: ghcr.io/mastodon/mastodon
env_file:
- env.production
#command: bash -c "bundle exec rails s -p 3000"
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
networks:
- external_network
- internal_network
healthcheck:
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
ports:
- '127.0.0.1:3000:3000'
depends_on:
- postgresql
# - pgbouncer
- redis
- redis-volatile
- elasticsearch
volumes:
#- uploads:/mastodon/public/system
- ./public/system:/mastodon/public/system
shell:
image: tootsuite/mastodon:latest
env_file:
- env.production
command: /bin/bash
restart: "no"
networks:
- internal_network
- external_network
volumes:
- uploads:/mastodon/public/system
streaming:
build: .
image: ghcr.io/mastodon/mastodon
#image: tootsuite/mastodon:latest
env_file:
- env.production
command: node ./streaming
restart: always
depends_on:
- postgresql
# - pgbouncer
- redis
- redis-volatile
- elasticsearch
ports:
- '127.0.0.1:4000:4000'
networks:
- internal_network
- external_network
healthcheck:
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
sidekiq:
build: .
image: ghcr.io/mastodon/mastodon
#image: tootsuite/mastodon:latest
env_file:
- env.production
command: bundle exec sidekiq
restart: always
depends_on:
- postgresql
# - pgbouncer
- redis
- redis-volatile
- website
networks:
- internal_network
- external_network
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
volumes:
#- uploads:/mastodon/public/system
- ./public/system:/mastodon/public/system
networks:
external_network:
driver: bridge
internal_network:
internal: true
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