Last active
December 1, 2024 13:40
-
-
Save supersonictw/7eea65ea5d9be1509c82f7ce5dc26433 to your computer and use it in GitHub Desktop.
Consul OpenRC from Alpine Linux 3.17 wget -O - https://ncurl.xyz/s/9ksu-kVNR | sh -
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Consul OpenRC from Alpine Linux 3.17 | |
# SPDX-License-Identifier: MPL-2.0 | |
# https://pkgs.alpinelinux.org/package/v3.17/community/x86/consul-openrc | |
# /etc/conf.d/consul | |
# Consul startup | |
consul_opts="agent -config-dir=/etc/consul.d" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/sbin/openrc-run | |
# Consul OpenRC from Alpine Linux 3.17 | |
# SPDX-License-Identifier: MPL-2.0 | |
# https://pkgs.alpinelinux.org/package/v3.17/community/x86/consul-openrc | |
# /etc/init.d/consul | |
description="A tool for service discovery, monitoring and configuration" | |
description_checkconfig="Verify configuration files" | |
description_healthcheck="Check health status" | |
description_reload="Reload configuration" | |
extra_commands="checkconfig" | |
extra_started_commands="healthcheck reload" | |
command="/usr/sbin/$RC_SVCNAME" | |
command_args="$consul_opts" | |
command_user="$RC_SVCNAME:$RC_SVCNAME" | |
supervisor=supervise-daemon | |
pidfile="/run/$RC_SVCNAME.pid" | |
output_log="/var/log/$RC_SVCNAME.log" | |
error_log="/var/log/$RC_SVCNAME.log" | |
umask=027 | |
respawn_max=0 | |
respawn_delay=10 | |
healthcheck_timer=60 | |
depend() { | |
need net | |
after firewall | |
} | |
checkconfig() { | |
ebegin "Checking /etc/consul.d" | |
$command validate /etc/consul.d | |
eend $? | |
} | |
start_pre() { | |
checkconfig | |
checkpath -f -m 0640 -o "$command_user" "$output_log" "$error_log" | |
} | |
healthcheck() { | |
$command config list -kind proxy-defaults | |
} | |
reload() { | |
start_pre \ | |
&& ebegin "Reloading $RC_SVCNAME configuration" \ | |
&& supervise-daemon "$RC_SVCNAME" --signal HUP --pidfile "$pidfile" | |
eend $? | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# install-consul-openrc.sh | |
# SPDX-License-Identifier: MIT (https://ncurl.xyz/s/o_o6DVqIR) | |
wget -O "/etc/conf.d/consul" "https://ncurl.xyz/s/0LwUak4Ng" | |
wget -O "/etc/init.d/consul" "https://ncurl.xyz/s/lTdEazVHg" | |
chown root:root "/etc/conf.d/consul" "/etc/init.d/consul" | |
chmod +x "/etc/init.d/consul" | |
addgroup -S consul | |
adduser -S -H -s "/bin/ash" -h "/opt/consul" -g consul -G consul consul | |
mkdir "/opt/consul" "/etc/consul.d" | |
chown consul:consul "/opt/consul" | |
chown consul:consul "/etc/consul.d" | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uninstaller here