version: '2.4' services: # automatically update images watchtower: image: containrrr/watchtower restart: unless-stopped volumes: - /var/run/docker.sock:/var/run/docker.sock networks: - external # may not be necessary with recent docker, need to investigate ipv6nat: image: robbertkl/ipv6nat restart: always privileged: true network_mode: host volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - /lib/modules:/lib/modules:ro logrotate: image: blacklabelops/logrotate restart: unless-stopped environment: - LOGS_DIRECTORIES=/var/lib/docker/containers - LOGROTATE_INTERVAL=daily - LOGROTATE_COPIES=90 volumes: - /etc/localtime:/etc/localtime:ro - /var/lib/docker/containers:/var/lib/docker/containers logging: driver: "json-file" options: max-size: "50m" max-file: "3" db: restart: always image: postgres:15 healthcheck: test: ["CMD", "pg_isready", "-U", "postgres"] networks: - db_network volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - ./mastodon/db:/var/lib/postgresql/data redis: restart: always image: redis:alpine healthcheck: test: ["CMD", "redis-cli", "ping"] networks: - redis_network volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - ./mastodon/redis:/data mastodon-web: image: pluralcafe/mastodon:edge healthcheck: test: ["CMD-SHELL", "wget -q --spider --header 'x-forwarded-proto: https' --proxy=off localhost:3000/health || exit 1"] restart: always env_file: ./mastodon/.env.production command: sh -c "rm -f /mastodon/tmp/pids/server.pid; RAILS_ENV=production bundle exec rails db:migrate; bundle exec rails s -p 3000 -b '0.0.0.0'" networks: - db_network - redis_network - external depends_on: - ipv6nat - db - redis ports: - "127.0.0.1:3010:3000" volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - ./html/system:/mastodon/public/system mastodon-streaming: image: pluralcafe/mastodon:edge healthcheck: test: ["CMD-SHELL", "wget -q --spider --header 'x-forwarded-proto: https' --proxy=off localhost:4000/api/v1/streaming/health || exit 1"] restart: always env_file: ./mastodon/.env.production command: yarn start volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro networks: - db_network - redis_network - external depends_on: - db - redis ports: - "127.0.0.1:3011:4000" sidekiq: image: pluralcafe/mastodon:edge restart: always env_file: ./mastodon/.env.production command: bundle exec sidekiq -q default -q mailers -q push -q pull -q scheduler depends_on: - ipv6nat - db - redis networks: - external - db_network - redis_network volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - ./html/system:/mastodon/public/system # after the Twitter migration of november 2022, separating ingress only makes sense sidekiq-ingress: image: pluralcafe/mastodon:edge restart: always env_file: ./mastodon/.env.production command: bundle exec sidekiq -q default -q ingress depends_on: - ipv6nat - db - redis networks: - external - db_network - redis_network volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro - ./html/system:/mastodon/public/system barkeep: image: pluralcafe/barkeep restart: always env_file: ./mastodon/.env.ambassador command: yarn start depends_on: - db - ipv6nat - mastodon-web networks: - external - db_network volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro networks: external: driver: bridge enable_ipv6: true ipam: driver: default config: - subnet: 172.18.0.0/16 - subnet: fd00:0000:0000::/48 db_network: internal: true redis_network: internal: true