Skip to content

Commit

Permalink
Use WorkingDirectory for the systemd services
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andreaskoch committed Dec 18, 2016
1 parent f0db1b8 commit b1df5e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b1df5e6

Please sign in to comment.