version: '3' services: postgresql: image: postgres:14-alpine env_file: env.production restart: always shm_size: 256mb healthcheck: test: ['CMD', 'pg_isready', '-U', 'postgres'] volumes: - postgresql:/var/lib/postgresql/data networks: - internal_network # pgbouncer: # image: edoburu/pgbouncer:1.12.0 # env_file: env.production # 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 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: image: tootsuite/mastodon:latest env_file: - env.production 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 - 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:latest env_file: - env.production command: /bin/bash restart: "no" networks: - internal_network - external_network volumes: - uploads:/mastodon/public/system streaming: 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: 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 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