--- version: "3" services: db: container_name: mastodon-db restart: always image: postgres:15-alpine shm_size: 256mb networks: - internal_network healthcheck: test: ['CMD', 'pg_isready', '-U', 'postgres'] volumes: - ./data/postgres:/var/lib/postgresql/data environment: - POSTGRES_HOST_AUTH_METHOD=trust redis: container_name: mastodon-redis restart: always image: redis:7-alpine networks: - internal_network healthcheck: test: ['CMD', 'redis-cli', 'ping'] volumes: - ./data/redis:/data web: container_name: mastodon-web build: . restart: always env_file: .env.production 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 depends_on: - db - redis volumes: - ./mastodon:/opt/my-mastodon streaming: container_name: mastodon-streaming build: . restart: always env_file: .env.production command: node ./streaming depends_on: - db - redis networks: - external_network - internal_network healthcheck: test: - CMD-SHELL - wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1 volumes: - ./mastodon:/opt/my-mastodon sidekiq: container_name: mastodon-sidekiq build: . restart: always env_file: .env.production command: bundle exec sidekiq depends_on: - db - redis networks: - external_network - internal_network healthcheck: test: - CMD-SHELL - ps aux | grep '[s]idekiq 6' || false volumes: - ./mastodon:/opt/my-mastodon nginx: container_name: mastodon-nginx restart: always image: nginx:latest depends_on: - web networks: - external_network - internal_network ports: # only needs http - 127.0.0.1:3001:80 # - 127.0.0.1:3002:443 volumes: - ./mastodon/public:/mastodon/public - ./nginx/conf.d:/etc/nginx/conf.d - ./data/nginx-cache:/var/cache/nginx duplicity: container_name: mastodon-duplicity hostname: mastodon-duplicity restart: always image: ghcr.io/tecnativa/docker-duplicity-postgres-s3:v3.1.1 env_file: .env.duplicity networks: - internal_network - external_network volumes: - ./data/redis:/mnt/redis:ro networks: external_network: internal_network: internal: true