Add prometheus exporter support

This commit is contained in:
thespad 2025-10-21 11:53:33 +01:00
parent 2dc213e6ca
commit 0cd8a6878a
No known key found for this signature in database
7 changed files with 21 additions and 0 deletions

View File

@ -61,10 +61,14 @@ opt_param_env_vars:
- {env_var: "SIDEKIQ_THREADS", env_value: "5", desc: "The number of threads for sidekiq to use. See [notes](https://docs.joinmastodon.org/admin/scaling/#sidekiq-threads)."}
- {env_var: "DB_POOL", env_value: "5", desc: "The size of the DB connection pool, must be *at least* the same as `SIDEKIQ_THREADS`. See [notes](https://docs.joinmastodon.org/admin/scaling/#sidekiq-threads)."}
- {env_var: "NO_CHOWN", env_value: "", desc: "Set to `true` to skip chown of /config on init. *READ THE APPLICATION NOTES BEFORE SETTING THIS*."}
- {env_var: "MASTODON_PROMETHEUS_EXPORTER_ENABLED", env_value: "", desc: "If set to `true`, Mastodons Ruby processes (web & Sidekiq) will enable the Prometheus instrumentation."}
param_usage_include_ports: true
param_ports:
- {external_port: "80", internal_port: "80", port_desc: "Port for web frontend"}
- {external_port: "443", internal_port: "443", port_desc: "Port for web frontend"}
opt_param_usage_include_ports: true
opt_param_ports:
- {external_port: "9394", internal_port: "9394", port_desc: "Port for Prometheus metrics"}
param_usage_include_vols: true
param_volumes:
- {vol_path: "/config", vol_host_path: "/path/to/mastodon/appdata/config", desc: "Contains all relevant configuration files."}
@ -168,6 +172,7 @@ init_diagram: |
"mastodon:glitch" <- Base Images
# changelog
changelogs:
- {date: "21.10.25:", desc: "Add prometheus exporter support."}
- {date: "20.10.25:", desc: "Add vips-heif."}
- {date: "09.07.25:", desc: "Rebase to Alpine 3.22."}
- {date: "06.06.25:", desc: "Replace deprecated imagemagick with vips."}

View File

@ -0,0 +1 @@
5

View File

@ -0,0 +1,10 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
export RAILS_ENV=production
export HOME=/config
export PATH="${PATH}:/app/www/bin"
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${PROMETHEUS_EXPORTER_PORT:-9394}" \
cd /app/www s6-setuidgid abc /app/www/bin/prometheus_exporter

View File

@ -0,0 +1 @@
longrun

View File

@ -3,6 +3,10 @@
# Disable the php-fpm service as the container doesn't use it
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-php-fpm
if [[ ${MASTODON_PROMETHEUS_EXPORTER_ENABLED,,} != "true" ]]; then
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-prom
fi
if [[ ${SIDEKIQ_ONLY,,} == "true" ]]; then
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-mastodon
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-nginx