{"action":"created","issue":{"url":"https://api.github.com/repos/coreos/bugs/issues/1056","labels_url":"https://api.github.com/repos/coreos/bugs/issues/1056/labels{/name}","comments_url":"https://api.github.com/repos/coreos/bugs/issues/1056/comments","events_url":"https://api.github.com/repos/coreos/bugs/issues/1056/events","html_url":"https://github.com/coreos/bugs/issues/1056","id":124201656,"number":1056,"title":"Systemd: ExecStartPost docker exec use","user":{"login":"vmatekole","id":424339,"avatar_url":"https://avatars.githubusercontent.com/u/424339?v=3","gravatar_id":"","url":"https://api.github.com/users/vmatekole","html_url":"https://github.com/vmatekole","followers_url":"https://api.github.com/users/vmatekole/followers","following_url":"https://api.github.com/users/vmatekole/following{/other_user}","gists_url":"https://api.github.com/users/vmatekole/gists{/gist_id}","starred_url":"https://api.github.com/users/vmatekole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmatekole/subscriptions","organizations_url":"https://api.github.com/users/vmatekole/orgs","repos_url":"https://api.github.com/users/vmatekole/repos","events_url":"https://api.github.com/users/vmatekole/events{/privacy}","received_events_url":"https://api.github.com/users/vmatekole/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/coreos/bugs/labels/area/usability","name":"area/usability","color":"bfe5bf"},{"url":"https://api.github.com/repos/coreos/bugs/labels/component/systemd","name":"component/systemd","color":"0052cc"},{"url":"https://api.github.com/repos/coreos/bugs/labels/kind/question","name":"kind/question","color":"c7def8"},{"url":"https://api.github.com/repos/coreos/bugs/labels/team/os","name":"team/os","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-29T12:03:47Z","updated_at":"2016-01-05T17:00:44Z","closed_at":null,"body":"Hi! \r\n\r\nThis is probably not the ideal place to post this but it is my last resort:\r\nI have been struggling for mths now with the following unit:\r\nThe ExecStartPost step isn't working - SideKiq refuses to start. I have to manually\r\nlaunch this command when I restart each app node. Hoping someone might be able to point me in the \r\nright direction.\r\n```\r\n[Unit]\r\nDescription=Spree-Vendservice\r\n\r\n# Requirements\r\nRequires=docker.service\r\n\r\n# Dependency ordering\r\nAfter=docker.service\r\nAfter=docker-registrator.service\r\nAfter=docker-postgres.service\r\nAfter=docker-redis.service\r\n\r\n[Service]\r\n# Let processes take awhile to start up (for first run Docker containers)\r\nUser=core\r\nTimeoutStartSec=60s\r\n\r\n# Change killmode from \"control-group\" to \"none\" to let Docker remove\r\n# work correctly.\r\nKillMode=none\r\n\r\n# Get CoreOS environmental variables\r\nEnvironmentFile=/etc/environment\r\n\r\n# Pre-start and Start\r\n## Directives with \"=-\" are allowed to fail without consequence\r\nExecStartPre=-/usr/bin/docker kill spree-vend\r\nExecStartPre=-/usr/bin/docker rm -v spree-vend\r\nExecStartPre=-/usr/bin/docker pull quay.io/XXXXX/spree-vend:production\r\nExecStart=/bin/bash -c  \"/usr/bin/docker run --name spree-vend \\\r\n                             -p $COREOS_PRIVATE_IPV4:8080:3000 \\\r\n                             -v /var/log/spree-vend:/apps/spree-vend/log \\                             \r\n                             -e SERVICE_NAME=spree-vend \\\r\n                             -e \\\"RAILS_ENV=production\\\" \\                             \r\n                             -e \\\"SECRET_SPREE_API=\\\" \\\r\n                             -e \\\"VEND_CLIENT_ID=\\\" \\\r\n                             -e \\\"SECRET_VEND_API=\\\" \\\r\n                             -e \\\"SECRET_VEND_ACCESS_TOKEN=\\\" \\\r\n                             -e \\\"SPREE_API_URL=\\\" \\\r\n                             -e \\\"SECRET_SPREE_API=\\\" \\\r\n                             quay.io/XXXX/spree-vend:production passenger start -b $COREOS_PRIVATE_IPV4\"\r\nExecStartPost=-/bin/bash -c \"/usr/bin/docker exec -it spree-vend sidekiq -C config/sidekiq.yml\"\r\n# Stop\r\nExecStop=/usr/bin/docker stop spree-vend\r\nRestart=always\r\nRestartSec=10\r\n\r\n[X-Fleet]\r\n# Don't schedule on the same machine as other nginx instances\r\nGlobal=true\r\nMachineMetadata=\"role=app\"\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/coreos/bugs/issues/comments/169061240","html_url":"https://github.com/coreos/bugs/issues/1056#issuecomment-169061240","issue_url":"https://api.github.com/repos/coreos/bugs/issues/1056","id":169061240,"user":{"login":"crawford","id":368848,"avatar_url":"https://avatars.githubusercontent.com/u/368848?v=3","gravatar_id":"","url":"https://api.github.com/users/crawford","html_url":"https://github.com/crawford","followers_url":"https://api.github.com/users/crawford/followers","following_url":"https://api.github.com/users/crawford/following{/other_user}","gists_url":"https://api.github.com/users/crawford/gists{/gist_id}","starred_url":"https://api.github.com/users/crawford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crawford/subscriptions","organizations_url":"https://api.github.com/users/crawford/orgs","repos_url":"https://api.github.com/users/crawford/repos","events_url":"https://api.github.com/users/crawford/events{/privacy}","received_events_url":"https://api.github.com/users/crawford/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T17:00:44Z","updated_at":"2016-01-05T17:00:44Z","body":"That's the better approach (I forgot that in my first list). DigitalOcean has a pretty good [overview](https://www.digitalocean.com/community/tutorials/how-to-create-flexible-services-for-a-coreos-cluster-with-fleet-unit-files) of the solution."}}