Skip to content

Commit b1df5e6

Browse files
committed
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
1 parent f0db1b8 commit b1df5e6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [Unreleased]
8+
9+
### Changed
10+
- 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)
11+
712
## [v0.1.0-alpha] - 2016-12-18
813

914
The prototype

installer.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ Description={{ .ProjectName }} Service
7777
After=network.target
7878
7979
[Service]
80-
ExecStart=/usr/bin/env docker-compose -p "{{ .ProjectName }}" -f "{{ .ProjectDirectory }}/{{ .DockerComposeFile }}" up
81-
ExecStop=/usr/bin/env docker-compose -p "{{ .ProjectName }}" -f "{{ .ProjectDirectory }}/{{ .DockerComposeFile }}" down
80+
WorkingDirectory={{ .ProjectDirectory }}
81+
ExecStart=/usr/bin/env docker-compose -p "{{ .ProjectName }}" -f "{{ .DockerComposeFile }}" up
82+
ExecStop=/usr/bin/env docker-compose -p "{{ .ProjectName }}" -f "{{ .DockerComposeFile }}" down
8283
8384
[Install]
8485
WantedBy=network-online.target

0 commit comments

Comments
 (0)