From 89317ee561297b3626fa86db4951187bf8bccea1 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 6 Jan 2014 01:00:06 +0100 Subject: go: add systemd foo --- go/Makefile | 10 ++++++++++ go/README.markdown | 17 +++++++++++++++++ go/etc/conf.d/go.env | 2 ++ go/etc/systemd/system/go.service | 14 ++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 go/Makefile create mode 100644 go/etc/conf.d/go.env create mode 100644 go/etc/systemd/system/go.service diff --git a/go/Makefile b/go/Makefile new file mode 100644 index 00000000..6c827f2b --- /dev/null +++ b/go/Makefile @@ -0,0 +1,10 @@ +help:;@grep -v ^help: Makefile + +install: \ + /etc/systemd/system/go.service \ + /etc/conf.d/go.env + systemctl daemon-reload + +/etc/%: etc/% + @! test -e $@ || { echo file already exists: $@; exit 23; } + cp $< $@ diff --git a/go/README.markdown b/go/README.markdown index 11a31975..4e2cb2cf 100644 --- a/go/README.markdown +++ b/go/README.markdown @@ -32,3 +32,20 @@ redis-cli keys 'go:*' | xargs redis-cli del if you have changed `redisPrefix`, then use that instead of `go:`. + +## use systemd + + run + + make install + + to install the systemd service and configuration files. + this will fail if the files are already installed and modified. + + maybe you want to customize the configuration with + + $EDITOR /etc/conf.d/go.env + + and finally start the service + + systemctl start go diff --git a/go/etc/conf.d/go.env b/go/etc/conf.d/go.env new file mode 100644 index 00000000..365bd0c7 --- /dev/null +++ b/go/etc/conf.d/go.env @@ -0,0 +1,2 @@ +HOSTN=go +PORT=80 diff --git a/go/etc/systemd/system/go.service b/go/etc/systemd/system/go.service new file mode 100644 index 00000000..c129296c --- /dev/null +++ b/go/etc/systemd/system/go.service @@ -0,0 +1,14 @@ +[Unit] +Description=go uri shortener +After=redis.service + +[Service] +EnvironmentFile=/etc/conf.d/go.env +ExecStart=/usr/bin/node /krebs/go +KillMode=process +User=go +Group=go +Restart=always + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3