Some basic agent startup
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
|
||||
|
||||
name="Bootstrap the Cluster"
|
||||
description="Runs the ctl init bootstrap sequence"
|
||||
|
||||
command="/usr/local/bin/ctl"
|
||||
command_args="init --env-file /opt/monok8s/config/cluster.env"
|
||||
|
||||
LOG_DIR="/var/log/monok8s"
|
||||
LOG_FILE="$LOG_DIR/bootstrap-cluster.log"
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
}
|
||||
|
||||
start() {
|
||||
checkpath --directory "$LOG_DIR"
|
||||
ebegin "Starting the bootstrap sequence"
|
||||
start-stop-daemon --start \
|
||||
--exec "$command" \
|
||||
-- $command_args >>"$LOG_FILE" 2>&1
|
||||
eend $?
|
||||
}
|
||||
58
alpine/rootfs-extra/etc/init.d/control-agent
Executable file
58
alpine/rootfs-extra/etc/init.d/control-agent
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
|
||||
|
||||
name="monok8s-control-agent"
|
||||
description="System Control Agent (OSUpgrade controller)"
|
||||
|
||||
supervisor=supervise-daemon
|
||||
|
||||
command="/usr/local/bin/ctl"
|
||||
command_args="agent --env-file /opt/monok8s/config/cluster.env"
|
||||
|
||||
command_user="root:root"
|
||||
|
||||
pidfile="/run/${RC_SVCNAME}.pid"
|
||||
|
||||
output_log="/var/log/monok8s/agent.log"
|
||||
error_log="/var/log/monok8s/agent.log"
|
||||
|
||||
retry="TERM/10/KILL/5"
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
after net
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath --directory /run
|
||||
checkpath --directory /var/log/monok8s
|
||||
|
||||
if [ ! -f /opt/monok8s/config/cluster.env ]; then
|
||||
eerror "Missing env file: /opt/monok8s/config/cluster.env"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting monok8s control agent"
|
||||
supervise-daemon "$RC_SVCNAME" \
|
||||
--start \
|
||||
--pidfile "$pidfile" \
|
||||
--stdout "$output_log" \
|
||||
--stderr "$error_log" \
|
||||
--respawn \
|
||||
--respawn-delay 5 \
|
||||
--respawn-max 0 \
|
||||
-- \
|
||||
$command $command_args
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping monok8s control agent"
|
||||
supervise-daemon "$RC_SVCNAME" \
|
||||
--stop \
|
||||
--pidfile "$pidfile"
|
||||
eend $?
|
||||
}
|
||||
4
alpine/rootfs-extra/etc/local.d/monok8s.start
Executable file
4
alpine/rootfs-extra/etc/local.d/monok8s.start
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
|
||||
/usr/local/bin/ctl init --env-file /opt/monok8s/config/cluster.env >>/var/log/monok8s/bootstrap.log 2>&1 &
|
||||
Reference in New Issue
Block a user