consul/terraform/aws/scripts/upstart.conf

29 lines
681 B
Plaintext
Raw Normal View History

2014-10-12 00:09:51 +00:00
description "Consul agent"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
# This is to avoid Upstart re-spawning the process upon `consul leave`
normal exit 0 INT
2015-05-07 11:49:23 +00:00
# stop consul will not mark node as failed but left
kill signal INT
2014-10-12 00:09:51 +00:00
script
if [ -f "/etc/service/consul" ]; then
. /etc/service/consul
fi
# Make sure to use all our CPUs, because Consul can block a scheduler thread
export GOMAXPROCS=`nproc`
# Get the public IP
BIND=`ifconfig eth0 | grep "inet addr" | awk '{ print substr($2,6) }'`
exec /usr/local/bin/consul agent \
-config-dir="/etc/consul.d" \
-bind=$BIND \
${CONSUL_FLAGS} \
>>/var/log/consul.log 2>&1
end script