From d212a68b4f165abe85efa23eb681c56b6c25b954 Mon Sep 17 00:00:00 2001 From: Michiel de Jong <michiel@unhosted.org> Date: Sun, 9 Nov 2014 18:05:42 +0000 Subject: [PATCH] On ubuntu, run etcd as a systemd unit --- doc/running-on-ubuntu.md | 41 +++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/doc/running-on-ubuntu.md b/doc/running-on-ubuntu.md index 9581d3a..26c2cb8 100644 --- a/doc/running-on-ubuntu.md +++ b/doc/running-on-ubuntu.md @@ -1,18 +1,33 @@ To run an IndieHosters on ubuntu 14.10 (earlier versions will not work), run something like: - apt-get update && apt-get -y upgrade - dpkg-reconfigure -plow unattended-upgrades - # set unattended upgrades to 'Yes' - apt-get -y install systemd-sysv git docker.io - docker run -d --restart='always' -p 4001:4001 quay.io/coreos/etcd:v0.4.6 - echo "#!/bin/sh" > /usr/local/etcdctl - echo "docker run --net=host quay.io/coreos/etcd:v0.4.6 /etcdctl $1 $2 $3 $4" >> /usr/local/etcdctl - shutdown -r now +````bash +apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade +dpkg-reconfigure -plow unattended-upgrades +# set unattended upgrades to 'Yes' +apt-get -y install systemd-sysv git docker.io +printf "#!/bin/sh\ndocker run --net=host quay.io/coreos/etcd:v0.4.6 /etcdctl $1 $2 $3 $4" >> /usr/local/etcdctl +printf "[Unit]\nRequires=docker.service\nAfter=docker.service\n[Service]\nRestart=always\n\ +ExecStartPre=-/usr/bin/docker kill etcd\n\ +ExecStartPre=-/usr/bin/docker rm etcd\n\ +ExecStart=/usr/bin/docker run \ + --name etcd \ + -p 4001:4001 \ + quay.io/coreos/etcd:v0.4.6\n\ +ExecReload=/usr/bin/docker restart etcd\n\ +ExecStop=/usr/bin/docker stop etcd\n\ +[Install]\n\ +WantedBy=multi-user.target\n" > /etc/systemd/system/etcd.service +shutdown -r now +```` - systemctl start docker # This will be automatic once the IndieHosters unit-files are installed - systemctl list-units - docker ps - etcdctl ls - etcdctl help +```` +systemctl enable etcd +systemctl start etcd +systemctl list-units +docker ps +etcdctl ls +etcdctl help +```` Now follow the [CoreOS-based instructions](deploying-a-server.md) + -- GitLab