From 178833d478fba73fc28396cf3fac0d1d50716e7b Mon Sep 17 00:00:00 2001 From: Erik Stambaugh Date: Thu, 1 Feb 2024 16:51:57 -0800 Subject: [PATCH] Use merge references in compose --- .../templates/docker-compose.mastodon.yaml | 56 +++++++------------ 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/ansible/roles/mastodon/templates/docker-compose.mastodon.yaml b/ansible/roles/mastodon/templates/docker-compose.mastodon.yaml index 4729b61..0542c15 100644 --- a/ansible/roles/mastodon/templates/docker-compose.mastodon.yaml +++ b/ansible/roles/mastodon/templates/docker-compose.mastodon.yaml @@ -59,69 +59,51 @@ services: # - '127.0.0.1:9200:9200' mastodon_web: + <<: &mastodon + build: src + image: local_mastodon + restart: always + env_file: .env.production + networks: + - mastodon + - nginx + depends_on: + - mastodon_db + - mastodon_redis + # - es container_name: mastodon_web - build: src - image: ghcr.io/mastodon/mastodon:v4.2.1 - restart: always - env_file: .env.production - command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000" - networks: - - mastodon - - nginx healthcheck: # prettier-ignore test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1'] ports: - '127.0.0.1:3000:3000' - depends_on: - - mastodon_db - - mastodon_redis - # - es volumes: - ./src/public/system:/mastodon/public/system + command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000" mastodon_streaming: + <<: *mastodon container_name: mastodon_streaming - build: src - image: ghcr.io/mastodon/mastodon:v4.2.1 - restart: always - env_file: .env.production environment: - PORT=5000 command: node ./streaming - networks: - - mastodon - - nginx healthcheck: # prettier-ignore test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1'] ports: - '127.0.0.1:5000:5000' - depends_on: - - mastodon_db - - mastodon_redis {% for i in range(mastodon_sidekiq_count) %} - mastodon_sidekiq_{{i}}: - container_name: mastodon_sidekiq_{{i}} - build: src - image: ghcr.io/mastodon/mastodon:v4.2.1 - restart: always - env_file: .env.production + mastodon_sidekiq_{{ i }}: + <<: *mastodon + container_name: mastodon_sidekiq_{{ i }} environment: - - DB_POOL={{ mastodon_sidekiq_threads}} - command: bundle exec sidekiq -c {{ mastodon_sidekiq_threads}} - depends_on: - - mastodon_db - - mastodon_redis - networks: - - mastodon - - nginx + - DB_POOL={{ mastodon_sidekiq_threads }} + command: bundle exec sidekiq -c {{ mastodon_sidekiq_threads }} volumes: - ./src/public/system:/mastodon/public/system healthcheck: test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"] - {% endfor %} ## Uncomment to enable federation with tor instances along with adding the following ENV variables