summaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorAlexander Hunt <me@liz.coffee>2026-06-21 17:11:32 -0700
committerAlexander Hunt <me@liz.coffee>2026-06-21 17:11:32 -0700
commit6f3ba344c1f8413a463dc6274f24ef00bf47e534 (patch)
tree2e260c52f1ecf89ece4fad131a91cde7b3500921 /init.d
parentdf7b13a248853880e50743757caedcfbc2b7eb6d (diff)
downloadpenguins.lan-6f3ba344c1f8413a463dc6274f24ef00bf47e534.tar.gz
penguins.lan-6f3ba344c1f8413a463dc6274f24ef00bf47e534.zip
Adding option to bind via unix socketHEADmain
Diffstat (limited to 'init.d')
-rw-r--r--init.d/penguins45
1 files changed, 45 insertions, 0 deletions
diff --git a/init.d/penguins b/init.d/penguins
new file mode 100644
index 0000000..03835a3
--- /dev/null
+++ b/init.d/penguins
@@ -0,0 +1,45 @@
+#!/sbin/openrc-run
+
+# OpenRC service for penguins.lan.
+#
+# Install:
+# install -Dm755 init.d/penguins /etc/init.d/penguins
+# install -Dm644 conf.d/penguins /etc/conf.d/penguins
+# rc-update add penguins default
+# rc-service penguins start
+#
+# The binary resolves .env, ./db, ./templates and ./static relative to its
+# working directory, so directory= must point at the deploy tree.
+
+name="penguins.lan"
+description="penguins.lan portal, scheduler and DNS server"
+
+: "${penguins_user:=penguins}"
+: "${penguins_group:=penguins}"
+: "${penguins_dir:=/opt/penguins.lan}"
+: "${penguins_bin:=${penguins_dir}/penguins}"
+: "${penguins_flags:=-server -scheduler -dns -migrate}"
+
+command="${penguins_bin}"
+command_args="${penguins_flags}"
+command_user="${penguins_user}:${penguins_group}"
+directory="${penguins_dir}"
+
+supervisor="supervise-daemon"
+respawn_delay=5
+respawn_max=0
+output_log="/var/log/penguins.log"
+error_log="/var/log/penguins.log"
+
+# Binding DNS on port 53 (and HTTP on 80) needs this capability when not root.
+capabilities="^cap_net_bind_service"
+
+depend() {
+ need net
+ after firewall
+}
+
+start_pre() {
+ checkpath --directory --owner "${penguins_user}:${penguins_group}" --mode 0750 "${penguins_dir}/db"
+ checkpath --file --owner "${penguins_user}:${penguins_group}" --mode 0640 "${output_log}"
+}