Skip to content

Instantly share code, notes, and snippets.

@leandrocp
Last active August 29, 2015 14:22
Show Gist options
  • Save leandrocp/6713a79382f3898cf512 to your computer and use it in GitHub Desktop.
Save leandrocp/6713a79382f3898cf512 to your computer and use it in GitHub Desktop.
[Unit]
Description=nginx
[Service]
ExecStartPre=docker pull nginx
ExecStart=docker run --name nginx --rm -p %1:80 nginx
ExecStartPost=etcdctl set /services/nginx ${COREOS_PUBLIC_IPV4}:%i
ExecStop=/usr/bin/docker kill nginx
ExecStopPost=/usr/bin/etcdctl rm /services/nginx
# %i => substituido pelo valor após o @, no caso valor 80
# ${COREOS_PUBLIC_IPV4} => IP público do servidor
# Registrar o service no cluster => fleetctl submit nginx.service
# Iniciar o service em um host do cluster => fleetctl start nginx.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment