From f5ec755cf3ec7c9455ccc5c8bf2b571dc5677443 Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas.kluyver@xfel.eu>
Date: Wed, 7 Aug 2024 17:14:07 +0100
Subject: [PATCH] Add unit files to manage services with systemd

---
 webservice/systemd/cal-job-monitor.service     | 11 +++++++++++
 webservice/systemd/cal-overview-server.service | 11 +++++++++++
 webservice/systemd/cal-webservice.service      | 11 +++++++++++
 3 files changed, 33 insertions(+)
 create mode 100644 webservice/systemd/cal-job-monitor.service
 create mode 100644 webservice/systemd/cal-overview-server.service
 create mode 100644 webservice/systemd/cal-webservice.service

diff --git a/webservice/systemd/cal-job-monitor.service b/webservice/systemd/cal-job-monitor.service
new file mode 100644
index 000000000..115a986cc
--- /dev/null
+++ b/webservice/systemd/cal-job-monitor.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=XFEL offline calibration Slurm job monitor
+
+[Service]
+Type=exec
+WorkingDirectory=%h/deployments/development/git.xfel.eu/detectors/pycalibration/current/
+ExecStart=%h/deployments/development/git.xfel.eu/detectors/pycalibration/current/.venv/bin/python -m webservice.job_monitor --log-level DEBUG
+Restart=on-failure
+
+[Install]
+WantedBy=default.target
diff --git a/webservice/systemd/cal-overview-server.service b/webservice/systemd/cal-overview-server.service
new file mode 100644
index 000000000..a952da03b
--- /dev/null
+++ b/webservice/systemd/cal-overview-server.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=XFEL offline calibration status web page
+
+[Service]
+Type=exec
+WorkingDirectory=%h/deployments/development/git.xfel.eu/detectors/pycalibration/current/
+ExecStart=%h/deployments/development/git.xfel.eu/detectors/pycalibration/current/.venv/bin/python -m webservice.serve_overview
+Restart=on-failure
+
+[Install]
+WantedBy=default.target
diff --git a/webservice/systemd/cal-webservice.service b/webservice/systemd/cal-webservice.service
new file mode 100644
index 000000000..835c5b046
--- /dev/null
+++ b/webservice/systemd/cal-webservice.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=XFEL offline calibration ZMQ service
+
+[Service]
+Type=exec
+WorkingDirectory=%h/deployments/development/git.xfel.eu/detectors/pycalibration/current/
+ExecStart=%h/deployments/development/git.xfel.eu/detectors/pycalibration/current/.venv/bin/python -m webservice.webservice --mode prod --log-level DEBUG
+Restart=on-failure
+
+[Install]
+WantedBy=default.target
-- 
GitLab