13 Commits
1.1.2 ... main

Author SHA1 Message Date
gyurix
a46e1d69e2 Bump version to 1.1.5 in entrypoint script
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-09-02 14:07:37 +02:00
gyurix
62a9bdc65d Update install script to replace local-proxy with local-loadbalancer
All checks were successful
continuous-integration/drone/push Build is passing
2025-09-02 12:03:08 +02:00
gyurix
4361299a0e Update system list in entrypoint script to include local-loadbalancer.json
All checks were successful
continuous-integration/drone/push Build is passing
2025-09-02 11:56:06 +02:00
gyurix
982b00acff Set working directory for scheduler entrypoint and upgrade functions
All checks were successful
continuous-integration/drone/push Build is passing
2025-09-02 11:49:17 +02:00
gyurix
41c7c73abf Refactor upgrade function to ensure .json extension is appended correctly
All checks were successful
continuous-integration/drone/push Build is passing
2025-09-02 11:40:50 +02:00
gyurix
2bd803c4b5 Update upgrade function to append .json extension if missing
All checks were successful
continuous-integration/drone/push Build is passing
2025-09-02 09:25:55 +02:00
gyurix
85dd5aa4ad Refactor backup service parameters and add default SSH host value
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-08-26 12:32:36 +02:00
gyurix
81dd98b952 Add default values for SSH parameters in backup service functions
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-08-26 09:39:33 +02:00
gyurix
7125f17b22 Fix JSON formatting and add TYPE field in backup configuration
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-08-26 08:05:40 +02:00
bd0753b4db json b64 debug removed
All checks were successful
continuous-integration/drone/tag Build is passing
2025-08-14 17:44:16 +00:00
gyurix
779f28a5f7 Clean temporary files in shared volume during task execution
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-08-13 09:22:38 +02:00
gyurix
9878fa9ce3 Bump version to 1.1.3 in entrypoint script
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-08-09 09:54:36 +02:00
gyurix
aeb679a898 Add condition to check for upgrade-framework.json before starting webserver
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-09 09:39:59 +02:00
2 changed files with 63 additions and 39 deletions

View File

@@ -3,7 +3,7 @@
cd /scripts
DEBUG_MODE=${DEBUG_MODE:-false}
VERSION="1.1.1"
VERSION="1.1.5"
#DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-registry.format.hu}
DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-safebox}
@@ -103,6 +103,7 @@ $VOLUME_MOUNTS \
--env SETUP_VERSION=$SETUP_VERSION \
--env GLOBAL_VERSION=$GLOBAL_VERSION \
--env HOST_FILE=$HOST_FILE \
-w /etc/user/config/services/ \
$SET_DEBUG_MODE \
$DOCKER_REGISTRY_ENVS \
$DOCKER_REGISTRY_URL$SETUP:$SETUP_VERSION"
@@ -142,20 +143,38 @@ generate_backup_server_secrets () {
echo '{
"backupserver":{
"SSH_HOST":"'$SSH_HOST'",
"SSH_USER":"'$SSH_USER'",
"SSH_PORT":"'$SSH_PORT'",
"SSH_PASSWORD":"'$SSH_PASSWORD'",
"PASSWORD":"'$PASSWORD'",
"BACKUP_PASSWORD":"'$BACKUP_PASSWORD'",
"PERIOD":"'$PERIOD'",
"COMPRESSION":"'$COMPRESSION'",
"DIRECTORIES":"'$DIRECTORIES'",
"SERVICES":"'$SERVICES'",
"BACKUP_LOCAL_CLIENTS":"'$BACKUP_LOCAL_CLIENTS'",
"BACKUP_VPN_CLIENTS":"'$BACKUP_VPN_CLIENTS'"
"SERVICES":"'$SERVICES'"
}
}' | jq -r . > $SECRET_DIR/backup/server/backup.json
}
defaulting_missing_paramaters() {
if [ "$SSH_HOST" == "" ] || [ "$SSH_HOST" == "null" ]; then
SSH_HOST="localhost"
fi
if [ "$SSH_PORT" == "" ] || [ "$SSH_PORT" == "null" ]; then
SSH_PORT="20022"
fi
if [ "$SSH_USER" == "" ] || [ "$SSH_USER" == "null" ]; then
SSH_USER="backup"
fi
if [ "$SSH_PASSWORD" == "" ] || [ "$SSH_PASSWORD" == "null" ]; then
SSH_PASSWORD="backup"
fi
}
create_backup_service () {
ADDITIONAL=""
@@ -224,22 +243,22 @@ create_backup_service () {
backup_set_service() {
local PASSWORD="$1"
local BACKUP_PASSWORD="$1"
local PERIOD="$2"
local COMPRESSION="$3"
local PLANNED_TIME="$(echo "$4" | base64 -d)"
local DIRECTRIES="$5"
local SERVICES="$6"
local BACKUP_LOCAL_CLIENTS="$7"
local BACKUP_VPN_CLIENTS="$8"
local SSH_HOST="$7"
local VPN="$9"
local SSH_PORT="${10:-20022}"
local SSH_USER="${11:-"backup"}"
local SSH_PASSWORD="${12:-"backup"}"
local OPERATION="${13}"
local VPN="$8"
local SSH_PORT="$9"
local SSH_USER="${10}"
local SSH_PASSWORD="${11}"
local OPERATION="${12}"
defaulting_missing_paramaters
if [ "$OPERATION" == "DELETE" ]; then
@@ -293,12 +312,14 @@ backup_set_client() {
local NAME="$1"
local SIZE="$2"
local VPN="$3"
local SSH_PORT="${4:-20022}"
local SSH_USER="${5:-"backup"}"
local SSH_PASSWORD="${6:-"backup"}"
local SSH_PORT="$4"
local SSH_USER="$5"
local SSH_PASSWORD="$6"
local OPERATION="$7"
local VPN_KEY="$8"
defaulting_missing_paramaters
if [ "$OPERATION" == "DELETE" ]; then
# delete service
if [ -f "/etc/user/config/services/service-backup-client-$NAME.json" ]; then
@@ -326,7 +347,7 @@ backup_set_client() {
ADDITIONAL=""
ADDITIONAL='"EXTRA":"--restart=always","PRE_START":[],"DEPEND":[],"CMD": ""'
ENVS='"ENVS": [{"SSH_USER":"'$SSH_USER'"},{"SSH_PORT":"'$SSH_PORT'"},{"SSH_PASSWORD":"'$SSH_PASSWORD'"},{"VPN_CLIENT_KEY":"'$VPN_KEY'"}],'
ENVS='"ENVS":[{"SSH_USER":"'$SSH_USER'"},{"SSH_PORT":"'$SSH_PORT'"},{"SSH_PASSWORD":"'$SSH_PASSWORD'"},{"VPN_CLIENT_KEY":"'$VPN_KEY'"}],'
echo '{
"main": {
@@ -369,6 +390,7 @@ backup_set_client() {
{
"SOURCE": "/etc/user/data/backup/clients/'$NAME'/ssh",
"DEST": "/home/'$SSH_USER'/.ssh",
"TYPE": "rw"
}
],
"POST_START": []
@@ -565,6 +587,9 @@ check_volumes() {
if [ ! -d "/var/tmp/shared" ]; then
/usr/bin/docker volume create SHARED
RET=0
else
rm -rf /var/tmp/shared/input/*
rm -rf /var/tmp/shared/output/*
fi
if [ ! -d "/etc/system/data/" ]; then
@@ -896,6 +921,7 @@ upgrade_scheduler() {
FRAMEWORK_SCHEDULER_NAME="$FRAMEWORK_SCHEDULER_NAME-$(head /dev/urandom | tr -dc '0-9' | head -c 6)"
DOCKER_RUN="/usr/bin/docker run -d \
-w /etc/user/config/services/ \
-v SHARED:/var/tmp/shared \
-v /var/run/docker.sock:/var/run/docker.sock \
-v SYSTEM_DATA:/etc/system/data \
@@ -926,11 +952,14 @@ upgrade() {
debug "$service_exec service-framework.containers.$NAME start info"
$service_exec service-framework.containers.$NAME start info &
else
if ! echo "$NAME" | grep -q '\.'; then
NAME="$NAME.json"
fi
debug "$service_exec $NAME.json stop force"
$service_exec $NAME.json stop force
debug "$service_exec $NAME.json start info"
$service_exec $NAME.json start info &
debug "$service_exec $NAME stop force"
$service_exec $NAME stop force
debug "$service_exec $NAME start info"
$service_exec $NAME start info &
fi
@@ -988,8 +1017,7 @@ execute_task() {
JSON_TARGET=$B64_JSON
elif [ "$TASK_NAME" == "system" ]; then
#SYSTEM_LIST="core-dns.json cron.json domain-local-backend.json firewall-letsencrypt.json firewall-local-backend.json firewall-localloadbalancer-dns.json firewall-localloadbalancer-to-smarthostbackend.json firewall-smarthost-backend-dns.json firewall-smarthost-loadbalancer-dns.json firewall-smarthost-to-backend.json firewall-smarthostloadbalancer-from-publicbackend.json letsencrypt.json local-backend.json local-proxy.json service-framework.json smarthost-proxy-scheduler.json smarthost-proxy.json"
SYSTEM_LIST="core-dns.json cron.json letsencrypt.json local-proxy.json service-framework.json smarthost-proxy-scheduler.json smarthost-proxy.json"
SYSTEM_LIST="core-dns.json cron.json letsencrypt.json local-loadbalancer.json service-framework.json smarthost-proxy-scheduler.json smarthost-proxy.json"
INSTALLED_SERVICES=$(ls /etc/user/config/services/*.json)
SERVICES=""
for SERVICE in $(echo $INSTALLED_SERVICES); do
@@ -1029,7 +1057,7 @@ execute_task() {
JSON_TARGET=$(echo '{ "DATE": "'$DATE'", "INSTALL_STATUS": "'$INSTALL_STATUS'", "INSTALLED_SERVICES": {'$SERVICES'} }' | jq -r . | base64 -w0)
elif [ "$TASK_NAME" == "services" ]; then
SYSTEM_LIST="core-dns.json cron.json letsencrypt.json local-proxy.json service-framework.json smarthost-proxy-scheduler.json smarthost-proxy.json"
SYSTEM_LIST="core-dns.json cron.json letsencrypt.json local-loadbalancer.json service-framework.json smarthost-proxy-scheduler.json smarthost-proxy.json"
INSTALLED_SERVICES=$(ls /etc/user/config/services/*.json)
SERVICES=""
for SERVICE in $(echo $INSTALLED_SERVICES); do
@@ -1317,7 +1345,7 @@ execute_task() {
elif [ "$TASK_TYPE" == "backup_set_service" ]; then
PASSWORD="$(echo $B64_JSON | base64 -d | jq -r '.BACKUP_SERVER_PASSWORD')"
BACKUP_PASSWORD="$(echo $B64_JSON | base64 -d | jq -r '.BACKUP_SERVER_PASSWORD')"
PERIOD="$(echo $B64_JSON | base64 -d | jq -r '.BACKUP_PERIOD')"
COMPRESSION="$(echo $B64_JSON | base64 -d | jq -r '.BACKUP_COMPRESSION')"
PLANNED_TIME="$(echo $B64_JSON | base64 -d | jq -r '.BACKUP_PLANNED_TIME')"
@@ -1326,13 +1354,14 @@ execute_task() {
BACKUP_LOCAL_CLIENTS="$(echo $B64_JSON | base64 -d | jq -r '.BACKUP_LOCAL_CLIENTS')"
BACKUP_VPN_CLIENTS="$(echo $B64_JSON | base64 -d | jq -r '.BACKUP_VPN_CLIENTS')"
VPN="$(echo $B64_JSON | base64 -d | jq -r '.VPN')"
SSH_HOST="$(echo $B64_JSON | base64 -d | jq -r '.SSH_HOST')"
SSH_PORT="$(echo $B64_JSON | base64 -d | jq -r '.SSH_PORT')"
SSH_USER="$(echo $B64_JSON | base64 -d | jq -r '.SSH_USER')"
SSH_PASSWORD="$(echo $B64_JSON | base64 -d | jq -r '.SSH_PASSWORD')"
OPERATION="$(echo $B64_JSON | base64 -d | jq -r '.OPERATION')"
echo "task type is backup_set_service"
backup_set_service "$PASSWORD" "$PERIOD" "$COMPRESSION" "$PLANNED_TIME" "$DIRECTRIES" "$SERVICES" "$BACKUP_LOCAL_CLIENTS" "$BACKUP_VPN_CLIENTS" "$VPN" "$SSH_PORT" "$SSH_USER" "$SSH_PASSWORD" "$OPERATION"
backup_set_service "$BACKUP_PASSWORD" "$PERIOD" "$COMPRESSION" "$PLANNED_TIME" "$DIRECTRIES" "$SERVICES" "$SSH_HOST" "$VPN" "$SSH_PORT" "$SSH_USER" "$SSH_PASSWORD" "$OPERATION"
elif [ "$TASK_TYPE" == "backup_set_client" ]; then
@@ -1370,11 +1399,6 @@ execute_task() {
upgrade webserver
echo "Upgrading framework scheduler..."
echo "Cleaning temporary files..."
rm -rf /var/tmp/shared/input/*
rm -rf /var/tmp/shared/output/*
upgrade_scheduler
echo "Removing old framework scheduler container..."
JSON_TARGET=$(echo '{"DATE":"'$DATE'","STATUS":2,"VERSION":"'$VERSION'"}' | jq -r . | base64 -w0)
@@ -1394,9 +1418,9 @@ execute_task() {
sh /scripts/check_pid.sh "$PID" "$SHARED" "$TASK_NAME-$NAME" "$DATE" "$DEBUG" &
fi
if [ "$TASK_NAME" != "check_vpn" ]; then
debug "JSON_TARGET: $JSON_TARGET"
fi
# if [ "$TASK_NAME" != "check_vpn" ]; then
# debug "JSON_TARGET: $JSON_TARGET"
# fi
if [ "$JSON_TARGET" != "" ]; then
add_json_target
@@ -1508,7 +1532,7 @@ fi
#RS=$(docker ps | grep redis-server)
WS=$(/usr/bin/docker ps | grep -o webserver)
if [ "$WS" == "" ]; then
if [ "$WS" == "" ] && [ ! -f $SHARED/output/upgrade-framework.json ]; then
# START SERVICES
echo "Starting webserver"
$service_exec service-framework.containers.webserver start &

View File

@@ -255,7 +255,7 @@ if [ "$INIT" == "true" ]; then
if [ "$SMARTHOST_PROXY" == "yes" ]; then
$SERVICE_EXEC smarthost-proxy start
$SERVICE_EXEC smarthost-proxy-scheduler start
$SERVICE_EXEC local-proxy start
$SERVICE_EXEC local-loadbalancer start
echo "$INIT_SERVICE_PATH/smarthost-proxy.json" >>$AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/firewall-smarthost-loadbalancer-dns.json" >>$AUTO_START_SERVICES/.init_services
@@ -264,7 +264,7 @@ if [ "$INIT" == "true" ]; then
echo "$INIT_SERVICE_PATH/firewall-smarthost-backend-dns.json" >>$AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/firewall-smarthost-to-backend.json" >>$AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/smarthost-proxy-scheduler.json" >>$AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/local-proxy.json" >>$AUTO_START_SERVICES/.init_services
echo "$INIT_SERVICE_PATH/local-loadbalancer.json" >>$AUTO_START_SERVICES/.init_services
if [ "$LOCAL_BACKEND" == "yes" ]; then
$SERVICE_EXEC local-backend start