Use upstream docker-compose

This commit is contained in:
Antonio J. Delgado 2023-07-08 20:41:23 +03:00
parent ef51842ebb
commit 5b06c55859

View file

@ -1,30 +1,19 @@
version: '3' version: '3'
services: services:
postgresql: db:
restart: always restart: always
image: postgres:14-alpine image: postgres:14-alpine
env_file: env.production shm_size: 256mb
shm_size: 256mb
networks: networks:
- internal_network - internal_network
healthcheck: healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres'] test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes: volumes:
- postgresql:/var/lib/postgresql/data - ./postgres14:/var/lib/postgresql/data
environment: environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust' - 'POSTGRES_HOST_AUTH_METHOD=trust'
# pgbouncer:
# image: edoburu/pgbouncer:1.12.0
# env_file: env.production
# depends_on:
# - postgresql
# healthcheck:
# test: ['CMD', 'pg_isready', '-h', 'localhost']
# networks:
# - internal_network
tor: tor:
image: sirboops/tor image: sirboops/tor
networks: networks:
@ -47,7 +36,7 @@ services:
healthcheck: healthcheck:
test: ['CMD', 'redis-cli', 'ping'] test: ['CMD', 'redis-cli', 'ping']
volumes: volumes:
- redis:/data - ./redis:/data
redis-volatile: redis-volatile:
image: redis:7-alpine image: redis:7-alpine
@ -57,109 +46,94 @@ services:
networks: networks:
- internal_network - internal_network
{% if es_enabled %} {% if es_enabled %}
elasticsearch: es:
image: elasticsearch:{{ es_version | default('7.17.7') }}
restart: always restart: always
env_file: env.production image: docker.elastic.co/elasticsearch/elasticsearch:7.17.4
environment: environment:
- cluster.name=elasticsearch-mastodon - "ES_JAVA_OPTS=-Xms512m -Xmx512m -Des.enforce.bootstrap.checks=true"
- discovery.type=single-node - "xpack.license.self_generated.type=basic"
- bootstrap.memory_lock=true - "xpack.security.enabled=false"
- xpack.security.enabled=true - "xpack.watcher.enabled=false"
- ingest.geoip.downloader.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:
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
volumes:
- ./elasticsearch:/usr/share/elasticsearch/data
ulimits: ulimits:
memlock: memlock:
soft: -1 soft: -1
hard: -1 hard: -1
healthcheck: nofile:
test: ["CMD-SHELL", "nc -z elasticsearch 9200"] soft: 65536
volumes: hard: 65536
- elasticsearch:/usr/share/elasticsearch/data ports:
networks: - '127.0.0.1:9200:9200'
- internal_network
{% endif %} {% endif %}
website: web:
build: . build: .
restart: always
#image: tootsuite/mastodon:latest
image: ghcr.io/mastodon/mastodon image: ghcr.io/mastodon/mastodon
env_file: restart: always
- env.production env_file: .env.production
#command: bash -c "bundle exec rails s -p 3000"
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000" command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
networks: networks:
- external_network - external_network
- internal_network - internal_network
healthcheck: healthcheck:
# prettier-ignore
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1'] test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
ports: ports:
- '127.0.0.1:3000:3000' - '127.0.0.1:3000:3000'
depends_on: depends_on:
- postgresql - db
# - pgbouncer
- redis - redis
- redis-volatile # - es
- elasticsearch
volumes: volumes:
- uploads:/mastodon/public/system - ./public/system:/mastodon/public/system
#- ./public/system:/mastodon/public/system
shell:
image: tootsuite/mastodon:latest
env_file:
- env.production
command: /bin/bash
restart: "no"
networks:
- internal_network
- external_network
volumes:
- uploads:/mastodon/public/system
streaming: streaming:
build: . build: .
image: ghcr.io/mastodon/mastodon image: ghcr.io/mastodon/mastodon
#image: tootsuite/mastodon:latest
env_file:
- env.production
command: node ./streaming
restart: always restart: always
depends_on: env_file: .env.production
- postgresql command: node ./streaming
# - pgbouncer networks:
- redis - external_network
- redis-volatile - internal_network
- elasticsearch healthcheck:
# prettier-ignore
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
ports: ports:
- '127.0.0.1:4000:4000' - '127.0.0.1:4000:4000'
networks: depends_on:
- internal_network - db
- external_network - redis
healthcheck:
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
sidekiq: sidekiq:
build: . build: .
image: ghcr.io/mastodon/mastodon image: ghcr.io/mastodon/mastodon
#image: tootsuite/mastodon:latest
env_file:
- env.production
command: bundle exec sidekiq
restart: always restart: always
env_file: .env.production
command: bundle exec sidekiq
depends_on: depends_on:
- postgresql - db
# - pgbouncer
- redis - redis
- redis-volatile
- website
networks: networks:
- internal_network
- external_network - external_network
- internal_network
volumes:
- ./public/system:/mastodon/public/system
healthcheck: healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"] test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
volumes:
- uploads:/mastodon/public/system
#- ./public/system:/mastodon/public/system
networks: networks:
external_network: external_network:
@ -167,24 +141,7 @@ networks:
internal_network: internal_network:
internal: true internal: true
volumes: # networks:
postgresql: # external_network:
driver_opts: # internal_network:
type: none # internal: true
device: {{ mastodon_composer_folder }}/database/postgresql
o: bind
redis:
driver_opts:
type: none
device: {{ mastodon_composer_folder }}/database/redis
o: bind
{% if es_enabled %} elasticsearch:
driver_opts:
type: none
device: {{ mastodon_composer_folder }}/database/elasticsearch
o: bind
{% endif %} uploads:
driver_opts:
type: none
device: {{ mastodon_composer_folder }}/web/system
o: bind