From 6b18e98f604adb4caccec96a0eccc5d58ec55d18 Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Silva Date: Fri, 6 Dec 2024 18:19:16 +0000 Subject: [PATCH] Added sample systemd unit files for deployment --- .../systemd-unit-files/clean-docker-images.service | 7 +++++++ .../systemd-unit-files/clean-docker-images.timer | 10 ++++++++++ deployments/systemd-unit-files/webhook.service | 10 ++++++++++ 3 files changed, 27 insertions(+) create mode 100644 deployments/systemd-unit-files/clean-docker-images.service create mode 100644 deployments/systemd-unit-files/clean-docker-images.timer create mode 100644 deployments/systemd-unit-files/webhook.service diff --git a/deployments/systemd-unit-files/clean-docker-images.service b/deployments/systemd-unit-files/clean-docker-images.service new file mode 100644 index 0000000..02797b7 --- /dev/null +++ b/deployments/systemd-unit-files/clean-docker-images.service @@ -0,0 +1,7 @@ +[Unit] +Description="Clean up docker images" + +[Service] +Type=simple +ExecStart=/usr/bin/docker system prune --all --force +User={CHANGE_ME} diff --git a/deployments/systemd-unit-files/clean-docker-images.timer b/deployments/systemd-unit-files/clean-docker-images.timer new file mode 100644 index 0000000..add0541 --- /dev/null +++ b/deployments/systemd-unit-files/clean-docker-images.timer @@ -0,0 +1,10 @@ +[Unit] +Description="Timer for the clean-docker-images service" + +[Timer] +Unit=clean-docker-images.service +OnCalendar=Sun *-*-* 01:00:00 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/deployments/systemd-unit-files/webhook.service b/deployments/systemd-unit-files/webhook.service new file mode 100644 index 0000000..479a4c3 --- /dev/null +++ b/deployments/systemd-unit-files/webhook.service @@ -0,0 +1,10 @@ +# systemd service file for the webhook server +# - Create the `/etc/systemd/system/webhook.service` file with these contents +# - Run `sudo systemctl daemon-relaod` +# - Finally run sudo systemctl start webhook.conf + +[Service] +Environment="WEBHOOK_SECRET={CHANGE_ME}" +ExecStart=/usr/bin/webhook -template -port {CHANGE_ME} -hooks {CHANGE_ME} +User={CHANGE_ME} +Group={CHANGE_ME}