9 Commits
1.1.0 ... 1.1.1

Author SHA1 Message Date
fbf15c52b5 Update scripts/scheduler/entrypoint.sh
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-08-07 08:21:45 +00:00
3e1fee6022 create repo json
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-06 14:05:02 +00:00
gyurix
27c5be7964 Merge branch 'main' of https://git.format.hu/safebox/framework-scheduler
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-06 15:57:39 +02:00
gyurix
7b2ac2e56a Create backup server secrets directory and update JSON output path 2025-08-06 15:57:37 +02:00
9407f7caaf Merge branch 'main' of https://git.format.hu/safebox/framework-scheduler
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-06 10:11:27 +00:00
12cfe301e3 VPN_STATUS swap 2025-08-06 10:10:47 +00:00
gyurix
c2a1fbd9d8 Set default SSH port and user credentials in backup client function
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-06 10:49:02 +02:00
gyurix
d43536b67b Enhance backup server configuration by adding default SSH credentials and updating directory structure for backups
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-06 10:18:48 +02:00
gyurix
da5521295d Refactor entrypoint script to set installed version number and add debug mode handling for input directory
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-31 11:45:19 +02:00

View File

@@ -2,11 +2,7 @@
cd /scripts
DEBUG_MODE=${DEBUG_MODE:-false}
VERSION=1.1.0
# Set installed version number
echo '{}' | jq --arg VERSION "$VERSION" '.VERSION = $VERSION' > /var/tmp/shared/output/version.json
############################
VERSION=1.1.1
#DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-registry.format.hu}
DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-safebox}
@@ -116,11 +112,13 @@ backup_query_state() {
generate_backup_server_secrets () {
mkdir -p $SECRET_DIR/backup/server
echo '{
"backupserver":{
"SSH_USER":"'$SSH_USER'",
"SSH_PORT":"'$SSH_PORT'",
"SSH_PASSWORD":"'$SSH_PASSWORD'"
"SSH_PASSWORD":"'$SSH_PASSWORD'",
"PASSWORD":"'$PASSWORD'",
"PERIOD":"'$PERIOD'",
"COMPRESSION":"'$COMPRESSION'",
@@ -129,7 +127,7 @@ generate_backup_server_secrets () {
"BACKUP_LOCAL_CLIENTS":"'$BACKUP_LOCAL_CLIENTS'",
"BACKUP_VPN_CLIENTS":"'$BACKUP_VPN_CLIENTS'"
}
}' | jq -r . > /etc/user/secret/backup/server/backup.json
}' | jq -r . > $SECRET_DIR/backup/server/backup.json
}
create_backup_service () {
@@ -157,7 +155,7 @@ create_backup_service () {
}
],
"ENTRYPOINT": "sh -c",
"CMD": "mkdir -p /etc/user/data/backup/server/",
"CMD": "mkdir -p /etc/user/data/backup/server/ssh",
"POST_START": []
},
{
@@ -182,15 +180,16 @@ create_backup_service () {
"DEST": "/etc/user/secret/",
"TYPE": "ro"
},
{
"SOURCE": "/etc/user/data/backup/server/ssh",
"DEST": "/home/'$SSH_USER'/",
"TYPE": "rw"
}
],
"ENV_FILES":["/etc/user/secret/backup/server/backup.json"],
'$ADDITIONAL'
'$ADDITIONAL',
"POST_START": []
},
}
]
}'
# create backup server secrets from variables
@@ -211,9 +210,9 @@ backup_set_service() {
local BACKUP_VPN_CLIENTS="$8"
local VPN="$9"
local SSH_PORT="${10}"
local SSH_USER="${11}"
local SSH_PASSWORD="${12}"
local SSH_PORT="${10:-20022}"
local SSH_USER="${11:-"backup"}"
local SSH_PASSWORD="${12:-"backup"}"
local OPERATION="${13}"
if [ "$OPERATION" == "DELETE" ]; then
@@ -268,9 +267,9 @@ backup_set_client() {
local NAME="$1"
local SIZE="$2"
local VPN="$3"
local SSH_PORT="$4"
local SSH_USER="$5"
local SSH_PASSWORD="$6"
local SSH_PORT="${4:-20022}"
local SSH_USER="${5:-"backup"}"
local SSH_PASSWORD="${6:-"backup"}"
local OPERATION="$7"
local VPN_KEY="$8"
@@ -323,7 +322,7 @@ backup_set_client() {
}
],
"ENTRYPOINT": "sh -c",
"CMD": "mkdir -p /etc/user/data/backup/clients/'$NAME'/backup && mkdir -p /etc/user/data/backup/clients/'$NAME'/ssh",
"CMD": "mkdir -p /etc/user/data/backup/clients/'$NAME'/backup && mkdir -p /etc/user/data/backup/clients/'$NAME'/ssh && chmod -R '$SSH_USER':'$SSH_USER' /etc/user/data/backup/clients/'$NAME'",
"POST_START": []
},
{
@@ -338,13 +337,12 @@ backup_set_client() {
"VOLUMES":[
{
"SOURCE": "/etc/user/data/backup/clients/'$NAME'/backup",
"DEST": "/backup",
"TYPE": "rw"
},
{
"SOURCE": "/etc/user/data/backup/clients/'$NAME'/ssh",
"DEST": "/home/'$SSH_USER'/",
"TYPE": "rw"
"DEST": "/home/'$SSH_USER'/backup",
"TYPE": "rw"
},
{
"SOURCE": "/etc/user/data/backup/clients/'$NAME'/ssh",
"DEST": "/home/'$SSH_USER'/.ssh",
}
],
"POST_START": []
@@ -352,8 +350,8 @@ backup_set_client() {
]
}' | jq -r . >/etc/user/config/services/service-backup-client-$NAME.json
debug "service-backup-client-$NAME.json stop force dns-remove"
$service_exec service-backup-client-$NAME.json start &
debug "service-backup-client-$NAME.json start info"
$service_exec service-backup-client-$NAME.json start info &
fi
@@ -512,6 +510,10 @@ get_repositories() {
local TREES=""
local REPO
if [ ! -f "/etc/user/config/repositories.json" ]; then
create_repositories_json
fi
REPOS=$(jq -r .repositories[] /etc/user/config/repositories.json) # list of repos, delimiter by space
for REPO in $REPOS; do
@@ -1242,15 +1244,17 @@ execute_task() {
VPN_STATUS="0"
VPN_RESULT=""
CONTAINERS=$(docker ps -a --format '{{.Names}} {{.Status}}' | grep -w wireguardproxy)
if [ "$CONTAINERS" != "" ]; then
UP=$(echo $CONTAINERS | grep -w 'Up')
if [ "$UP" != "" ]; then
VPN_STATUS="2"
else
VPN_STATUS="1"
if [ -f $SECRET_DIR/vpn-proxy/wg0.conf ]; then
CONTAINERS=$(docker ps -a --format '{{.Names}} {{.Status}}' | grep -w wireguardproxy)
if [ "$CONTAINERS" != "" ]; then
UP=$(echo $CONTAINERS | grep -w 'Up')
if [ "$UP" != "" ]; then
VPN_STATUS="1"
else
VPN_STATUS="2"
fi
VPN_RESULT=$(echo "$CONTAINERS" | base64 -w0)
fi
VPN_RESULT=$(echo "$CONTAINERS" | base64 -w0)
fi
JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "STATUS": "'$VPN_STATUS'", "RESULT": "'$VPN_RESULT'" }' | jq -r . | base64 -w0)
@@ -1496,7 +1500,13 @@ DATE=$(date +%F-%H-%M-%S)
DIR=$SHARED/input
# Triggers by certificate or domain config changes
# Set installed version number
echo '{}' | jq --arg VERSION "$VERSION" '.VERSION = $VERSION' > $SHARED/output/version.json
############################
if [ "$DEBUG_MODE" == "true" ]; then
rm $DIR/*
fi
unset IFS
inotifywait --exclude "\.(swp|tmp)" -m -e CREATE,CLOSE_WRITE,DELETE,MOVED_TO -r $DIR |