1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00

sysutils/rest-server: new port - network backups for restic

API backend for the sysutils/restic backup software, enabling fast and
easy network backups

Approved by:	jrm (mentor, implicit)
Sponsored by:	SkunkWerks, GmbH
This commit is contained in:
Dave Cottlehuber 2019-07-26 12:01:54 +00:00
parent f72d303288
commit 4fccdfe738
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=507353
7 changed files with 131 additions and 2 deletions

2
GIDs
View File

@ -179,7 +179,7 @@ openhab:*:235:
rspamd:*:236:
paperless:*:237:
sonic:*:238:
# free: 239
restserver:*:239:
aprsd:*:240:
tnc:*:241:
prosody:*:242:

2
UIDs
View File

@ -184,7 +184,7 @@ openhab:*:235:235::0:0:openHAB user:/var/db/openhab2/home:/usr/sbin/nologin
rspamd:*:236:236::0:0:rspamd pseudo-user:/nonexistent:/usr/sbin/nologin
paperless:*:237:237::0:0:paperless user:/var/db/paperless:/bin/sh
sonic:*:238:238::0:0:sonic user:/var/db/sonic:/usr/sbin/nologin
# free: 239
restserver:*:239:239::0:0:restic rest-server Daemon:/var/db/restserver:/usr/sbin/nologin
aprsd:*:240:240::0:0:aprsd:/nonexistent:/bin/sh
tnc:*:241:241::0:0:aprsd:/nonexistent:/bin/sh
prosody:*:242:242::0:0:Prosody Jabber Server:/nonexistent:/usr/sbin/nologin

View File

@ -1099,6 +1099,7 @@
SUBDIR += reoback
SUBDIR += reptyr
SUBDIR += respond
SUBDIR += rest-server
SUBDIR += restic
SUBDIR += retail
SUBDIR += rex

View File

@ -0,0 +1,31 @@
# $FreeBSD$
PORTNAME= rest-server
DISTVERSIONPREFIX= v
DISTVERSION= 0.9.8
CATEGORIES= sysutils
MAINTAINER= dch@FreeBSD.org
COMMENT= Performant HTTP server for sysutils/restic backend API
LICENSE= BSD2CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= go
USE_GITHUB= yes
GH_ACCOUNT= restic
GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME}
GO_TARGET= ${GO_PKGNAME}/cmd/${PORTNAME}
USE_RC_SUBR= restserver
USERS= restserver
GROUPS= restserver
PLIST_FILES= bin/${PORTNAME}
do-install:
${INSTALL_PROGRAM} ${WRKDIR}/bin/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1563196957
SHA256 (restic-rest-server-v0.9.8_GH0.tar.gz) = 2080012981c81b788f0aea302f5126b0b2ed89f0bdc9104166289ca167c38c75
SIZE (restic-rest-server-v0.9.8_GH0.tar.gz) = 2398333

View File

@ -0,0 +1,89 @@
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: restserver
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# restserver_enable (bool): Set it to YES to enable restserver.
# Default is "NO".
# restserver_user (user): Set user to run restserver.
# Default is "restserver".
# restserver_group (group): Set group to run restserver.
# Default is "restserver".
# restserver_store (dir): Set restserver config file.
# Default is "/var/db/restserver".
# restserver_syslog_output_enable (bool): Set to enable syslog output.
# Default is "NO". See daemon(8).
# restserver_syslog_output_priority (str): Set syslog priority if syslog enabled.
# Default is "info". See daemon(8).
# restserver_syslog_output_facility (str): Set syslog facility if syslog enabled.
# Default is "daemon". See daemon(8).
. /etc/rc.subr
name=restserver
rcvar=restserver_enable
desc="network API server for sysutils/restic backup software"
load_rc_config $name
: ${restserver_enable:="NO"}
: ${restserver_user:="restserver"}
: ${restserver_group:="restserver"}
: ${restserver_store:="/var/db/restserver"}
: ${restserver_options:="--listen 127.0.0.1:8000 --no-auth"}
DAEMON=$(/usr/sbin/daemon 2>&1 | grep -q syslog ; echo $?)
if [ ${DAEMON} -eq 0 ]; then
: ${restserver_syslog_output_enable:="NO"}
: ${restserver_syslog_output_priority:="info"}
: ${restserver_syslog_output_facility:="daemon"}
if checkyesno restserver_syslog_output_enable; then
restserver_syslog_output_flags="-t ${name} -T ${name}"
if [ -n "${restserver_syslog_output_priority}" ]; then
restserver_syslog_output_flags="${restserver_syslog_output_flags} -s ${restserver_syslog_output_priority}"
fi
if [ -n "${restserver_syslog_output_facility}" ]; then
restserver_syslog_output_flags="${restserver_syslog_output_flags} -l ${restserver_syslog_output_facility}"
fi
fi
else
restserver_syslog_output_enable="NO"
restserver_syslog_output_flags=""
fi
pidfile=/var/run/restserver.pid
procname="%%PREFIX%%/bin/rest-server"
command="/usr/sbin/daemon"
command_args="-f ${restserver_syslog_output_flags} -p ${pidfile} -t ${name} /usr/bin/env ${restserver_env} ${procname} --path ${restserver_store} ${restserver_options}"
extra_commands="reload monitor"
monitor_cmd=restserver_monitor
start_precmd=restserver_startprecmd
required_files="$restserver_config"
restserver_monitor()
{
sig_reload=USR1
run_rc_command "reload"
}
restserver_startprecmd()
{
if [ ! -e ${pidfile} ]; then
install -o ${restserver_user} -g ${restserver_group} /dev/null ${pidfile};
fi
if [ ! -d ${restserver_dir} ]; then
install -d -o ${restserver_user} -g ${restserver_group} ${restserver_dir}
fi
}
run_rc_command "$1"

View File

@ -0,0 +1,5 @@
Rest Server is a high performance HTTP server that implements restic's
REST backend API. It provides secure and efficient way to backup data
remotely, using restic backup client via the rest: URI over the network.
WWW: https://github.com/restic/rest-server