Skip to content

Instantly share code, notes, and snippets.

@gutocarvalho
Created December 11, 2022 14:17
Show Gist options
  • Save gutocarvalho/c519a264d4f14652a614439d721f8c2e to your computer and use it in GitHub Desktop.
Save gutocarvalho/c519a264d4f14652a614439d721f8c2e to your computer and use it in GitHub Desktop.
mastodon docker-compose
version: '3'
services:
postgresql:
image: postgres:14
env_file: database.env
restart: always
shm_size: 256mb
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'mastodon']
volumes:
- postgresql:/var/lib/postgresql/data
networks:
- internal_network
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
restart: always
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
volumes:
- redis:/data
networks:
- internal_network
redis-volatile:
image: redis:7
restart: always
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
networks:
- internal_network
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
website:
image: tootsuite/mastodon:v4.0.2
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:
- '3000:3000'
networks:
- internal_network
- 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.0.2
env_file:
- application.env
- database.env
command: /bin/bash
restart: "no"
networks:
- internal_network
- external_network
volumes:
- uploads:/mastodon/public/system
streaming:
image: tootsuite/mastodon:v4.0.2
env_file:
- application.env
- database.env
environment:
- DB_POOL=3
healthcheck:
command: node ./streaming
restart: always
depends_on:
- postgresql
- pgbouncer
- redis
- redis-volatile
- elasticsearch
ports:
- '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:
image: tootsuite/mastodon:v4.0.2
env_file:
- application.env
- database.env
command: bundle exec sidekiq
restart: always
depends_on:
- postgresql
- pgbouncer
- redis
- redis-volatile
- website
networks:
- internal_network
- external_network
environment:
- DB_POOL=10
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
volumes:
- uploads:/mastodon/public/system
command: bundle exec sidekiq -c 10 -q default
sidekiq-mailer:
image: tootsuite/mastodon:v4.0.2
env_file:
- application.env
- database.env
command: bundle exec sidekiq
restart: always
depends_on:
- postgresql
- pgbouncer
- redis
- redis-volatile
- website
networks:
- internal_network
- external_network
environment:
- DB_POOL=10
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
volumes:
- uploads:/mastodon/public/system
command: bundle exec sidekiq -c 10 -q mailers
sidekiq-ingress:
image: tootsuite/mastodon:v4.0.2
env_file:
- application.env
- database.env
command: bundle exec sidekiq
restart: always
depends_on:
- postgresql
- pgbouncer
- redis
- redis-volatile
- website
networks:
- internal_network
- external_network
environment:
- DB_POOL=10
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
volumes:
- uploads:/mastodon/public/system
command: bundle exec sidekiq -c 10 -q ingress
sidekiq-scheduler:
image: tootsuite/mastodon:v4.0.2
env_file:
- application.env
- database.env
command: bundle exec sidekiq
restart: always
depends_on:
- postgresql
- pgbouncer
- redis
- redis-volatile
- website
networks:
- internal_network
- external_network
environment:
- DB_POOL=10
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
volumes:
- uploads:/mastodon/public/system
command: bundle exec sidekiq -c 10 -q scheduler
sidekiq-pull:
image: tootsuite/mastodon:v4.0.2
env_file:
- application.env
- database.env
command: bundle exec sidekiq
restart: always
depends_on:
- postgresql
- pgbouncer
- redis
- redis-volatile
- website
networks:
- internal_network
- external_network
environment:
- DB_POOL=20
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
volumes:
- uploads:/mastodon/public/system
command: bundle exec sidekiq -c 20 -q pull
sidekiq-push:
image: tootsuite/mastodon:v4.0.2
env_file:
- application.env
- database.env
command: bundle exec sidekiq
restart: always
depends_on:
- postgresql
- pgbouncer
- redis
- redis-volatile
- website
networks:
- internal_network
- external_network
environment:
- DB_POOL=20
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
volumes:
- uploads:/mastodon/public/system
command: bundle exec sidekiq -c 20 -q push
networks:
external_network:
internal_network:
internal: true
volumes:
postgresql:
driver_opts:
type: none
device: /opt/mastodon-data/database/postgresql
o: bind
redis:
driver_opts:
type: none
device: /opt/mastodon-data/database/redis
o: bind
elasticsearch:
driver_opts:
type: none
device: /opt/mastodon-data/database/elasticsearch
o: bind
uploads:
driver_opts:
type: none
device: /opt/mastodon-data/web/system
o: bind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment