Skip to content

Commit 4edb4ac

Browse files
authored
Merge pull request #132 from linuxserver/main-prom
2 parents 3388589 + 494948c commit 4edb4ac

File tree

7 files changed

+21
-0
lines changed

7 files changed

+21
-0
lines changed

readme-vars.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ opt_param_env_vars:
6262
- {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)."}
6363
- {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)."}
6464
- {env_var: "NO_CHOWN", env_value: "", desc: "Set to `true` to skip chown of /config on init. *READ THE APPLICATION NOTES BEFORE SETTING THIS*."}
65+
- {env_var: "MASTODON_PROMETHEUS_EXPORTER_ENABLED", env_value: "", desc: "If set to `true`, Mastodon’s Ruby processes (web & Sidekiq) will enable the Prometheus instrumentation."}
6566
param_usage_include_ports: true
6667
param_ports:
6768
- {external_port: "80", internal_port: "80", port_desc: "Port for web frontend"}
6869
- {external_port: "443", internal_port: "443", port_desc: "Port for web frontend"}
70+
opt_param_usage_include_ports: true
71+
opt_param_ports:
72+
- {external_port: "9394", internal_port: "9394", port_desc: "Port for Prometheus metrics"}
6973
param_usage_include_vols: true
7074
param_volumes:
7175
- {vol_path: "/config", vol_host_path: "/path/to/{{ project_name }}/config", desc: "Contains all relevant configuration files."}
@@ -167,6 +171,7 @@ init_diagram: |
167171
"mastodon:latest" <- Base Images
168172
# changelog
169173
changelogs:
174+
- {date: "21.10.25:", desc: "Add prometheus exporter support."}
170175
- {date: "20.10.25:", desc: "Add vips-heif."}
171176
- {date: "08.07.25:", desc: "Rebase to Alpine 3.22."}
172177
- {date: "06.06.25:", desc: "Rebase to Alpine 3.21, replace deprecated imagemagick with vips."}

root/etc/s6-overlay/s6-rc.d/svc-prom/dependencies.d/init-services

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/with-contenv bash
2+
# shellcheck shell=bash
3+
4+
export RAILS_ENV=production
5+
export HOME=/config
6+
export PATH="${PATH}:/app/www/bin"
7+
8+
exec \
9+
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${PROMETHEUS_EXPORTER_PORT:-9394}" \
10+
cd /app/www s6-setuidgid abc /app/www/bin/prometheus_exporter
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
longrun

root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-prom

Whitespace-only changes.

root/init-hook

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
# Disable the php-fpm service as the container doesn't use it
44
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-php-fpm
55

6+
if [[ ${MASTODON_PROMETHEUS_EXPORTER_ENABLED,,} != "true" ]]; then
7+
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-prom
8+
fi
9+
610
if [[ ${SIDEKIQ_ONLY,,} == "true" ]]; then
711
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-mastodon
812
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-nginx

0 commit comments

Comments
 (0)