Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save charlesmarshall/4efaa9f560ec0bb12c34 to your computer and use it in GitHub Desktop.

Select an option

Save charlesmarshall/4efaa9f560ec0bb12c34 to your computer and use it in GitHub Desktop.
heartbeat service with added domain registration
[Unit]
Description=heartbeat for website
BindTo=website.service
[X-Fleet]
X-ConditionMachineOf=website.service
[Service]
EnvironmentFile=$pathToBashUtilitiesFile
Environment="envFile=$pathToBashUtilitiesFile"
Environment="containerName=website$counter"
Environment="sleepTime=20"
Environment="timeout=40"
Environment="serviceLocation=$(getServiceIPAndPort ${containerName} 800)"
ExecStart=/usr/bin/bash -l -c "source ${env_file} ; while true ; do sleep ${sleepTime} ; docker pull $registry_ip:5000/$image_name ; etcdctl set /services/website:$counter ${serviceLocation} --ttl ${timeout} ; etcdctl set /services/example.com ${serviceLocation} ; done ;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment