From b1df5e67f5ecf4738a74932b0c4afa8d7b42a4d7 Mon Sep 17 00:00:00 2001 From: Andreas Koch Date: Sun, 18 Dec 2016 22:05:19 +0100 Subject: [PATCH] Use WorkingDirectory for the systemd services Otherwise docker-compose cannot locate environment files referenced with "env_file". see: https://www.freedesktop.org/software/systemd/man/systemd.exec.html https://docs.docker.com/compose/compose-file/#/envfile --- CHANGELOG.md | 5 +++++ installer.go | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bd5d5e..39221f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Changed +- Set the working directory (see: https://www.freedesktop.org/software/systemd/man/systemd.exec.html) for the docker-compose systemd services. Otherwise docker-compose cannot locate `env_file`s (see: https://docs.docker.com/compose/compose-file/#/envfile) + ## [v0.1.0-alpha] - 2016-12-18 The prototype diff --git a/installer.go b/installer.go index 302b900..935cb29 100644 --- a/installer.go +++ b/installer.go @@ -77,8 +77,9 @@ Description={{ .ProjectName }} Service After=network.target [Service] -ExecStart=/usr/bin/env docker-compose -p "{{ .ProjectName }}" -f "{{ .ProjectDirectory }}/{{ .DockerComposeFile }}" up -ExecStop=/usr/bin/env docker-compose -p "{{ .ProjectName }}" -f "{{ .ProjectDirectory }}/{{ .DockerComposeFile }}" down +WorkingDirectory={{ .ProjectDirectory }} +ExecStart=/usr/bin/env docker-compose -p "{{ .ProjectName }}" -f "{{ .DockerComposeFile }}" up +ExecStop=/usr/bin/env docker-compose -p "{{ .ProjectName }}" -f "{{ .DockerComposeFile }}" down [Install] WantedBy=network-online.target