Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration for running smokeping in slave mode #170

Merged
merged 6 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ param_ports:
param_usage_include_env: true
param_env_vars:
- { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London"}
opt_param_usage_include_env: true
opt_param_env_vars:
- { env_var: "MASTER_URL", env_value: "http://{{master}}:8008/smokeping/", desc: "Specify the master url to connect to. Used when in slave mode."}
- { env_var: "SHARED_SECRET", env_value: "password", desc: "Specify the master shared secret for this host. Used when in slave mode."}
- { env_var: "CACHE_DIR", env_value: "/tmp", desc: "Specify the cache directory for this host. Used when in slave mode."}

# application setup block
app_setup_block_enabled: true
Expand Down
10 changes: 8 additions & 2 deletions root/etc/s6-overlay/s6-rc.d/svc-smokeping/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

exec \
s6-setuidgid abc /usr/sbin/smokeping --config="/etc/smokeping/config" --nodaemon
if [ -n "${MASTER_URL}" ] && [ -n "${SHARED_SECRET}" ] && [ -n "${CACHE_DIR}" ]; then
install -g abc -o abc -m 400 -D <(echo $SHARED_SECRET) /var/smokeping/secret.txt
exec \
s6-setuidgid abc /usr/sbin/smokeping --master-url="${MASTER_URL}" --cache-dir="${CACHE_DIR}" --shared-secret="/var/smokeping/secret.txt" --nodaemon
else
exec \
s6-setuidgid abc /usr/sbin/smokeping --config="/etc/smokeping/config" --nodaemon
fi