Hi,
I got my service running (a simple Go rest service) running inside a container running on CoreOS, I'd like the app/service to restart inside the container if there is some kind of program failure, so I use the Restart=always line in the unit file, but the service stays in Failure status.
Some details:
$ fleetctl cat app@8080
[Unit]
Description=Go Application that talks to etcd
After=etcd.service
After=docker.service
Requires=app-discovery@%i.service
[Service]
TimeoutStartSec=0
KillMode=none
Restart=always
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker kill app%i
ExecStartPre=-/usr/bin/docker rm app%i
ExecStartPre=/usr/bin/docker pull fmpwizard/coreosdemo
ExecStart=/usr/bin/docker run --name app%i -p ${COREOS_PUBLIC_IPV4}:%i:8080 fmpwizard/coreosdemo
ExecStop=/usr/bin/docker stop app%i
[X-Fleet]
X-Conflicts=app@*.service
==============================
Current failure status:
$ fleetctl status app@8080
● a...@8080.service - Go Application that talks to etcd
Loaded: loaded (/run/fleet/units/a...@8080.service; linked-runtime)
Active: failed (Result: exit-code) since Tue 2014-09-30 14:33:19 UTC; 14min ago
Process: 7154 ExecStop=/usr/bin/docker stop app%i (code=exited, status=0/SUCCESS)
Process: 776 ExecStart=/usr/bin/docker run --name app%i -p ${COREOS_PUBLIC_IPV4}:%i:8080 fmpwizard/coreosdemo (code=exited, status=1/FAILURE)
Process: 764 ExecStartPre=/usr/bin/docker pull fmpwizard/coreosdemo (code=exited, status=0/SUCCESS)
Process: 753 ExecStartPre=/usr/bin/docker rm app%i (code=exited, status=1/FAILURE)
Process: 686 ExecStartPre=/usr/bin/docker kill app%i (code=exited, status=1/FAILURE)
Main PID: 776 (code=exited, status=1/FAILURE)
Sep 30 14:03:57 two docker[776]: 2014/09/30 14:03:57 here ut comes value=3969970466925200696
Sep 30 14:03:57 two docker[776]: 2014/09/30 14:03:57 here ut comes value=3349133614510369083
Sep 30 14:03:57 two docker[776]: 2014/09/30 14:03:57 here ut comes value=8554272536372678354
Sep 30 14:03:57 two docker[776]: 2014/09/30 14:03:57 here ut comes value=5689556326700383242
Sep 30 14:33:19 two docker[776]: 2014/09/30 14:33:19 Good bye!
Sep 30 14:33:19 two systemd[1]: a...@8080.service: main process exited, code=exited, status=1/FAILURE
Sep 30 14:33:19 two systemd[1]: Stopping Go Application that talks to etcd...
Sep 30 14:33:19 two docker[7154]: app8080
Sep 30 14:33:19 two systemd[1]: Stopped Go Application that talks to etcd.
Sep 30 14:33:19 two systemd[1]: Unit a...@8080.service entered failed state.
=============================
fleetctl list-units
UNIT MACHINE ACTIVE SUB
app-di...@8080.service 6332e5a9.../<ip here> inactive dead
a...@8080.service 6332e5a9.../<ip here> failed failed
============================
I force the app to crash by calling (in Go code)
log.Fatal("Good bye!")
I can't tell what I'm doing wrong here.
Thanks and let me know if I should be providing more information.
Diego