From cbd8ef736722fdf014b7738e89903169bfdeca67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Daniel=20Colmenares=20Oviedo?= Date: Wed, 23 Jul 2025 23:00:28 -0400 Subject: [PATCH] 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) --- sysutils/Makefile | 1 + sysutils/backrest/Makefile | 60 +++++++++++++++++++++++++ sysutils/backrest/distinfo | 7 +++ sysutils/backrest/files/backrest.env.in | 3 ++ sysutils/backrest/files/backrest.in | 35 +++++++++++++++ sysutils/backrest/files/pkg-message.in | 11 +++++ sysutils/backrest/pkg-descr | 5 +++ 7 files changed, 122 insertions(+) create mode 100644 sysutils/backrest/Makefile create mode 100644 sysutils/backrest/distinfo create mode 100644 sysutils/backrest/files/backrest.env.in create mode 100644 sysutils/backrest/files/backrest.in create mode 100644 sysutils/backrest/files/pkg-message.in create mode 100644 sysutils/backrest/pkg-descr diff --git a/sysutils/Makefile b/sysutils/Makefile index 71f54d6d986c..462e392d721f 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -81,6 +81,7 @@ SUBDIR += b3sum SUBDIR += b43-fwcutter SUBDIR += backdown + SUBDIR += backrest SUBDIR += backuppc SUBDIR += backuppc-devel SUBDIR += backuppc4 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 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: <