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)
This commit is contained in:
Jesús Daniel Colmenares Oviedo
2025-07-23 23:00:28 -04:00
parent a65027dfb8
commit cbd8ef7367
7 changed files with 122 additions and 0 deletions
+1
View File
@@ -81,6 +81,7 @@
SUBDIR += b3sum
SUBDIR += b43-fwcutter
SUBDIR += backdown
SUBDIR += backrest
SUBDIR += backuppc
SUBDIR += backuppc-devel
SUBDIR += backuppc4
+60
View File
@@ -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>
+7
View File
@@ -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
+3
View File
@@ -0,0 +1,3 @@
BACKREST_DATA=%%HOMEDIR%%
BACKREST_CONFIG=%%HOMEDIR%%/config.json
XDG_CACHE_HOME=%%HOMEDIR%%/cache
+35
View File
@@ -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"
+11
View File
@@ -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
}
]
+5
View File
@@ -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.