mastodon-docker-stack/docker-compose.yml

180 lines
4.0 KiB
YAML

version: '3'
services:
postgresql:
image: postgres:14
env_file: database.env
restart: always
shm_size: 256mb
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
- postgresql:/var/lib/postgresql/data
networks:
internal_network:
ipv4_address: '172.20.1.2'
# pgbouncer:
# image: edoburu/pgbouncer:1.12.0
# env_file: database.env
# depends_on:
# - postgresql
# healthcheck:
# test: ['CMD', 'pg_isready', '-h', 'localhost']
# networks:
# - internal_network
redis:
image: redis:7-alpine
restart: always
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
volumes:
- redis:/data
networks:
internal_network:
ipv4_address: '172.20.1.3'
redis-volatile:
image: redis:7-alpine
restart: always
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
networks:
internal_network:
ipv4_address: '172.20.1.4'
elasticsearch:
image: elasticsearch:7.17.3
restart: always
env_file: database.env
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:
ipv4_address: '172.20.1.5'
website:
image: tootsuite/mastodon:v4.1
env_file:
- application.env
- database.env
command: bash -c "bundle exec rails s -p 3000"
restart: always
depends_on:
- postgresql
# - pgbouncer
- redis
- redis-volatile
- elasticsearch
ports:
- '127.0.0.1:3000:3000'
networks:
internal_network:
ipv4_address: '172.20.1.6'
external_network:
healthcheck:
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
volumes:
- uploads:/mastodon/public/system
shell:
image: tootsuite/mastodon:v4.1
env_file:
- application.env
- database.env
command: /bin/bash
restart: "no"
networks:
internal_network:
ipv4_address: '172.20.1.7'
external_network:
volumes:
- uploads:/mastodon/public/system
streaming:
image: tootsuite/mastodon:v4.1
env_file:
- application.env
- database.env
command: node ./streaming
restart: always
depends_on:
- postgresql
# - pgbouncer
- redis
- redis-volatile
- elasticsearch
ports:
- '127.0.0.1:4000:4000'
networks:
internal_network:
ipv4_address: '172.20.1.8'
external_network:
healthcheck:
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
sidekiq:
image: tootsuite/mastodon:v4.1
env_file:
- application.env
- database.env
command: bundle exec sidekiq
restart: always
depends_on:
- postgresql
# - pgbouncer
- redis
- redis-volatile
- website
networks:
internal_network:
ipv4_address: '172.20.1.9'
external_network:
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
volumes:
- uploads:/mastodon/public/system
networks:
external_network:
internal_network:
internal: true
ipam:
driver: default
config:
- subnet: '172.20.1.0/28'
volumes:
postgresql:
driver_opts:
type: none
device: /opt/mastodon/database/postgresql
o: bind
redis:
driver_opts:
type: none
device: /opt/mastodon/database/redis
o: bind
elasticsearch:
driver_opts:
type: none
device: /opt/mastodon/database/elasticsearch
o: bind
uploads:
driver_opts:
type: none
device: /opt/mastodon/web/system
o: bind