Initial commit

This commit is contained in:
Waffles
2022-12-21 22:30:01 -08:00
commit 19ebda26b4
47 changed files with 1429 additions and 0 deletions
@@ -0,0 +1,20 @@
sidekiq-default:
image: tootsuite/mastodon:{{ MASTODON_VERSION }}
restart: always
env_file: .env.production
command: bundle exec sidekiq -q default -c 5
depends_on:
- pgbouncer
networks:
- external_network
- internal_network
volumes:
- ./public/system:/mastodon/public/system
- ./config:/opt/mastodon/config
environment:
{% if DB_POOL is defined %}
- 'DB_POOL={{ DB_POOL }}'
{% endif %}
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
@@ -0,0 +1,19 @@
# sidekiq-ingress
sidekiq-ingress:
image: tootsuite/mastodon:{{ MASTODON_VERSION }}
restart: always
env_file: .env.production
command: bundle exec sidekiq -q ingress
depends_on:
- pgbouncer
networks:
- external_network
- internal_network
volumes:
- ./public/system:/mastodon/public/system
- ./config:/opt/mastodon/config
environment:
- 'DB_POOL=25'
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
@@ -0,0 +1,20 @@
sidekiq-mailers:
image: tootsuite/mastodon:{{ MASTODON_VERSION }}
restart: always
env_file: .env.production
command: bundle exec sidekiq -q mailers -c 5
depends_on:
- pgbouncer
networks:
- external_network
- internal_network
volumes:
- ./public/system:/mastodon/public/system
- ./config:/opt/mastodon/config
environment:
- 'DB_POOL=25'
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
@@ -0,0 +1,19 @@
sidekiq-pushpull:
image: tootsuite/mastodon:{{ MASTODON_VERSION }}
restart: always
env_file: .env.production
command: bundle exec sidekiq -q push -q pull -c 5
depends_on:
- pgbouncer
networks:
- external_network
- internal_network
volumes:
- ./public/system:/mastodon/public/system
- ./config:/opt/mastodon/config
environment:
- 'DB_POOL=25'
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
@@ -0,0 +1,19 @@
sidekiq-scheduler:
image: tootsuite/mastodon:{{ MASTODON_VERSION }}
restart: always
env_file: .env.production
command: bundle exec sidekiq -q scheduler
depends_on:
- pgbouncer
networks:
- external_network
- internal_network
volumes:
- ./public/system:/mastodon/public/system
- ./config:/opt/mastodon/config
environment:
- 'DB_POOL=25'
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
@@ -0,0 +1,15 @@
sidekiq:
image: tootsuite/mastodon:{{ MASTODON_VERSION }}
restart: always
env_file: .env.production
command: bundle exec sidekiq
depends_on:
- pgbouncer
networks:
- external_network
- internal_network
volumes:
- ./public/system:/mastodon/public/system
- ./config:/opt/mastodon/config
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
@@ -0,0 +1,33 @@
version: '3'
services:
{% if ENV_PRODUCTION['STATSD_ADDR'] is defined %}
statsd:
restart: always
image: prom/statsd-exporter
command: --statsd.mapping-config=/tmp/statsd_mapping.yml
volumes:
- /root/statsd-mapping.yml:/tmp/statsd_mapping.yml
networks:
- internal_network
- external_network
ports:
- 9102:9102
- "127.0.0.1:9125:9125"
{% endif %}
pgbouncer:
restart: always
image: edoburu/pgbouncer
networks:
- internal_network
- external_network
environment:
- 'DB_HOST={{ REAL_DB_HOST }}'
- 'DB_NAME={{ ENV_PRODUCTION["DB_NAME"] }}'
- 'DB_USER={{ ENV_PRODUCTION["DB_USER"] }}'
- 'DB_PASSWORD={{ ENV_PRODUCTION["DB_PASS"] }}'
- 'SERVER_TLS_SSLMODE=prefer'
networks:
external_network:
internal_network:
internal: true
@@ -0,0 +1,3 @@
{% for key, val in ENV_PRODUCTION.items() %}
{{ key }}={{ val }}
{% endfor %}
@@ -0,0 +1,96 @@
## Prometheus Statsd Exporter mapping for Mastodon 4.0+
##
## Version 1.0, November 2022
##
## Documentation: https://ipng.ch/s/articles/2022/11/27/mastodon-3.html
mappings:
## Web collector
- match: Mastodon\.production\.web\.(.+)\.(.+)\.(.+)\.status\.(.+)
match_type: regex
name: "mastodon_controller_status"
labels:
controller: $1
action: $2
format: $3
status: $4
mastodon: "web"
- match: Mastodon\.production\.web\.(.+)\.(.+)\.(.+)\.db_time
match_type: regex
name: "mastodon_controller_db_time"
labels:
controller: $1
action: $2
format: $3
mastodon: "web"
- match: Mastodon\.production\.web\.(.+)\.(.+)\.(.+)\.view_time
match_type: regex
name: "mastodon_controller_view_time"
labels:
controller: $1
action: $2
format: $3
mastodon: "web"
- match: Mastodon\.production\.web\.(.+)\.(.+)\.(.+)\.total_duration
match_type: regex
name: "mastodon_controller_duration"
labels:
controller: $1
action: $2
format: $3
mastodon: "web"
## Database collector
- match: Mastodon\.production\.db\.tables\.(.+)\.queries\.(.+)\.duration
match_type: regex
name: "mastodon_db_operation"
labels:
table: "$1"
operation: "$2"
mastodon: "db"
## Cache collector
- match: Mastodon\.production\.cache\.(.+)\.duration
match_type: regex
name: "mastodon_cache_duration"
labels:
operation: "$1"
mastodon: "cache"
## Sidekiq collector
- match: Mastodon\.production\.sidekiq\.(.+)\.processing_time
match_type: regex
name: "mastodon_sidekiq_worker_processing_time"
labels:
worker: "$1"
mastodon: "sidekiq"
- match: Mastodon\.production\.sidekiq\.(.+)\.success
match_type: regex
name: "mastodon_sidekiq_worker_success_total"
labels:
worker: "$1"
mastodon: "sidekiq"
- match: Mastodon\.production\.sidekiq\.(.+)\.failure
match_type: regex
name: "mastodon_sidekiq_worker_failure_total"
labels:
worker: "$1"
mastodon: "sidekiq"
- match: Mastodon\.production\.sidekiq\.queues\.(.+)\.enqueued
match_type: regex
name: "mastodon_sidekiq_queue_enqueued"
labels:
queue: "$1"
mastodon: "sidekiq"
- match: Mastodon\.production\.sidekiq\.queues\.(.+)\.latency
match_type: regex
name: "mastodon_sidekiq_queue_latency"
labels:
queue: "$1"
mastodon: "sidekiq"
- match: Mastodon\.production\.sidekiq\.(.+)
match_type: regex
name: "mastodon_sidekiq_$1"
labels:
mastodon: "sidekiq"