Skip to content

Instantly share code, notes, and snippets.

@philipz
Last active August 29, 2015 14:05
Show Gist options
  • Save philipz/28fef07d4e74f68a1e24 to your computer and use it in GitHub Desktop.
Save philipz/28fef07d4e74f68a1e24 to your computer and use it in GitHub Desktop.
CoreOS Systemd unit example

From CoreOS Getting Started with systemd

[Unit]
Description=My Advanced Service
After=etcd.service
After=docker.service
 
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill apache1
ExecStartPre=-/usr/bin/docker rm apache1
ExecStartPre=/usr/bin/docker pull coreos/apache
ExecStart=/usr/bin/docker run --name apache1 -p 80:80 coreos/apache /usr/sbin/apache2ctl -D FOREGROUND
ExecStartPost=/usr/bin/etcdctl set /domains/example.com/10.10.10.123:8081 running
ExecStop=/usr/bin/docker stop apache1
ExecStopPost=/usr/bin/etcdctl rm /domains/example.com/10.10.10.123:8081
 
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment