ansible-role-mastodon/templates/docker-compose.yml.j2

151 lines
3.4 KiB
Text
Raw Normal View History

2022-11-19 17:24:45 +01:00
version: '3'
2022-11-19 21:55:50 +01:00
2022-11-19 17:24:45 +01:00
services:
2023-07-08 19:41:23 +02:00
db:
2023-07-07 20:48:52 +02:00
restart: always
2022-11-19 17:25:47 +01:00
image: postgres:14-alpine
2023-07-08 19:41:23 +02:00
shm_size: 256mb
2023-07-07 20:48:52 +02:00
networks:
- internal_network
2022-11-19 17:24:45 +01:00
healthcheck:
2022-11-19 17:56:21 +01:00
test: ['CMD', 'pg_isready', '-U', 'postgres']
2022-11-19 17:24:45 +01:00
volumes:
2023-07-08 19:41:23 +02:00
- ./postgres14:/var/lib/postgresql/data
2023-07-09 16:19:59 +02:00
env_file: .env.production
2022-11-19 21:55:50 +01:00
2023-07-07 20:51:29 +02:00
tor:
image: sirboops/tor
networks:
- external_network
- internal_network
2023-07-09 08:44:17 +02:00
2023-07-07 20:51:29 +02:00
privoxy:
image: sirboops/privoxy
volumes:
- ./priv-config:/opt/config
networks:
- external_network
- internal_network
2022-11-19 17:24:45 +01:00
redis:
2022-11-19 21:55:50 +01:00
restart: always
2023-07-07 20:48:52 +02:00
image: redis:7-alpine
networks:
- internal_network
2022-11-19 17:24:45 +01:00
healthcheck:
2022-11-19 17:56:21 +01:00
test: ['CMD', 'redis-cli', 'ping']
2022-11-19 17:24:45 +01:00
volumes:
2023-07-08 19:41:23 +02:00
- ./redis:/data
2022-11-19 17:24:45 +01:00
{% if redis_volatile %}
2022-11-19 21:55:50 +01:00
redis-volatile:
image: redis:7-alpine
2022-11-19 17:24:45 +01:00
restart: always
2022-11-19 21:55:50 +01:00
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
2022-11-19 17:24:45 +01:00
networks:
- internal_network
{% endif %}
2022-11-19 21:55:50 +01:00
{% if es_enabled %}
2023-07-08 19:41:23 +02:00
es:
2022-11-19 21:55:50 +01:00
restart: always
2023-07-08 19:41:23 +02:00
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.4
2022-11-19 21:55:50 +01:00
environment:
2023-07-08 19:41:23 +02:00
- "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:
- external_network
- internal_network
healthcheck:
2023-07-09 10:25:42 +02:00
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
2023-07-08 19:41:23 +02:00
volumes:
- ./elasticsearch:/usr/share/elasticsearch/data
2022-11-19 21:55:50 +01:00
ulimits:
memlock:
soft: -1
hard: -1
2023-07-08 19:41:23 +02:00
nofile:
soft: 65536
hard: 65536
ports:
2023-07-09 10:25:42 +02:00
- '127.0.0.1:{{ es_port }}:9200'
2023-07-08 19:41:23 +02:00
2022-11-19 21:55:50 +01:00
{% endif %}
2023-07-08 19:41:23 +02:00
web:
2023-07-07 20:48:52 +02:00
build: .
image: ghcr.io/mastodon/mastodon
2023-07-08 19:41:23 +02:00
restart: always
env_file: .env.production
2023-07-07 20:48:52 +02:00
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
networks:
- external_network
- internal_network
healthcheck:
2023-07-08 19:41:23 +02:00
# prettier-ignore
2023-07-07 20:48:52 +02:00
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
ports:
- '127.0.0.1:3000:3000'
2022-11-19 17:24:45 +01:00
depends_on:
2023-07-08 19:41:23 +02:00
- db
2022-11-19 17:24:45 +01:00
- redis
2023-07-09 08:44:17 +02:00
{% if es_enabled %} - es
{% endif %}
2022-11-19 21:55:50 +01:00
volumes:
2023-07-08 19:41:23 +02:00
- ./public/system:/mastodon/public/system
2022-11-19 17:24:45 +01:00
streaming:
2023-07-07 20:48:52 +02:00
build: .
image: ghcr.io/mastodon/mastodon
2022-11-19 21:55:50 +01:00
restart: always
2023-07-08 19:41:23 +02:00
env_file: .env.production
command: node ./streaming
2022-11-19 17:24:45 +01:00
networks:
2022-11-19 21:55:50 +01:00
- external_network
2023-07-08 19:41:23 +02:00
- internal_network
2022-11-19 17:24:45 +01:00
healthcheck:
2023-07-08 19:41:23 +02:00
# prettier-ignore
2022-11-19 17:56:21 +01:00
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
2023-07-08 19:41:23 +02:00
ports:
- '127.0.0.1:4000:4000'
depends_on:
- db
- redis
2022-11-19 17:24:45 +01:00
sidekiq:
2023-07-07 20:48:52 +02:00
build: .
image: ghcr.io/mastodon/mastodon
2022-11-19 21:55:50 +01:00
restart: always
2023-07-08 19:41:23 +02:00
env_file: .env.production
command: bundle exec sidekiq
2022-11-19 17:24:45 +01:00
depends_on:
2023-07-08 19:41:23 +02:00
- db
2022-11-19 17:24:45 +01:00
- redis
networks:
2022-11-19 21:55:50 +01:00
- external_network
2023-07-08 19:41:23 +02:00
- internal_network
volumes:
- ./public/system:/mastodon/public/system
2022-11-19 17:56:21 +01:00
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
2023-07-08 19:41:23 +02:00
2022-11-19 17:24:45 +01:00
networks:
external_network:
2023-07-07 11:24:58 +02:00
driver: bridge
2022-11-19 17:24:45 +01:00
internal_network:
internal: true
2022-11-19 21:55:50 +01:00
2023-07-08 19:41:23 +02:00
# networks:
# external_network:
# internal_network:
# internal: true