summaryrefslogtreecommitdiff
path: root/deploy
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-17 19:55:36 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-17 19:55:36 +0200
commit380195f7cd5e57acf2c1cf2bc41069e6b0b979ed (patch)
tree32a88fb22a7fbe8f1fd5c105156d1f928c93950d /deploy
downloadbokf-380195f7cd5e57acf2c1cf2bc41069e6b0b979ed.tar.gz
bokf-380195f7cd5e57acf2c1cf2bc41069e6b0b979ed.zip
Initial commit: daemon, clients, docs, Docker deploy pipelinev0.1.0
Diffstat (limited to 'deploy')
-rwxr-xr-xdeploy/docker-entrypoint.sh21
-rw-r--r--deploy/post-receive.sample29
2 files changed, 50 insertions, 0 deletions
diff --git a/deploy/docker-entrypoint.sh b/deploy/docker-entrypoint.sh
new file mode 100755
index 0000000..8eacc01
--- /dev/null
+++ b/deploy/docker-entrypoint.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+set -eu
+
+: "${BOKFD_DB:=/var/lib/bokfd/bokfd.db}"
+: "${BOKFD_SOCKET:=/run/bokfd/bokfd.sock}"
+: "${BOKFD_BACKUP_DIR:=/var/lib/bokfd/backup}"
+: "${BOKFD_EXPORT_DIR:=/var/lib/bokfd/export}"
+export BOKFD_DB BOKFD_SOCKET BOKFD_BACKUP_DIR BOKFD_EXPORT_DIR
+
+mkdir -p "$BOKFD_BACKUP_DIR" "$BOKFD_EXPORT_DIR" "$(dirname "$BOKFD_SOCKET")"
+chown -R bokfd:bokfd /var/lib/bokfd "$(dirname "$BOKFD_SOCKET")"
+
+case "${1:-}" in
+ bokfd | bokfctl | bokftui | /*)
+ exec setpriv --reuid=bokfd --regid=bokfd --clear-groups "$@"
+ ;;
+ *)
+ exec setpriv --reuid=bokfd --regid=bokfd --clear-groups \
+ /usr/local/bin/bokfd "$@"
+ ;;
+esac
diff --git a/deploy/post-receive.sample b/deploy/post-receive.sample
new file mode 100644
index 0000000..a259c2a
--- /dev/null
+++ b/deploy/post-receive.sample
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Optional: auto-deploy when pushing to a bare repo on the host.
+#
+# The normal workflow is scripts/deploy.sh from the development machine; this
+# hook is for the variant where the host also has the toolchain and a working
+# checkout. Install as hooks/post-receive in the bare repo, make it
+# executable, and set WORK_TREE to a checkout whose origin is that bare repo.
+set -eu
+
+WORK_TREE="${WORK_TREE:-/srv/bokf/src}"
+DEPLOY_DIR="${DEPLOY_DIR:-/srv/bokf}"
+BRANCH="${BRANCH:-refs/heads/main}"
+
+while read -r _old _new ref; do
+ [ "$ref" = "$BRANCH" ] || continue
+ cd "$WORK_TREE"
+ git pull --ff-only
+ make -j"$(nproc)"
+ make test
+ tag="$(git describe --tags --always)"
+ docker build -t "bokf:$tag" .
+ cp compose.yaml "$DEPLOY_DIR/compose.yaml"
+ touch "$DEPLOY_DIR/.env"
+ sed -i '/^BOKF_IMAGE=/d;/^BOKF_TAG=/d' "$DEPLOY_DIR/.env"
+ printf 'BOKF_IMAGE=bokf\nBOKF_TAG=%s\n' "$tag" >> "$DEPLOY_DIR/.env"
+ cd "$DEPLOY_DIR"
+ docker compose up -d --no-build
+ docker compose ps
+done