Fix systemd launch of timesheetsdb
- Add default environment file with postgres config
- Add full path to npm (makes ubuntu happy)
- Call handlers appropriately when systemd unit files are modified
- Add very basic test
Change-Id: I5b1dfab78e449492be193bccfe470813f3028195
diff --git a/templates/timesheetsdb.service.j2 b/templates/timesheetsdb.service.j2
index 3715246..0a35716 100644
--- a/templates/timesheetsdb.service.j2
+++ b/templates/timesheetsdb.service.j2
@@ -2,21 +2,23 @@
SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
SPDX-License-Identifier: Apache-2.0
#}
+# /etc/systemd/system/timesheetsdb
+# {{ ansible_managed }}
[Unit]
Description=Timesheets DB Service
Documentation=https://github.com/opennetworkinglab/timesheetsdb
After=network-online.target
Wants=network-online.target
-
[Service]
Type=simple
User={{ timesheets_username }}
Group={{ timesheets_groupname }}
-WorkingDirectory={{ timesheets_dir }}/db
-ExecStart=npm run start:prod
+EnvironmentFile=/etc/default/timesheetsdb
+WorkingDirectory={{ timesheets_dir }}/db
+ExecStart=/usr/bin/npm run start:prod
Restart=on-failure
RestartSec=30