summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Bastillefile22
-rwxr-xr-xusr/local/etc/rc.d/pigallery226
2 files changed, 48 insertions, 0 deletions
diff --git a/Bastillefile b/Bastillefile
new file mode 100644
index 0000000..fcb79dd
--- /dev/null
+++ b/Bastillefile
@@ -0,0 +1,22 @@
+# Bastille template for pigallery2
+# TODO: nonroot user
+
+# Mounts
+CMD mkdir -p /var/pigallery2/db /var/pigallery2/tmp
+FSTAB /zroot/nextcloud_data/53hornet/files/photos /mnt/photos nullfs ro 0 0
+FSTAB /zroot/pigallery2 /var/pigallery2 nullfs rw 0 0
+
+# Dependencies
+PKG node16 npm ffmpeg vips python
+
+# Install
+CMD mkdir -p /usr/local/www/pigallery2
+CMD fetch -o /tmp/pigallery2-release.zip https://github.com/bpatrik/pigallery2/releases/download/1.9.3/pigallery2-release.zip
+CMD tar zxvf /tmp/pigallery2-release.zip -C /usr/local/www/pigallery2
+CMD npm install --prefix /usr/local/www/pigallery2 /usr/local/www/pigallery2
+
+# Install and start service
+OVERLAY usr
+SYSRC pigallery2_enable=YES
+SYSRC pigallery2_config=/var/pigallery2/config.json
+SERVICE pigallery2 restart
diff --git a/usr/local/etc/rc.d/pigallery2 b/usr/local/etc/rc.d/pigallery2
new file mode 100755
index 0000000..daed768
--- /dev/null
+++ b/usr/local/etc/rc.d/pigallery2
@@ -0,0 +1,26 @@
+#!/bin/sh
+# PROVIDE: pigallery2
+# REQUIRE: DAEMON NETWORKING
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name="pigallery2"
+rcvar="${name}_enable"
+pigallery2_chdir="/usr/local/www/pigallery2"
+pidfile="/var/run/${name}.pid"
+node="/usr/local/bin/node"
+command="/usr/sbin/daemon"
+procname="daemon"
+load_rc_config $name
+#: ${pigallery2_config="/var/pigallery2/config.json"}
+script_js="/usr/local/www/pigallery2/src/backend/index.js"
+script_opts="--config-path ${pigallery2_config}"
+command_args="-o /var/log/${name}.log -c -f -P ${pidfile} ${node} ${script_js} ${script_opts}"
+start_precmd="${name}_precmd"
+
+pigallery2_precmd() {
+ install /dev/null ${pidfile}
+}
+
+run_rc_command "$1"