Traefik configuration

This commit is contained in:
Vivianne 2023-01-17 00:08:40 -05:00
parent 87e490b5fa
commit 476195932b

View file

@ -3,8 +3,8 @@ services:
db: db:
restart: always restart: always
image: postgres:14-alpine image: postgres:14-alpine
shm_size: 2gb shm_size: 1gb
command: postgres -c "max_connections=200" -c "shared_buffers=2GB" -c "effective_cache_size=6GB" -c "maintenance_work_mem=512MB" -c "checkpoint_completion_target=0.9" -c "wal_buffers=16MB" -c "default_statistics_target=100" -c "random_page_cost=1.1" -c "effective_io_concurrency=200" -c "work_mem=5242kB" -c "min_wal_size=1GB" -c "max_wal_size=4GB" -c "max_worker_processes=4" -c "max_parallel_workers_per_gather=2" -c "max_parallel_workers=4" -c "max_parallel_maintenance_workers=2" command: postgres -c "max_connections=200" -c "shared_buffers=768MB" -c "effective_cache_size=2304MB" -c "maintenance_work_mem=192MB" -c "checkpoint_completion_target=0.9" -c "wal_buffers=16MB" -c "default_statistics_target=100" -c "random_page_cost=1.1" -c "effective_io_concurrency=200" -c "work_mem=1966kB" -c "min_wal_size=1GB" -c "max_wal_size=4GB"
networks: networks:
- internal_network - internal_network
healthcheck: healthcheck:
@ -51,13 +51,24 @@ services:
image: git.solarpunk.moe/solarpunk/mastodon image: git.solarpunk.moe/solarpunk/mastodon
restart: always restart: always
env_file: .env.production env_file: .env.production
environment:
- WEB_CONCURRENCY=4
- MAX_THREADS=4
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:
internal_network: internal_network:
httpsproxy:
external_network: external_network:
aliases: aliases:
- masto_web - masto_web
mail: mail:
labels:
- "traefik.enable=true"
- "traefik.http.services.mastodon.loadbalancer.server.port=3000"
- "traefik.http.routers.mastodon.rule=Host(`solarpunk.moe`)"
- "traefik.http.routers.mastodon.tls.certresolver=leresolver"
- "traefik.http.routers.mastodon.entrypoints=websecure"
healthcheck: healthcheck:
# prettier-ignore # 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']
@ -75,11 +86,19 @@ services:
env_file: .env.production env_file: .env.production
command: node ./streaming command: node ./streaming
networks: networks:
httpsproxy:
internal_network: internal_network:
external_network: external_network:
aliases: aliases:
- masto_streaming - masto_streaming
mail: mail:
labels:
- "traefik.enable=true"
- "traefik.http.services.mastodon-streaming.loadbalancer.server.port=4000"
- "traefik.http.routers.mastodon-streaming.rule=(Host(`solarpunk.moe`) && PathPrefix(`/api/v1/streaming`))"
- "traefik.http.routers.mastodon-streaming.tls.certresolver=leresolver"
- "traefik.http.routers.mastodon-streaming.entrypoints=websecure"
healthcheck: healthcheck:
# prettier-ignore # prettier-ignore
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1'] test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
@ -104,8 +123,6 @@ services:
- mail - mail
volumes: volumes:
- ./public/system:/mastodon/public/system - ./public/system:/mastodon/public/system
# healthcheck:
# test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
sidekiq-ingress-pull-push-default: sidekiq-ingress-pull-push-default:
build: . build: .
@ -124,8 +141,6 @@ services:
- mail - mail
volumes: volumes:
- ./public/system:/mastodon/public/system - ./public/system:/mastodon/public/system
# healthcheck:
# test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
sidekiq-default-push-pull: sidekiq-default-push-pull:
build: . build: .
@ -144,15 +159,13 @@ services:
- mail - mail
volumes: volumes:
- ./public/system:/mastodon/public/system - ./public/system:/mastodon/public/system
#healthcheck:
# test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
sidekiq-pull-push-default: sidekiq-pull-push-default:
build: . build: .
image: git.solarpunk.moe/solarpunk/mastodon:latest image: git.solarpunk.moe/solarpunk/mastodon:latest
restart: always restart: always
env_file: .env.production env_file: .env.production
command: bundle exec sidekiq -c 5 -q pull -q push -q default -q ingress command: bundle exec sidekiq -c 8 -q pull -q push -q default -q ingress
environment: environment:
- DB_POOL=5 - DB_POOL=5
depends_on: depends_on:
@ -164,39 +177,6 @@ services:
- mail - mail
volumes: volumes:
- ./public/system:/mastodon/public/system - ./public/system:/mastodon/public/system
#healthcheck:
# test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
## Uncomment to enable federation with tor instances along with adding the following ENV variables
## http_proxy=http://privoxy:8118
## ALLOW_ACCESS_TO_HIDDEN_SERVICE=true
# tor:
# image: sirboops/tor
# networks:
# - external_network
# - internal_network
#
# privoxy:
# image: sirboops/privoxy
# volumes:
# - ./priv-config:/opt/config
# networks:
# - external_network
# - internal_network
nginx:
image: nginx
restart: always
networks:
- httpsproxy
- external_network
volumes:
- ./templates:/etc/nginx/templates
environment:
- LETSENCRYPT_HOST=solarpunk.moe
- VIRTUAL_HOST=solarpunk.moe
- NGINX_HOST=solarpunk.moe
- NGINX_PORT=80
volumes: volumes:
elasticsearch: elasticsearch: