157 lines
3.7 KiB
YAML
157 lines
3.7 KiB
YAML
---
|
|
services:
|
|
db:
|
|
container_name: mastodon-db
|
|
restart: always
|
|
image: postgres:15-alpine
|
|
mem_limit: 512mb
|
|
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
|
|
mem_limit: 128mb
|
|
networks:
|
|
- internal_network
|
|
healthcheck:
|
|
test: ['CMD', 'redis-cli', 'ping']
|
|
volumes:
|
|
- ./data/redis:/data
|
|
|
|
web:
|
|
container_name: mastodon-web
|
|
build: .
|
|
restart: always
|
|
mem_limit: 1024mb
|
|
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
|
|
- es
|
|
volumes:
|
|
- ./mastodon:/opt/my-mastodon
|
|
|
|
streaming:
|
|
container_name: mastodon-streaming
|
|
image: ghcr.io/mastodon/mastodon-streaming:v4.3.1
|
|
restart: always
|
|
mem_limit: 128mb
|
|
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
|
|
|
|
sidekiq:
|
|
container_name: mastodon-sidekiq
|
|
build: .
|
|
restart: always
|
|
mem_limit: 512mb
|
|
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
|
|
mem_limit: 64mb
|
|
depends_on:
|
|
- web
|
|
- streaming
|
|
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.3.1
|
|
mem_limit: 256mb
|
|
env_file: .env.duplicity
|
|
networks:
|
|
- internal_network
|
|
- external_network
|
|
volumes:
|
|
- ./data/redis:/mnt/redis:ro
|
|
|
|
# Comment this service if you want to disable full-text search.
|
|
es:
|
|
container_name: mastodon-es
|
|
restart: always
|
|
image: elasticsearch:7.17.20
|
|
mem_limit: 1.5gb
|
|
environment:
|
|
- "ES_JAVA_OPTS=-Xms512m -Xmx512m -Des.enforce.bootstrap.checks=true"
|
|
- "xpack.license.self_generated.type=basic"
|
|
- "xpack.security.enabled=false"
|
|
- "xpack.watcher.enabled=false"
|
|
- "xpack.graph.enabled=false"
|
|
- "xpack.ml.enabled=false"
|
|
- "bootstrap.memory_lock=true"
|
|
- "cluster.name=es-mastodon"
|
|
- "discovery.type=single-node"
|
|
- "thread_pool.write.queue_size=1000"
|
|
networks:
|
|
- internal_network
|
|
- external_network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
|
|
volumes:
|
|
- ./data/elasticsearch:/usr/share/elasticsearch/data
|
|
ulimits:
|
|
memlock:
|
|
soft: -1
|
|
hard: -1
|
|
nofile:
|
|
soft: 65536
|
|
hard: 65536
|
|
|
|
networks:
|
|
external_network:
|
|
internal_network:
|
|
internal: true
|