-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restic rest-server 0.12.1 initial package #5550
Open
fgma
wants to merge
15
commits into
SynoCommunity:master
Choose a base branch
from
fgma:restic-rest-server
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9082ccd
restic rest-server 0.11.0 initial package
fgma f329420
rest-server: fix package upgrade
fgma ac34467
rest-server: makefile cleanup
fgma 820be07
rest-server: rename to restic-rest-server
fgma f9d466b
restic-rest-server: fix definition of SERVICE_PORT
fgma dc0d2d6
restic-rest-server: use multiselect in wizard
fgma 5c09da4
restic-rest-server: additional note on how to configure auth
fgma 90398e3
restic-rest-server: additional infos for users in wizard
fgma 98f1560
restic-rest-server: use existing function to load wizard vars
fgma 6794b96
restic-rest-server: fixes to work in master branch
fgma 031088c
resitc-rest-server: fix building with go
fgma a12e2a9
restic-rest-server: add support for custom args
fgma 4ec4a86
restic-rest-server: update to 0.12.0
fgma 05dadc4
restic-rest-server: update to 0.12.1
fgma 96d1553
restic-rest-server: remove DSM_UI_DIR
fgma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
PKG_NAME = restic-rest-server | ||
PKG_REAL_NAME = rest-server | ||
PKG_VERS = 0.12.1 | ||
PKG_EXT = tar.gz | ||
PKG_DIST_NAME = $(PKG_REAL_NAME)-$(PKG_VERS).$(PKG_EXT) | ||
PKG_DIST_SITE = https://github.com/restic/rest-server/releases/download/v$(PKG_VERS) | ||
EXTRACT_PATH = $(WORK_DIR)/$(PKG_NAME) | ||
PKG_DIR = $(PKG_NAME) | ||
|
||
BUILD_DEPENDS = native/go | ||
|
||
HOMEPAGE = https://restic.net/ | ||
COMMENT = Rest Server is a high performance HTTP server that implements restic's REST backend API. | ||
LICENSE = BSD 2-Clause License | ||
|
||
GO_SRC_DIR = $(EXTRACT_PATH) | ||
GO_BIN_DIR = $(GO_SRC_DIR)/$(PKG_NAME) | ||
|
||
ENV += CGO_ENABLED=0 | ||
|
||
GO_BUILD_ARGS = ./cmd/rest-server | ||
|
||
include ../../mk/spksrc.cross-go.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bin:bin/restic-rest-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
rest-server-0.12.1.tar.gz SHA1 50a68154ffebc228bffae7cd06744a9224fdb9b9 | ||
rest-server-0.12.1.tar.gz SHA256 f1b4e4ce581d698847c8a4a354a7fe201b073ebca223abf01898c53d87ccbf31 | ||
rest-server-0.12.1.tar.gz MD5 970aa609b3a2793b82480cc4344881ef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
SPK_NAME = restic-rest-server | ||
SPK_VERS = 0.12.1 | ||
SPK_REV = 1 | ||
SPK_ICON = src/logo.png | ||
|
||
DEPENDS = cross/restic-rest-server | ||
|
||
UNSUPPORTED_ARCHS = $(PPC_ARCHS) | ||
|
||
MAINTAINER = fgma | ||
DESCRIPTION = Rest Server is a high performance HTTP server that implements restic's REST backend API. | ||
DISPLAY_NAME = Restic rest-server | ||
CHANGELOG = "Initial release." | ||
LICENSE_FILE = $(WORK_DIR)/restic-rest-server/LICENSE | ||
HOMEPAGE = https://restic.net/ | ||
LICENSE = BSD 2-Clause License | ||
|
||
WIZARDS_DIR = src/wizard | ||
|
||
STARTABLE = yes | ||
SERVICE_USER = auto | ||
SERVICE_SETUP = src/service-setup.sh | ||
SERVICE_WIZARD_SHARE = wizard_data_directory | ||
USE_DATA_SHARE_WORKER = yes | ||
FWPORTS = src/restic-rest-server.sc | ||
SERVICE_PORT = 8500 | ||
NO_SERVICE_SHORTCUT = yes | ||
|
||
include ../../mk/spksrc.spk.mk |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[restic-rest-server] | ||
title="Restic rest-server" | ||
desc="Restic rest-server" | ||
port_forward="yes" | ||
dst.ports="8500/tcp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
PATH="${SYNOPKG_PKGDEST}/bin:${PATH}" | ||
GROUP="sc-restic-rest-server" | ||
|
||
# Source installer variables and functions to be available for service start (and not only during installation) | ||
INST_FUNCTIONS=$(dirname $0)"/functions" | ||
if [ -r "${INST_FUNCTIONS}" ]; then | ||
. "${INST_FUNCTIONS}" | ||
fi | ||
|
||
load_variables_from_file "${INST_VARIABLES}" | ||
|
||
REST_SERVER_CUSTOM_ARGS_FILE="${WIZARD_DATA_VOLUME}/${WIZARD_DATA_DIRECTORY}/restic_rest_server_custom_args.txt" | ||
|
||
service_prestart () | ||
{ | ||
ARGS="" | ||
|
||
if [ "${WIZARD_APPEND_ONLY}" == "true" ]; then | ||
ARGS="${ARGS} --append-only" | ||
fi | ||
if [ "${WIZARD_PRIVATE_REPOS}" == "true" ]; then | ||
ARGS="${ARGS} --private-repos" | ||
fi | ||
if [ "${WIZARD_PROMETHEUS}" == "true" ]; then | ||
ARGS="${ARGS} --prometheus" | ||
|
||
if [ "${WIZARD_PROMETHEUS_NO_AUTH}" == "true" ]; then | ||
ARGS="${ARGS} --prometheus-no-auth" | ||
fi | ||
fi | ||
if [ -f "$REST_SERVER_CUSTOM_ARGS_FILE" -a -r "$REST_SERVER_CUSTOM_ARGS_FILE" ]; then | ||
CUSTOM_ARGS=`cat ${REST_SERVER_CUSTOM_ARGS_FILE}` | ||
ARGS="${ARGS} ${CUSTOM_ARGS}" | ||
fi | ||
|
||
SERVICE_COMMAND="${SYNOPKG_PKGDEST}/bin/restic-rest-server --listen ":${SERVICE_PORT}" --path ${WIZARD_DATA_VOLUME}/${WIZARD_DATA_DIRECTORY} ${ARGS}" | ||
SVC_BACKGROUND=y | ||
SVC_WRITE_PID=y | ||
} | ||
|
||
service_postinst () | ||
{ | ||
touch ${wizard_data_volume}/${wizard_data_directory}/.htpasswd | ||
touch ${REST_SERVER_CUSTOM_ARGS_FILE} | ||
echo WIZARD_DATA_VOLUME="${wizard_data_volume}" >> ${INST_VARIABLES} | ||
echo WIZARD_DATA_DIRECTORY="${wizard_data_directory}" >> ${INST_VARIABLES} | ||
echo WIZARD_APPEND_ONLY="${wizard_append_only}" >> ${INST_VARIABLES} | ||
echo WIZARD_PRIVATE_REPOS="${wizard_private_repos}" >> ${INST_VARIABLES} | ||
echo WIZARD_PROMETHEUS="${wizard_prometheus}" >> ${INST_VARIABLES} | ||
echo WIZARD_PROMETHEUS_NO_AUTH="${wizard_prometheus_no_auth}" >> ${INST_VARIABLES} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
[ | ||
{ | ||
"step_title": "Restic rest-server configuration", | ||
"items": [ | ||
{ | ||
"type": "combobox", | ||
"desc": "Please select a volume to use for the data folder", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_data_volume", | ||
"desc": "Volume name", | ||
"displayField": "display_name", | ||
"valueField": "volume_path", | ||
"editable": false, | ||
"mode": "remote", | ||
"api_store": { | ||
"api": "SYNO.Core.Storage.Volume", | ||
"method": "list", | ||
"version": 1, | ||
"baseParams": { | ||
"limit": -1, | ||
"offset": 0, | ||
"location": "internal" | ||
}, | ||
"root": "volumes", | ||
"idProperty": "volume_path", | ||
"fields": [ | ||
"display_name", | ||
"volume_path" | ||
] | ||
}, | ||
"validator": { | ||
"fn": "{console.log(arguments);return true;}" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "textfield", | ||
"desc": "Data shared folder (using the volume chosen above)", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_data_directory", | ||
"desc": "Data shared folder", | ||
"defaultValue": "restic-rest-server", | ||
"validator": { | ||
"allowBlank": false, | ||
"regex": { | ||
"expr": "/^[\\w _-]+$/", | ||
"errorText": "Subdirectories are not supported." | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"desc": "The folder will be created on demand as regular DSM shared folder for the service user <b>sc-restic-rest-server</b>. For details about the DSM permissions see <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a>.<p/>" | ||
}, | ||
{ | ||
"desc": "The non-standard port 8500 is used. The .htpasswd file and restic_rest_server_custom_args.txt to specify custom arguments to the service are located at the root of the shared folder defined above. Add users acccording to the official documentation. Please define the following additional settings for restic rest-server:" | ||
}, | ||
{ | ||
"type": "multiselect", | ||
"desc": "Append only mode", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_append_only", | ||
"desc": "enabled", | ||
"defaultValue": true | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "multiselect", | ||
"desc": "Private repositories", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_private_repos", | ||
"desc": "enabled", | ||
"defaultValue": true | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "multiselect", | ||
"desc": "Prometheus", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_prometheus", | ||
"desc": "enabled", | ||
"defaultValue": true | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "multiselect", | ||
"desc": "Prometheus no auth", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_prometheus_no_auth", | ||
"desc": "enabled", | ||
"defaultValue": false | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
#!/bin/sh | ||
|
||
INST_ETC="/var/packages/${SYNOPKG_PKGNAME}/etc" | ||
INST_VARIABLES="${INST_ETC}/installer-variables" | ||
|
||
# Reload wizard variables stored by postinst | ||
if [ -r "${INST_VARIABLES}" ]; then | ||
# we cannot source the file to reload the variables, when values have special characters like <, >, ... | ||
for _line in $(cat "${INST_VARIABLES}"); do | ||
_key="$(echo ${_line} | awk -F'=' '{print $1}')" | ||
_value="$(echo ${_line} | awk -F'=' '{print $2}')" | ||
declare "${_key}=${_value}" | ||
done | ||
fi | ||
|
||
cat <<EOF > $SYNOPKG_TEMP_LOGFILE | ||
[ | ||
{ | ||
"step_title": "Restic rest-server configuration", | ||
"items": [ | ||
{ | ||
"type": "combobox", | ||
"desc": "Please select a volume to use for the data folder", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_data_volume", | ||
"desc": "Volume name", | ||
"defaultValue": "${WIZARD_DATA_VOLUME}", | ||
"displayField": "display_name", | ||
"valueField": "volume_path", | ||
"editable": false, | ||
"mode": "remote", | ||
"api_store": { | ||
"api": "SYNO.Core.Storage.Volume", | ||
"method": "list", | ||
"version": 1, | ||
"baseParams": { | ||
"limit": -1, | ||
"offset": 0, | ||
"location": "internal" | ||
}, | ||
"root": "volumes", | ||
"idProperty": "volume_path", | ||
"fields": [ | ||
"display_name", | ||
"volume_path" | ||
] | ||
}, | ||
"validator": { | ||
"fn": "{console.log(arguments);return true;}" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "textfield", | ||
"desc": "Data shared folder (using the volume chosen above)", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_data_directory", | ||
"desc": "Data shared folder", | ||
"defaultValue": "${WIZARD_DATA_DIRECTORY}", | ||
"validator": { | ||
"allowBlank": false, | ||
"regex": { | ||
"expr": "/^[\\\\w _-]+$/", | ||
"errorText": "Subdirectories are not supported." | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"desc": "The folder will be created on demand as regular DSM shared folder for the service user <b>sc-restic-rest-server</b>. For details about the DSM permissions see <a target=\"_blank\" href=\"https://github.com/SynoCommunity/spksrc/wiki/Permission-Management\">Permission Management</a>.<p/>" | ||
}, | ||
{ | ||
"desc": "The non-standard port 8500 is used. The .htpasswd file and restic_rest_server_custom_args.txt to specify custom arguments to the service are located at the root of the shared folder defined above. Add users acccording to the official documentation. Please define the following additional settings for restic rest-server:" | ||
}, | ||
{ | ||
"type": "multiselect", | ||
"desc": "Append only mode", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_append_only", | ||
"desc": "enabled", | ||
"defaultValue": ${WIZARD_APPEND_ONLY} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "multiselect", | ||
"desc": "Private repositories", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_private_repos", | ||
"desc": "enabled", | ||
"defaultValue": ${WIZARD_PRIVATE_REPOS} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "multiselect", | ||
"desc": "Prometheus", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_prometheus", | ||
"desc": "enabled", | ||
"defaultValue": ${WIZARD_PROMETHEUS} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "multiselect", | ||
"desc": "Prometheus no auth", | ||
"subitems": [ | ||
{ | ||
"key": "wizard_prometheus_no_auth", | ||
"desc": "enabled", | ||
"defaultValue": ${WIZARD_PROMETHEUS_NO_AUTH} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
EOF | ||
exit 0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the new version for shared folders:
define
SERVICE_WIZARD_SHARE_NAME
and remove
SERVICE_WIZARD_SHARE
andUSE_DATA_SHARE_WORKER
and remove the volume configuration in the install and uninstall wizards (use the share name only in the install and uninstall wizard)