summaryrefslogtreecommitdiff
path: root/sysutils/backrest
diff options
context:
space:
mode:
authorJesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>2025-07-23 23:00:28 -0400
committerJesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>2025-07-24 01:35:14 -0400
commitcbd8ef736722fdf014b7738e89903169bfdeca67 (patch)
tree4fe2b3ade35eb7ea7086ebdddc77a2e910ae817f /sysutils/backrest
parentdatabases/timescaledb: Update to 2.21.1 (diff)
sysutils/backrest: New port: Web UI and orchestrator for restic backup
Backrest is a web-accessible backup solution built on top of restic. Backrest provides a WebUI which wraps the restic CLI and makes it easy to create repos, browse snapshots, and restore files. Additionally, Backrest can run in the background and take an opinionated approach to scheduling snapshots and orchestrating repo health operations. Approved by: acm (mentor)
Diffstat (limited to 'sysutils/backrest')
-rw-r--r--sysutils/backrest/Makefile60
-rw-r--r--sysutils/backrest/distinfo7
-rw-r--r--sysutils/backrest/files/backrest.env.in3
-rw-r--r--sysutils/backrest/files/backrest.in35
-rw-r--r--sysutils/backrest/files/pkg-message.in11
-rw-r--r--sysutils/backrest/pkg-descr5
6 files changed, 121 insertions, 0 deletions
diff --git a/sysutils/backrest/Makefile b/sysutils/backrest/Makefile
new file mode 100644
index 000000000000..63c07a5797a9
--- /dev/null
+++ b/sysutils/backrest/Makefile
@@ -0,0 +1,60 @@
+PORTNAME= backrest
+DISTVERSIONPREFIX= v
+DISTVERSION= 1.8.1
+CATEGORIES= sysutils
+MASTER_SITES= LOCAL/dtxdf/${PORTNAME}/
+DISTFILES= ${PORTNAME}-${DISTVERSIONPREFIX}${DISTVERSION}.frontend${EXTRACT_SUFX}
+
+MAINTAINER= dtxdf@FreeBSD.org
+COMMENT= Web UI and orchestrator for restic backup
+WWW= https://garethgeorge.github.io/${PORTNAME}
+
+LICENSE= GPLv3
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+RUN_DEPENDS= restic>=0:sysutils/restic
+
+USES= go:modules
+USE_RC_SUBR= ${PORTNAME}
+
+GO_MODULE= github.com/garethgeorge/${PORTNAME}
+GO_TARGET= ./cmd/backrest
+GO_BUILDFLAGS= -ldflags "\
+ -X 'main.version=${DISTVERSIONPREFIX}${DISTVERSION}' \
+ -X 'main.commit=${GITID}' \
+ -X 'main.date=${BUILD_DATE}'"
+
+SUB_FILES= ${PORTNAME}.env pkg-message
+SUB_LIST= HOMEDIR=${BACKREST_HOMEDIR} \
+ USER=${BACKREST_USER}
+
+PLIST_FILES= "@dir(${BACKREST_USER},${BACKREST_GROUP},0700) ${BACKREST_HOMEDIR}" \
+ "@sample ${ETCDIR}/config.env.sample" \
+ bin/${PORTNAME}
+
+OPTIONS_DEFINE= RCLONE
+OPTIONS_DEFAULT= RCLONE
+
+RCLONE_DESC= Cloud storage support
+RCLONE_RUN_DEPENDS= rclone>=0:net/rclone
+
+# Run 'git checkout ${DISTVERSIONPREFIX}${DISTVERSION} && git rev-parse HEAD'
+# in the Backrest repository to get the value of GITID.
+GITID= 7a5030bb00f113170e1c09c45a4f2034a13a2809
+
+BUILD_DATE= $$(date -u '+%Y-%m-%dT%H:%M:%SZ')
+
+BACKREST_HOMEDIR= /var/db/${PORTNAME}
+BACKREST_USER= www
+BACKREST_GROUP= ${BACKREST_USER}
+
+pre-build:
+ @${MKDIR} ${WRKSRC}/webui/dist
+ @cd ${WRKDIR}/backrest-frontend && ${COPYTREE_SHARE} . ${WRKSRC}/webui/dist
+
+post-install:
+ @${MKDIR} ${STAGEDIR}${BACKREST_HOMEDIR}
+ @${MKDIR} ${STAGEDIR}${ETCDIR}
+ ${INSTALL_DATA} ${WRKDIR}/${PORTNAME}.env ${STAGEDIR}${ETCDIR}/config.env.sample
+
+.include <bsd.port.mk>
diff --git a/sysutils/backrest/distinfo b/sysutils/backrest/distinfo
new file mode 100644
index 000000000000..391370b10d11
--- /dev/null
+++ b/sysutils/backrest/distinfo
@@ -0,0 +1,7 @@
+TIMESTAMP = 1753297204
+SHA256 (go/sysutils_backrest/backrest-v1.8.1/backrest-v1.8.1.frontend.tar.gz) = ef4a66361180b5e7a28b074dd2d4dfcfaf84b8d0a3b14096a5e728ec1bd0822c
+SIZE (go/sysutils_backrest/backrest-v1.8.1/backrest-v1.8.1.frontend.tar.gz) = 3944938
+SHA256 (go/sysutils_backrest/backrest-v1.8.1/v1.8.1.mod) = 37cfec3fd55a330cb6bd88ceffa7a4cfd4950678f93ab668656ec3d3aa9185cd
+SIZE (go/sysutils_backrest/backrest-v1.8.1/v1.8.1.mod) = 3731
+SHA256 (go/sysutils_backrest/backrest-v1.8.1/v1.8.1.zip) = a85ba42c616ad3c1e8ad933314a6d2d1a6bc2f77e25bf935708742e8053668df
+SIZE (go/sysutils_backrest/backrest-v1.8.1/v1.8.1.zip) = 775308
diff --git a/sysutils/backrest/files/backrest.env.in b/sysutils/backrest/files/backrest.env.in
new file mode 100644
index 000000000000..27aa64d770f8
--- /dev/null
+++ b/sysutils/backrest/files/backrest.env.in
@@ -0,0 +1,3 @@
+BACKREST_DATA=%%HOMEDIR%%
+BACKREST_CONFIG=%%HOMEDIR%%/config.json
+XDG_CACHE_HOME=%%HOMEDIR%%/cache
diff --git a/sysutils/backrest/files/backrest.in b/sysutils/backrest/files/backrest.in
new file mode 100644
index 000000000000..5c709b0b2e12
--- /dev/null
+++ b/sysutils/backrest/files/backrest.in
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# PROVIDE: backrest
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Configuration settings for backrest in /etc/rc.conf
+#
+# backrest_enable (bool): Enable backrest. (Default=NO)
+# backrest_env_file (str): Path containing the environment variables
+# to be used by backrest. (Default: %%ETCDIR%%/config.env)
+# backrest_logfile (str): Log file used to store the backrest's output. (Default: /var/log/backrest.log)
+# backrest_pidfile (str): File used by backrest to store the process ID. (Default: /var/run/backrest.pid)
+# backrest_runas (str): User to run backrest as. (Default: %%USER%%)
+
+. /etc/rc.subr
+
+name="backrest"
+desc="Web UI and orchestrator for restic backup"
+rcvar="backrest_enable"
+
+load_rc_config $name
+
+: ${backrest_enable:="NO"}
+: ${backrest_env_file:="%%ETCDIR%%/config.env"}
+: ${backrest_logfile:="/var/log/backrest.log"}
+: ${backrest_pidfile:="/var/run/backrest.pid"}
+: ${backrest_runas:="%%USER%%"}
+
+pidfile="${backrest_pidfile}"
+procname="%%LOCALBASE%%/bin/backrest"
+command="/usr/sbin/daemon"
+command_args="-o '${backrest_logfile}' -p '${pidfile}' -u '${backrest_runas}' -t '${desc}' -- '${procname}'"
+
+run_rc_command "$1"
diff --git a/sysutils/backrest/files/pkg-message.in b/sysutils/backrest/files/pkg-message.in
new file mode 100644
index 000000000000..675cdb673e90
--- /dev/null
+++ b/sysutils/backrest/files/pkg-message.in
@@ -0,0 +1,11 @@
+[
+{ type: install
+ message: <<EOM
+By default, Backrest runs as '%%USER%%', which can be problematic if you want
+to restore files in a directory where that user does not have write permissions.
+You can change the user that Backrest runs as using 'backrest_runas' in your
+'rc.conf(5)' file or create a directory and chown(8)s into it. The latter is
+the recommended method.
+EOM
+}
+]
diff --git a/sysutils/backrest/pkg-descr b/sysutils/backrest/pkg-descr
new file mode 100644
index 000000000000..3cdd05ec8b4f
--- /dev/null
+++ b/sysutils/backrest/pkg-descr
@@ -0,0 +1,5 @@
+Backrest is a web-accessible backup solution built on top of restic.
+Backrest provides a WebUI which wraps the restic CLI and makes it
+easy to create repos, browse snapshots, and restore files. Additionally,
+Backrest can run in the background and take an opinionated approach
+to scheduling snapshots and orchestrating repo health operations.