Skip to content

Instantly share code, notes, and snippets.

@hickey
Created May 1, 2017 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hickey/c4e17182bbb005d6d0a0f4b94f1878d9 to your computer and use it in GitHub Desktop.
Save hickey/c4e17182bbb005d6d0a0f4b94f1878d9 to your computer and use it in GitHub Desktop.
#!/bin/sh
# extra args to put on the command line
extra_args="--debug "
if [ -n '{{ bind.has_backend }}' ]; then
init_adv_peer_urls=''
adv_client_urls=''
# build a list of all etcd servers for advertising
{{~#eachAlive bind.backend.members}}
init_adv_peer_urls="${init_adv_peer_urls},http://{{ip}}:2380"
adv_client_urls="${adv_client_urls},http://{{ip}}:2379"
{{~/eachAlive}}
# remove the comma at the beginning of the list
init_adv_peer_urls=${init_adv_peer_urls#,}
adv_client_urls=${adv_client_urls#,}
extra_args="--initial-advertise-peer-urls '${init_adv_peer_urls}' --advertise-client-urls '${adv_client_urls}' ${extra_args}"
else
extra_args="--initial-advertise-peer-urls 'http://{{sys.ip}}:2380' --advertise-client-urls 'http://{{sys.ip}}:2379' ${extra_args}"
fi
echo "{{pkg.path}}/bin/etcd --config-file {{pkg.svc_config_path}}/etcd.conf.yml ${extra_args}"
{{pkg.path}}/bin/etcd --config-file {{pkg.svc_config_path}}/etcd.conf.yml ${extra_args}
echo "etcd exited with status $?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment