nf-demo-app.service 842 Bytes
Newer Older
Andres Toomsalu's avatar
Andres Toomsalu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[Unit]
Description=NodeFabric Demo App Service
Requires=docker.service
Wants=nf-consul.service
Wants=nf-haproxy.service
After=nf-haproxy.service

[Service]
EnvironmentFile=/etc/nodefabric/conf.d/nf-demo-app.conf
TimeoutStartSec=0
ExecStartPre=/usr/bin/mkdir -p $DEMOAPP_DATADIR
ExecStartPre=-/usr/bin/docker kill $DEMOAPP_INSTANCE
ExecStartPre=-/usr/bin/docker rm $DEMOAPP_INSTANCE
ExecStart=/usr/bin/bash -c "source /etc/nodefabric/nodefabric.conf && \
docker run --name=$DEMOAPP_INSTANCE -h $HOSTNAME \
             -p $DEMOAPP_BIND_ADDR:8010:80 \
	     -e SERVICE_80_CHECK_CMD=/usr/bin/nf-demo-app-check \
             -e DEMOAPP_HELLOWORLD=\"$DEMOAPP_HELLOWORLD\" \
             -v $DEMOAPP_DATADIR:/var/lib/nf-demo-app \
             $DEMOAPP_IMAGE"
ExecStop=-/usr/bin/docker stop $DEMOAPP_INSTANCE

[Install]
WantedBy=multi-user.target