Merge lp:~mterry/snappy/systemd-restart into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Michael Terry
Status: Merged
Approved by: Michael Terry
Approved revision: 487
Merged at revision: 492
Proposed branch: lp:~mterry/snappy/systemd-restart
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 35 lines (+3/-0)
3 files modified
snappy/click_test.go (+1/-0)
systemd/systemd.go (+1/-0)
systemd/systemd_test.go (+1/-0)
To merge this branch: bzr merge lp:~mterry/snappy/systemd-restart
Reviewer Review Type Date Requested Status
Martin Pitt (community) Approve
Michael Vogt (community) Approve
Review via email: mp+261266@code.launchpad.net

Commit message

Set all app services to restart on failure.

Description of the change

Set all app services to restart on failure.

See http://www.freedesktop.org/software/systemd/man/systemd.service.html for how systemd treats Restart=on-failure.

There was talk on the snappy-app-devel mailing list about not using this key for dbus-activated services. But we don't support those right now.

(We do use the Type=dbus property, but that doesn't mean it's an dbus-activated service -- for that, we'd need to drop the [Install] section and add SystemdService= to the dbus service file. I believe... I'm not an expert with systemd.)

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks a bunch! This looks good.

review: Approve
Revision history for this message
Martin Pitt (pitti) wrote :

LGTM.

For D-Bus services, these indeed don't have an [Install], but Type=dbus and BusName=org.bla.foo instead. For those we indeed shouldn't have a Restart=, but having it is not the end of the world (mostly just an optimization problem).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snappy/click_test.go'
2--- snappy/click_test.go 2015-06-03 14:03:45 +0000
3+++ snappy/click_test.go 2015-06-05 18:36:45 +0000
4@@ -1162,6 +1162,7 @@
5
6 [Service]
7 ExecStart=/usr/bin/ubuntu-core-launcher xkcd-webserver%s xkcd-webserver%[2]s_xkcd-webserver_0.3.4 /apps/xkcd-webserver%[2]s/0.3.4/bin/foo start
8+Restart=on-failure
9 WorkingDirectory=/apps/xkcd-webserver%[2]s/0.3.4/
10 Environment="SNAP_APP=xkcd-webserver_xkcd-webserver_0.3.4" "TMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "TEMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "SNAP_APP_PATH=/apps/xkcd-webserver%[2]s/0.3.4/" "SNAP_APP_DATA_PATH=/var/lib/apps/xkcd-webserver%[2]s/0.3.4/" "SNAP_APP_TMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "SNAP_NAME=xkcd-webserver" "SNAP_VERSION=0.3.4" "SNAP_ORIGIN=%[3]s" "SNAP_FULLNAME=xkcd-webserver%[2]s" "SNAP_ARCH=%[5]s" "SNAP_APP_USER_DATA_PATH=%%h/apps/xkcd-webserver%[2]s/0.3.4/" "SNAPP_APP_PATH=/apps/xkcd-webserver%[2]s/0.3.4/" "SNAPP_APP_DATA_PATH=/var/lib/apps/xkcd-webserver%[2]s/0.3.4/" "SNAPP_APP_TMPDIR=/tmp/snaps/xkcd-webserver%[2]s/0.3.4/tmp" "SNAPPY_APP_ARCH=%[5]s" "SNAPP_APP_USER_DATA_PATH=%%h/apps/xkcd-webserver%[2]s/0.3.4/"
11 ExecStop=/usr/bin/ubuntu-core-launcher xkcd-webserver%[2]s xkcd-webserver%[2]s_xkcd-webserver_0.3.4 /apps/xkcd-webserver%[2]s/0.3.4/bin/foo stop
12
13=== modified file 'systemd/systemd.go'
14--- systemd/systemd.go 2015-06-03 14:01:51 +0000
15+++ systemd/systemd.go 2015-06-05 18:36:45 +0000
16@@ -181,6 +181,7 @@
17
18 [Service]
19 ExecStart=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathStart}}
20+Restart=on-failure
21 WorkingDirectory={{.AppPath}}
22 Environment="SNAP_APP={{.AppTriple}}" {{.EnvVars}}
23 {{if .Stop}}ExecStop=/usr/bin/ubuntu-core-launcher {{.UdevAppName}} {{.AaProfile}} {{.FullPathStop}}{{end}}
24
25=== modified file 'systemd/systemd_test.go'
26--- systemd/systemd_test.go 2015-06-03 14:03:45 +0000
27+++ systemd/systemd_test.go 2015-06-05 18:36:45 +0000
28@@ -155,6 +155,7 @@
29
30 [Service]
31 ExecStart=/usr/bin/ubuntu-core-launcher app%[2]s aa-profile /apps/app%[2]s/1.0/bin/start
32+Restart=on-failure
33 WorkingDirectory=/apps/app%[2]s/1.0/
34 Environment="SNAP_APP=app_service_1.0" "TMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "TEMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "SNAP_APP_PATH=/apps/app%[2]s/1.0/" "SNAP_APP_DATA_PATH=/var/lib/apps/app%[2]s/1.0/" "SNAP_APP_TMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "SNAP_NAME=app" "SNAP_VERSION=1.0" "SNAP_ORIGIN=%[3]s" "SNAP_FULLNAME=app%[2]s" "SNAP_ARCH=%[5]s" "SNAP_APP_USER_DATA_PATH=%%h/apps/app%[2]s/1.0/" "SNAPP_APP_PATH=/apps/app%[2]s/1.0/" "SNAPP_APP_DATA_PATH=/var/lib/apps/app%[2]s/1.0/" "SNAPP_APP_TMPDIR=/tmp/snaps/app%[2]s/1.0/tmp" "SNAPPY_APP_ARCH=%[5]s" "SNAPP_APP_USER_DATA_PATH=%%h/apps/app%[2]s/1.0/"
35 ExecStop=/usr/bin/ubuntu-core-launcher app%[2]s aa-profile /apps/app%[2]s/1.0/bin/stop

Subscribers

People subscribed via source and target branches