Open IvanovOleg opened 2 years ago
I believe the reason of the issue is in the entrypoint.sh file:
elif [ $called = "sensu-backend" ]; then
: ${SENSU_BACKEND_CLUSTER_ADMIN_USERNAME:=admin}
: ${SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD:=P@ssw0rd!}
: ${SENSU_BACKEND_API_URL:=http://${SENSU_HOSTNAME}:8080}
: ${SENSU_BACKEND_ETCD_INITIAL_CLUSTER:=default=http://${SENSU_HOSTNAME}:2380}
: ${SENSU_BACKEND_ETCD_ADVERTISE_CLIENT_URLS:=http://${SENSU_HOSTNAME}:2379}
: ${SENSU_BACKEND_ETCD_INITIAL_ADVERTISE_PEER_URLS:=http://${SENSU_HOSTNAME}:2380}
: ${SENSU_BACKEND_ETCD_LISTEN_CLIENT_URLS:=http://[::]:2379}
: ${SENSU_BACKEND_ETCD_LISTEN_PEER_URLS:=http://[::]:2380}
: ${WAIT_PORT:=2379}
export SENSU_BACKEND_CLUSTER_ADMIN_USERNAME
export SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD
export SENSU_BACKEND_API_URL
export SENSU_BACKEND_ETCD_INITIAL_CLUSTER
export SENSU_BACKEND_ETCD_ADVERTISE_CLIENT_URLS
export SENSU_BACKEND_ETCD_INITIAL_ADVERTISE_PEER_URLS
export SENSU_BACKEND_ETCD_LISTEN_CLIENT_URLS
export SENSU_BACKEND_ETCD_LISTEN_PEER_URLS
backend_init &
fi
most likely env vars take precedence
Fixed by mounting modified entrypoint.sh
#!/usr/bin/dumb-init sh
SENSU=/opt/sensu
called=$(basename $0)
called_path=${SENSU}/bin/${called}
: ${HOSTNAME:=$(hostname)}
: ${SENSU_HOSTNAME:=$HOSTNAME}
backend_init() {
echo "== running backend init..."
set -e
${called_path} init --wait
INIT_RC=$?
set +e
if [ "x$INIT_RC" != "x0" ] && [ "x$INIT_RC" != "x3" ]; then
echo "== backend init failed - exiting..."
exit 1
fi
}
if [ $called = "sensu-agent" ]; then
: ${SENSU_BACKEND_URL:=ws://${SENSU_HOSTNAME}:8081}
export SENSU_BACKEND_URL
elif [ $called = "sensu-backend" ] && [ -f /etc/sensu/backend.yml ]; then
: ${SENSU_BACKEND_CLUSTER_ADMIN_USERNAME:=admin}
: ${SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD:=P@ssw0rd!}
: ${SENSU_BACKEND_API_URL:=http://${SENSU_HOSTNAME}:8080}
: ${WAIT_PORT:=2379}
export SENSU_BACKEND_CLUSTER_ADMIN_USERNAME
export SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD
export SENSU_BACKEND_API_URL
backend_init &
elif [ $called = "sensu-backend" ]; then
: ${SENSU_BACKEND_CLUSTER_ADMIN_USERNAME:=admin}
: ${SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD:=P@ssw0rd!}
: ${SENSU_BACKEND_API_URL:=http://${SENSU_HOSTNAME}:8080}
: ${SENSU_BACKEND_ETCD_INITIAL_CLUSTER:=default=http://${SENSU_HOSTNAME}:2380}
: ${SENSU_BACKEND_ETCD_ADVERTISE_CLIENT_URLS:=http://${SENSU_HOSTNAME}:2379}
: ${SENSU_BACKEND_ETCD_INITIAL_ADVERTISE_PEER_URLS:=http://${SENSU_HOSTNAME}:2380}
: ${SENSU_BACKEND_ETCD_LISTEN_CLIENT_URLS:=http://[::]:2379}
: ${SENSU_BACKEND_ETCD_LISTEN_PEER_URLS:=http://[::]:2380}
: ${WAIT_PORT:=2379}
export SENSU_BACKEND_CLUSTER_ADMIN_USERNAME
export SENSU_BACKEND_CLUSTER_ADMIN_PASSWORD
export SENSU_BACKEND_API_URL
export SENSU_BACKEND_ETCD_INITIAL_CLUSTER
export SENSU_BACKEND_ETCD_ADVERTISE_CLIENT_URLS
export SENSU_BACKEND_ETCD_INITIAL_ADVERTISE_PEER_URLS
export SENSU_BACKEND_ETCD_LISTEN_CLIENT_URLS
export SENSU_BACKEND_ETCD_LISTEN_PEER_URLS
backend_init &
fi
${called_path} $@
Expected Behavior
Sensu starts in the cluster mode
Current Behavior
Possible Solution
Steps to Reproduce (for bugs)
sensu-backend start --config-file /etc/sensu/config.yml
Context
It doesn't ignore that file completely. I tried to change debug, log level, etcd-name and it reacts. But when it comes to the cluster configuration, it ignores it. I also tried to use backend.yml as a config file, didn't help. Sensu reacts if I add that cluster configuration using runtime parameter, but this way is unacceptable for me since I need that configuration to be dynamic. Changing IPs to the hostname in that config doesn't help either.
Your Environment