Files
home_server/mastodon/docker-compose.yml
T
2025-02-03 09:26:56 +01:00

104 lines
2.9 KiB
YAML

version: '3.7'
services:
db:
restart: always
image: postgres:14-alpine
shm_size: 256mb
networks:
- internal_network
volumes:
- /srv/mastodon/postgres14:/var/lib/postgresql/data
# added from the default, otherwise you'll need to manually create a `mastodon` db and user/role
env_file:
- ./.env.production
environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust'
- 'POSTGRES_USER=postgres'
redis:
restart: always
image: redis:7-alpine
networks:
- internal_network
env_file:
- ./.env.production
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
volumes:
- /srv/mastodon/redis:/data
web:
image: ghcr.io/mastodon/mastodon:v4.3.3
restart: always
env_file:
- ./.env.production
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
networks:
- traefik
- internal_network
healthcheck:
# prettier-ignore
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
depends_on:
- db
- redis
volumes:
- /srv/mastodon/web/system:/mastodon/public/system
labels:
- traefik.enable=true
- "traefik.http.routers.mastodon.entrypoints=websecure"
- "traefik.http.routers.mastodon.rule=Host(`kvist.knast.cc`)"
- "traefik.http.routers.mastodon.tls=true"
- "traefik.http.routers.mastodon.tls.certresolver=letsencr"
- "traefik.http.services.mastodon.loadbalancer.server.port=3000"
streaming:
image: ghcr.io/mastodon/mastodon-streaming:v4.3.3
restart: always
env_file:
- ./.env.production
command: node ./streaming/index.js
environment:
- 'REDIS_URL=redis://redis:6379'
networks:
- traefik
- internal_network
healthcheck:
# prettier-ignore
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
depends_on:
- db
- redis
labels:
- traefik.enable=true
- traefik.http.routers.mastodon_streaming.rule=(Host(`kvist.knast.cc`) && PathPrefix(`/api/v1/streaming`))
- traefik.http.routers.mastodon_streaming.entrypoints=websecure
- traefik.http.routers.mastodon_streaming.tls=true
- traefik.http.routers.mastodon_streaming.tls.certresolver=letsencr
- traefik.http.services.mastodon_streaming.loadbalancer.server.port=4000
sidekiq:
image: ghcr.io/mastodon/mastodon:v4.3.3
restart: always
env_file:
- ./.env.production
command: bundle exec sidekiq
depends_on:
- db
- redis
networks:
- traefik
- internal_network
volumes:
- /srv/mastodon/web/system:/mastodon/public/system
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
networks:
traefik:
external: true
internal_network:
internal: true