38 Commits
1.1.0 ... 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
e40b900750 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-08 09:43:21 +00:00
ae83abef53 upgrade STATUS
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-08 09:35:12 +00:00
0e05eaa531 version fix
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-08 09:01:06 +00:00
gyurix
8c345020f7 Refactor debug mode handling in entrypoint script for improved clarity
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 16:48:26 +02:00
gyurix
10a6bc704c Enhance entrypoint script with debug mode and Docker registry environment variables
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 16:45:46 +02:00
gyurix
ba921a53a2 Log the Docker run command in the entrypoint script for debugging purposes
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 16:38:25 +02:00
gyurix
7bb96a1863 Add support for Docker registry credentials in entrypoint script
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 16:27:39 +02:00
gyurix
d0f65b8841 Add Docker registry login functionality to entrypoint script
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 16:22:57 +02:00
gyurix
72e14d7199 Check for the existence of JSON file before creating it in add_json_target function
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 16:08:55 +02:00
gyurix
566aed3752 Prevent overwriting existing JSON files in add_json_target function
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 16:06:41 +02:00
3ab1b3ff54 do not create upgrade.json
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 13:49:40 +00:00
dafd8f345a git pull log
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 13:35:52 +00:00
gyurix
56e2f6f05d Silence output of git pull in entrypoint script to reduce log clutter
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 15:28:26 +02:00
gyurix
e343bc2cb5 Enhance entrypoint script to log completion of git pull operation
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 15:07:53 +02:00
gyurix
6d267dfd04 Merge branch 'main' of https://git.format.hu/safebox/framework-scheduler
All checks were successful
continuous-integration/drone/push Build is passing
2025-08-07 13:21:42 +02:00
gyurix
b049833844 Add logging for git pull operation in entrypoint script 2025-08-07 13:21:40 +02:00
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
2 changed files with 131 additions and 74 deletions

View File

@@ -2,14 +2,24 @@
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.5"
#DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-registry.format.hu}
DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-safebox}
DOCKER_REGISTRY_USERNAME=$DOCKER_REGISTRY_USERNAME
DOCKER_REGISTRY_PASSWORD=$DOCKER_REGISTRY_PASSWORD
if [ -n "$DOCKER_REGISTRY_USERNAME" ] && [ -n "$DOCKER_REGISTRY_PASSWORD" ]; then
echo "Logging in to Docker registry $DOCKER_REGISTRY_URL"
echo "$DOCKER_REGISTRY_PASSWORD" | docker login $DOCKER_REGISTRY_URL --username $DOCKER_REGISTRY_USERNAME --password-stdin
DOCKER_REGISTRY_ENVS="--env DOCKER_REGISTRY_USERNAME=$DOCKER_REGISTRY_USERNAME --env DOCKER_REGISTRY_PASSWORD=$DOCKER_REGISTRY_PASSWORD"
else
echo "No Docker registry credentials provided, skipping login."
fi
USER_INIT_PATH=$USER_INIT_PATH
GLOBAL_VERSION=${GLOBAL_VERSION:-latest}
SERVICE_DIR=${SERVICE_DIR:-/etc/user/config/services}
@@ -24,6 +34,14 @@ FRAMEWORK_SCHEDULER_NETWORK_SUBNET=${FRAMEWORK_SCHEDULER_NETWORK_SUBNET:-"172.19
FRAMEWORK_SCHEDULER_VERSION=${FRAMEWORK_SCHEDULER_VERSION:-latest}
RUN_FORCE=${RUN_FORCE:-false}
if [ "$DEBUG_MODE" == "true" ]; then
DOCKER_START="--entrypoint=sh $DOCKER_REGISTRY_URL/$FRAMEWORK_SCHEDULER_IMAGE:$FRAMEWORK_SCHEDULER_VERSION -c 'sleep 86400'"
SET_DEBUG_MODE="--env DEBUG_MODE=true"
else
DOCKER_START="$DOCKER_REGISTRY_URL/$FRAMEWORK_SCHEDULER_IMAGE:$FRAMEWORK_SCHEDULER_VERSION"
SET_DEBUG_MODE=""
fi
WEB_SERVER=${WEB_SERVER:-webserver}
WEB_IMAGE=${WEB_IMAGE:-web-installer}
WEBSERVER_PORT=${WEBSERVER_PORT:-8080}
@@ -85,6 +103,9 @@ $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"
DEBUG=1
@@ -104,7 +125,9 @@ add_json_target(){
TASK="upgrade-$TASK_NAME"
fi
install -m 664 -g 65534 /dev/null $SHARED/output/$TASK.json
if [ ! -f $SHARED/output/$TASK.json ]; then
install -m 664 -g 65534 /dev/null $SHARED/output/$TASK.json
fi
echo $JSON_TARGET | base64 -d >$SHARED/output/$TASK.json
}
@@ -116,20 +139,40 @@ backup_query_state() {
generate_backup_server_secrets () {
mkdir -p $SECRET_DIR/backup/server
echo '{
"backupserver":{
"SSH_HOST":"'$SSH_HOST'",
"SSH_USER":"'$SSH_USER'",
"SSH_PORT":"'$SSH_PORT'",
"SSH_PASSWORD":"'$SSH_PASSWORD'"
"PASSWORD":"'$PASSWORD'",
"SSH_PASSWORD":"'$SSH_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 . > /etc/user/secret/backup/server/backup.json
}' | 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 () {
@@ -157,7 +200,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 +225,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
@@ -199,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}"
local SSH_USER="${11}"
local SSH_PASSWORD="${12}"
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
@@ -274,6 +318,8 @@ backup_set_client() {
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
@@ -301,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": {
@@ -323,7 +369,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,12 +384,12 @@ backup_set_client() {
"VOLUMES":[
{
"SOURCE": "/etc/user/data/backup/clients/'$NAME'/backup",
"DEST": "/backup",
"DEST": "/home/'$SSH_USER'/backup",
"TYPE": "rw"
},
{
"SOURCE": "/etc/user/data/backup/clients/'$NAME'/ssh",
"DEST": "/home/'$SSH_USER'/",
"DEST": "/home/'$SSH_USER'/.ssh",
"TYPE": "rw"
}
],
@@ -352,8 +398,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 +558,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
@@ -520,7 +570,8 @@ get_repositories() {
GIT_HTTP_CONNECT_TIMEOUT=10 GIT_HTTP_TIMEOUT=30 git clone $REPO /tmp/$BASE >/dev/null
else
cd /tmp/$BASE
GIT_HTTP_CONNECT_TIMEOUT=10 GIT_HTTP_TIMEOUT=30 git pull >/dev/null
date >> /tmp/pull.log
GIT_HTTP_CONNECT_TIMEOUT=10 GIT_HTTP_TIMEOUT=30 git pull >> /tmp/pull.log
fi
if [ -f "/tmp/$BASE/applications-tree.json" ]; then
TREES=$TREES" /tmp/$BASE/applications-tree.json"
@@ -536,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
@@ -864,17 +918,10 @@ upgrade_scheduler() {
debug "Upgrading framework scheduler..."
/usr/bin/docker pull "$DOCKER_REGISTRY_URL/$FRAMEWORK_SCHEDULER_IMAGE:$FRAMEWORK_SCHEDULER_VERSION"
if [ "$DEBUG_MODE" == "true" ]; then
DOCKER_START="--entrypoint=sh $DOCKER_REGISTRY_URL/$FRAMEWORK_SCHEDULER_IMAGE:$FRAMEWORK_SCHEDULER_VERSION -c 'sleep 86400'"
SET_DEBUG_MODE="--env DEBUG_MODE=true"
else
DOCKER_START="$DOCKER_REGISTRY_URL/$FRAMEWORK_SCHEDULER_IMAGE:$FRAMEWORK_SCHEDULER_VERSION"
SET_DEBUG_MODE=""
fi
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 \
@@ -885,12 +932,14 @@ upgrade_scheduler() {
-v USER_SECRET:/etc/user/secret \
--restart=always \
--name $FRAMEWORK_SCHEDULER_NAME \
$DOCKER_REGISTRY_ENVS \
$SET_DEBUG_MODE \
--env WEBSERVER_PORT=$WEBSERVER_PORT \
--network $FRAMEWORK_SCHEDULER_NETWORK \
--env RUN_FORCE=$RUN_FORCE \
--env DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL \
$DOCKER_START"
echo "DOCKER RUN: $DOCKER_RUN"
eval "$DOCKER_RUN"
}
@@ -903,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
@@ -965,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
@@ -1006,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
@@ -1242,15 +1293,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)
@@ -1292,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')"
@@ -1301,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
@@ -1339,24 +1393,21 @@ execute_task() {
JSON="$(echo $B64_JSON | base64 -d)"
NAME=$(echo "$JSON" | jq -r .NAME | awk '{print tolower($0)}')
if [ "$NAME" == "framework" ]; then
JSON_TARGET=$(echo '{"DATE":"'$DATE'","INSTALL_STATUS":0}' | jq -r . | base64 -w0)
JSON_TARGET=$(echo '{"DATE":"'$DATE'","STATUS":1}' | jq -r . | base64 -w0)
add_json_target $NAME
echo "Upgrading service: webserver"
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'","INSTALL_STATUS":1,"VERSION":'$VERSION'}' | jq -r . | base64 -w0)
JSON_TARGET=$(echo '{"DATE":"'$DATE'","STATUS":2,"VERSION":"'$VERSION'"}' | jq -r . | base64 -w0)
add_json_target $NAME
sleep 1
/usr/bin/docker rm -f $HOSTNAME
JSON_TARGET="" # do not create upgrade.json
#CONTAINERS=$(docker ps -a --format '{{.Names}} {{.Status}}' | grep -E 'framework-scheduler|webserver')
else
echo "Upgrading service: $NAME"
@@ -1367,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
@@ -1481,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 &
@@ -1496,7 +1547,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 |

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