docker-compose/conf/compose/mastodon.docker-compose.yml

116 lines
3.1 KiB
YAML

version: '3.8'
networks:
back:
mast-int:
volumes:
mastodon_public:
mastodon_redis:
mastodon_lockfile:
mastodon_db:
services:
### MASTODON
caddy:
image: caddy:2.6.4
volumes:
- mastodon_public:/srv/mastodon/public:ro
mastodon-redis:
restart: always
image: redis:7.0-alpine
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
env_file: ../mastodon/env.production
volumes:
- mastodon_redis:/data
networks:
- mast-int
restart: always
mastodon-web:
restart: always
image: tootsuite/mastodon:v4.3.0
#healthcheck:
#test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
#entrypoint:
# - bash
# - -c
# #- "bundle exec rake db:prepare && cd /opt/mastodon && /usr/bin/tini -- bundle exec rails server"
# - "[[ -e /mastodon/public/db.lock ]] && touch /mastodon/public/db.lock || touch /mastodon/public/db.lock && bundle exec rake db:prepare; /usr/bin/tini -- bundle exec rails server"
env_file: ../mastodon/env.production
ports:
- "127.0.0.1:3000:3000"
environment:
LOCAL_DOMAIN: "mastodon.${DWEB_DOMAIN}"
SMTP_FROM_ADDRESS: "notifications${DWEB_DOMAIN}"
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
depends_on:
- mastodon-db
- mastodon-redis
- mastodon-streaming
volumes:
# https://www.digitalocean.com/community/tutorials/how-to-share-data-between-docker-containers
- mastodon_public:/mastodon/public/ # map static files in volume for caddy
networks:
- mast-int
- back
restart: always
mastodon-streaming:
restart: always
image: tootsuite/mastodon:v4.3.0
healthcheck:
test: wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1
]
env_file: ../mastodon/env.production
ports:
- "127.0.0.1:4000:4000"
environment:
LOCAL_DOMAIN: "mastodon.${DWEB_DOMAIN}"
SMTP_FROM_ADDRESS: "notifications@${DWEB_DOMAIN}"
command: node ./streaming
depends_on:
- mastodon-db
- mastodon-redis
networks:
- mast-int
- back
restart: always
mastodon-sidekiq:
restart: always
image: tootsuite/mastodon:v4.3.0
#entrypoint:
# - sh
# - -c
# - "service sendmail start && /usr/bin/tini -- bundle exec sidekiq"
healthcheck:
test: ps aux | grep '[s]idekiq\ 6' || false
env_file: ../mastodon/env.production
environment:
LOCAL_DOMAIN: "mastodon.${DWEB_DOMAIN}"
SMTP_FROM_ADDRESS: "notifications@${DWEB_DOMAIN}"
command: bundle exec sidekiq
depends_on:
- mastodon-db
- mastodon-redis
volumes:
- mastodon_public:/mastodon/public/
networks:
- mast-int
restart: always
mastodon-db:
restart: always
image: postgres:14.13-alpine
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust'
volumes:
- mastodon_db:/var/lib/postgresql/data
networks:
- mast-int
restart: always