refactor: style as per google style guide (tried)
- https://google.github.io/styleguide/
This commit is contained in:
parent
7f26399ebc
commit
e6a5209001
@ -1,36 +1,36 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function configureEnv() {
|
function configureEnv() {
|
||||||
if [ ! -f /home/frappe/frappe-bench/sites/common_site_config.json ]; then
|
if [[ ! -f /home/frappe/frappe-bench/sites/common_site_config.json ]]; then
|
||||||
|
|
||||||
if [[ -z "$MARIADB_HOST" ]]; then
|
if [[ -z "${MARIADB_HOST}" ]]; then
|
||||||
if [[ -z "$POSTGRES_HOST" ]]; then
|
if [[ -z "${POSTGRES_HOST}" ]]; then
|
||||||
echo "MARIADB_HOST or POSTGRES_HOST is not set"
|
echo "MARIADB_HOST or POSTGRES_HOST is not set"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$REDIS_CACHE" ]]; then
|
if [[ -z "${REDIS_CACHE}" ]]; then
|
||||||
echo "REDIS_CACHE is not set"
|
echo "REDIS_CACHE is not set"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$REDIS_QUEUE" ]]; then
|
if [[ -z "${REDIS_QUEUE}" ]]; then
|
||||||
echo "REDIS_QUEUE is not set"
|
echo "REDIS_QUEUE is not set"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$REDIS_SOCKETIO" ]]; then
|
if [[ -z "${REDIS_SOCKETIO}" ]]; then
|
||||||
echo "REDIS_SOCKETIO is not set"
|
echo "REDIS_SOCKETIO is not set"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$SOCKETIO_PORT" ]]; then
|
if [[ -z "${SOCKETIO_PORT}" ]]; then
|
||||||
echo "SOCKETIO_PORT is not set"
|
echo "SOCKETIO_PORT is not set"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$DB_PORT" ]]; then
|
if [[ -z "${DB_PORT}" ]]; then
|
||||||
export DB_PORT=3306
|
export DB_PORT=3306
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -46,16 +46,16 @@ function configureEnv() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkConnection() {
|
function checkConnection() {
|
||||||
. /home/frappe/frappe-bench/env/bin/activate \
|
. /home/frappe/frappe-bench/env/bin/activate
|
||||||
&& python /home/frappe/frappe-bench/commands/check_connection.py
|
python /home/frappe/frappe-bench/commands/check_connection.py
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkConfigExists() {
|
function checkConfigExists() {
|
||||||
COUNTER=0
|
COUNTER=0
|
||||||
while [[ ! -e /home/frappe/frappe-bench/sites/common_site_config.json ]] && [[ $COUNTER -le 30 ]] ; do
|
while [[ ! -e /home/frappe/frappe-bench/sites/common_site_config.json ]] && [[ ${COUNTER} -le 30 ]]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
((COUNTER = COUNTER + 1))
|
((COUNTER = COUNTER + 1))
|
||||||
echo "config file not created, retry $COUNTER"
|
echo "config file not created, retry ${COUNTER}"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ! -e /home/frappe/frappe-bench/sites/common_site_config.json ]]; then
|
if [[ ! -e /home/frappe/frappe-bench/sites/common_site_config.json ]]; then
|
||||||
@ -72,42 +72,42 @@ fi
|
|||||||
ln -sfn /home/frappe/frappe-bench/sites/assets/frappe/node_modules \
|
ln -sfn /home/frappe/frappe-bench/sites/assets/frappe/node_modules \
|
||||||
/home/frappe/frappe-bench/apps/frappe/node_modules
|
/home/frappe/frappe-bench/apps/frappe/node_modules
|
||||||
|
|
||||||
if [ "$1" = 'start' ]; then
|
if [[ "$1" == 'start' ]]; then
|
||||||
configureEnv
|
configureEnv
|
||||||
checkConnection
|
checkConnection
|
||||||
|
|
||||||
if [[ -z "$WORKERS" ]]; then
|
if [[ -z "${WORKERS}" ]]; then
|
||||||
export WORKERS=2
|
export WORKERS=2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$FRAPPE_PORT" ]]; then
|
if [[ -z "${FRAPPE_PORT}" ]]; then
|
||||||
export FRAPPE_PORT=8000
|
export FRAPPE_PORT=8000
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$WORKER_CLASS" ]]; then
|
if [[ -z "${WORKER_CLASS}" ]]; then
|
||||||
export WORKER_CLASS=gthread
|
export WORKER_CLASS=gthread
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export LOAD_CONFIG_FILE=""
|
export LOAD_CONFIG_FILE=""
|
||||||
if [ "$WORKER_CLASS" = "gevent" ]; then
|
if [ "${WORKER_CLASS}" = "gevent" ]; then
|
||||||
export LOAD_CONFIG_FILE="-c /home/frappe/frappe-bench/commands/gevent_patch.py"
|
export LOAD_CONFIG_FILE="-c /home/frappe/frappe-bench/commands/gevent_patch.py"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$AUTO_MIGRATE" ]]; then
|
if [[ ! -z "${AUTO_MIGRATE}" ]]; then
|
||||||
. /home/frappe/frappe-bench/env/bin/activate \
|
. /home/frappe/frappe-bench/env/bin/activate
|
||||||
&& python /home/frappe/frappe-bench/commands/auto_migrate.py
|
python /home/frappe/frappe-bench/commands/auto_migrate.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. /home/frappe/frappe-bench/env/bin/activate
|
. /home/frappe/frappe-bench/env/bin/activate
|
||||||
gunicorn $LOAD_CONFIG_FILE -b 0.0.0.0:$FRAPPE_PORT \
|
gunicorn ${LOAD_CONFIG_FILE} -b 0.0.0.0:${FRAPPE_PORT} \
|
||||||
--worker-tmp-dir /dev/shm \
|
--worker-tmp-dir /dev/shm \
|
||||||
--threads=4 \
|
--threads=4 \
|
||||||
--workers $WORKERS \
|
--workers ${WORKERS} \
|
||||||
--worker-class=$WORKER_CLASS \
|
--worker-class=${WORKER_CLASS} \
|
||||||
--log-file=- \
|
--log-file=- \
|
||||||
-t 120 frappe.app:application --preload
|
-t 120 frappe.app:application --preload
|
||||||
|
|
||||||
elif [ "$1" = 'worker' ]; then
|
elif [[ "$1" == 'worker' ]]; then
|
||||||
checkConfigExists
|
checkConfigExists
|
||||||
checkConnection
|
checkConnection
|
||||||
# default WORKER_TYPE=default
|
# default WORKER_TYPE=default
|
||||||
@ -115,14 +115,14 @@ elif [ "$1" = 'worker' ]; then
|
|||||||
. /home/frappe/frappe-bench/env/bin/activate
|
. /home/frappe/frappe-bench/env/bin/activate
|
||||||
python /home/frappe/frappe-bench/commands/worker.py
|
python /home/frappe/frappe-bench/commands/worker.py
|
||||||
|
|
||||||
elif [ "$1" = 'schedule' ]; then
|
elif [[ "$1" == 'schedule' ]]; then
|
||||||
checkConfigExists
|
checkConfigExists
|
||||||
checkConnection
|
checkConnection
|
||||||
|
|
||||||
. /home/frappe/frappe-bench/env/bin/activate
|
. /home/frappe/frappe-bench/env/bin/activate
|
||||||
python /home/frappe/frappe-bench/commands/background.py
|
python /home/frappe/frappe-bench/commands/background.py
|
||||||
|
|
||||||
elif [ "$1" = 'new' ]; then
|
elif [[ "$1" == 'new' ]]; then
|
||||||
checkConfigExists
|
checkConfigExists
|
||||||
checkConnection
|
checkConnection
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ elif [ "$1" = 'new' ]; then
|
|||||||
python /home/frappe/frappe-bench/commands/new.py
|
python /home/frappe/frappe-bench/commands/new.py
|
||||||
exit
|
exit
|
||||||
|
|
||||||
elif [ "$1" = 'drop' ]; then
|
elif [[ "$1" == 'drop' ]]; then
|
||||||
checkConfigExists
|
checkConfigExists
|
||||||
checkConnection
|
checkConnection
|
||||||
|
|
||||||
@ -138,25 +138,25 @@ elif [ "$1" = 'drop' ]; then
|
|||||||
python /home/frappe/frappe-bench/commands/drop.py
|
python /home/frappe/frappe-bench/commands/drop.py
|
||||||
exit
|
exit
|
||||||
|
|
||||||
elif [ "$1" = 'migrate' ]; then
|
elif [[ "$1" = 'migrate' ]]; then
|
||||||
|
|
||||||
. /home/frappe/frappe-bench/env/bin/activate \
|
. /home/frappe/frappe-bench/env/bin/activate
|
||||||
&& python /home/frappe/frappe-bench/commands/migrate.py
|
python /home/frappe/frappe-bench/commands/migrate.py
|
||||||
exit
|
exit
|
||||||
|
|
||||||
elif [ "$1" = 'doctor' ]; then
|
elif [[ "$1" == 'doctor' ]]; then
|
||||||
|
|
||||||
. /home/frappe/frappe-bench/env/bin/activate \
|
. /home/frappe/frappe-bench/env/bin/activate
|
||||||
&& python /home/frappe/frappe-bench/commands/doctor.py ${@:2}
|
python /home/frappe/frappe-bench/commands/doctor.py ${@:2}
|
||||||
exit
|
exit
|
||||||
|
|
||||||
elif [ "$1" = 'backup' ]; then
|
elif [[ "$1" == 'backup' ]]; then
|
||||||
|
|
||||||
. /home/frappe/frappe-bench/env/bin/activate
|
. /home/frappe/frappe-bench/env/bin/activate
|
||||||
python /home/frappe/frappe-bench/commands/backup.py
|
python /home/frappe/frappe-bench/commands/backup.py
|
||||||
exit
|
exit
|
||||||
|
|
||||||
elif [ "$1" = 'console' ]; then
|
elif [[ "$1" == 'console' ]]; then
|
||||||
|
|
||||||
if [[ -z "$2" ]]; then
|
if [[ -z "$2" ]]; then
|
||||||
echo "Need to specify a sitename with the command:"
|
echo "Need to specify a sitename with the command:"
|
||||||
@ -168,20 +168,19 @@ elif [ "$1" = 'console' ]; then
|
|||||||
python /home/frappe/frappe-bench/commands/console.py "$2"
|
python /home/frappe/frappe-bench/commands/console.py "$2"
|
||||||
exit
|
exit
|
||||||
|
|
||||||
elif [ "$1" = 'push-backup' ]; then
|
elif [[ "$1" = 'push-backup' ]]; then
|
||||||
|
|
||||||
. /home/frappe/frappe-bench/env/bin/activate \
|
. /home/frappe/frappe-bench/env/bin/activate
|
||||||
&& python /home/frappe/frappe-bench/commands/push_backup.py
|
python /home/frappe/frappe-bench/commands/push_backup.py
|
||||||
exit
|
exit
|
||||||
|
|
||||||
elif [ "$1" = 'restore-backup' ]; then
|
elif [[ "$1" = 'restore-backup' ]]; then
|
||||||
|
|
||||||
. /home/frappe/frappe-bench/env/bin/activate \
|
. /home/frappe/frappe-bench/env/bin/activate
|
||||||
&& python /home/frappe/frappe-bench/commands/restore_backup.py
|
python /home/frappe/frappe-bench/commands/restore_backup.py
|
||||||
exit
|
exit
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
exec $@
|
exec $@
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -39,7 +39,7 @@ wait-for-it "$REDIS_QUEUE" -t 1
|
|||||||
echo "Check $REDIS_SOCKETIO"
|
echo "Check $REDIS_SOCKETIO"
|
||||||
wait-for-it "$REDIS_SOCKETIO" -t 1
|
wait-for-it "$REDIS_SOCKETIO" -t 1
|
||||||
|
|
||||||
if [[ "$1" = "-p" ]] || [[ "$1" = "--ping-service" ]]; then
|
if [[ "$1" = "-p" || "$1" = "--ping-service" ]]; then
|
||||||
echo "Check $2"
|
echo "Check $2"
|
||||||
wait-for-it "$2" -t 1
|
wait-for-it "$2" -t 1
|
||||||
fi
|
fi
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash -e
|
||||||
|
|
||||||
function checkConfigExists() {
|
function checkConfigExists() {
|
||||||
COUNTER=0
|
COUNTER=0
|
||||||
while [[ ! -e /home/frappe/frappe-bench/sites/common_site_config.json ]] && [[ $COUNTER -le 30 ]] ; do
|
while [[ ! -e /home/frappe/frappe-bench/sites/common_site_config.json && ${COUNTER} -le 30 ]]; do
|
||||||
|
((COUNTER = COUNTER + 1))
|
||||||
|
echo "config file not created, retry ${COUNTER}"
|
||||||
sleep 1
|
sleep 1
|
||||||
let COUNTER=COUNTER+1
|
|
||||||
echo "config file not created, retry $COUNTER"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ! -e /home/frappe/frappe-bench/sites/common_site_config.json ]]; then
|
if [[ ! -e /home/frappe/frappe-bench/sites/common_site_config.json ]]; then
|
||||||
@ -14,16 +14,14 @@ function checkConfigExists() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = 'start' ]; then
|
if [[ "$1" == 'start' ]]; then
|
||||||
checkConfigExists
|
checkConfigExists
|
||||||
node /home/frappe/frappe-bench/apps/frappe/socketio.js
|
node /home/frappe/frappe-bench/apps/frappe/socketio.js
|
||||||
|
|
||||||
elif [ "$1" = 'doctor' ]; then
|
elif [[ "$1" == 'doctor' ]]; then
|
||||||
|
|
||||||
node /home/frappe/frappe-bench/apps/frappe/health.js
|
node /home/frappe/frappe-bench/apps/frappe/health.js
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
exec -c "$@"
|
exec -c "$@"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
ULINE='\e[1m\e[4m'
|
||||||
|
ENDULINE='\e[0m'
|
||||||
|
NEWLINE='\n'
|
||||||
|
|
||||||
function checkMigrationComplete() {
|
function checkMigrationComplete() {
|
||||||
echo "Check Migration"
|
echo "Check Migration"
|
||||||
@ -9,21 +12,21 @@ function checkMigrationComplete() {
|
|||||||
-f installation/erpnext-publish.yml \
|
-f installation/erpnext-publish.yml \
|
||||||
ps -q erpnext-python)
|
ps -q erpnext-python)
|
||||||
|
|
||||||
DOCKER_LOG=$(docker logs $CONTAINER_ID 2>&1 | grep "Starting gunicorn")
|
DOCKER_LOG=$(docker logs ${CONTAINER_ID} 2>&1 | grep "Starting gunicorn")
|
||||||
INCREMENT=0
|
INCREMENT=0
|
||||||
while [[ $DOCKER_LOG != *"Starting gunicorn"* && $INCREMENT -lt 60 ]]; do
|
while [[ ${DOCKER_LOG} != *"Starting gunicorn"* && ${INCREMENT} -lt 60 ]]; do
|
||||||
sleep 3
|
sleep 3
|
||||||
echo "Wait for migration to complete ..."
|
echo "Wait for migration to complete ..."
|
||||||
((INCREMENT = INCREMENT + 1))
|
((INCREMENT = INCREMENT + 1))
|
||||||
DOCKER_LOG=$(docker logs $CONTAINER_ID 2>&1 | grep "Starting gunicorn")
|
DOCKER_LOG=$(docker logs ${CONTAINER_ID} 2>&1 | grep "Starting gunicorn")
|
||||||
if [[ $DOCKER_LOG != *"Starting gunicorn"* && $INCREMENT -eq 60 ]]; then
|
if [[ ${DOCKER_LOG} != *"Starting gunicorn"* && ${INCREMENT} -eq 60 ]]; then
|
||||||
docker logs $CONTAINER_ID
|
docker logs ${CONTAINER_ID}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -e "\e[4mMigration Log\e[0m"
|
echo -e "${ULINE}Migration Log${ENDULINE}"
|
||||||
docker logs $CONTAINER_ID
|
docker logs ${CONTAINER_ID}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loopHealthCheck() {
|
function loopHealthCheck() {
|
||||||
@ -35,24 +38,22 @@ function loopHealthCheck() {
|
|||||||
|
|
||||||
echo "Loop Health Check"
|
echo "Loop Health Check"
|
||||||
FRAPPE_LOG=$(docker logs frappe_doctor | grep "Health check successful" || echo "")
|
FRAPPE_LOG=$(docker logs frappe_doctor | grep "Health check successful" || echo "")
|
||||||
while [[ -z "$FRAPPE_LOG" ]]; do
|
while [[ -z "${FRAPPE_LOG}" ]]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
CONTAINER=$(docker start frappe_doctor)
|
CONTAINER=$(docker start frappe_doctor)
|
||||||
echo "Restarting $CONTAINER ..."
|
echo "Restarting ${CONTAINER} ..."
|
||||||
FRAPPE_LOG=$(docker logs frappe_doctor | grep "Health check successful" || echo "")
|
FRAPPE_LOG=$(docker logs frappe_doctor | grep "Health check successful" || echo "")
|
||||||
done
|
done
|
||||||
echo "Health check successful"
|
echo "Health check successful"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCopy env-example file\e[0m"
|
echo -e "${ULINE}Copy env-example file${ENDULINE}"
|
||||||
cp env-example .env
|
cp env-example .env
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mSet version to v13\e[0m"
|
echo -e "${NEWLINE}${ULINE}Set version to v13${ENDULINE}"
|
||||||
sed -i -e "s/edge/v13/g" .env
|
sed -i -e "s/edge/v13/g" .env
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mStart Services\e[0m"
|
echo -e "${NEWLINE}${ULINE}Start Services${ENDULINE}"
|
||||||
docker-compose \
|
docker-compose \
|
||||||
--project-name frappebench00 \
|
--project-name frappebench00 \
|
||||||
-f installation/docker-compose-common.yml \
|
-f installation/docker-compose-common.yml \
|
||||||
@ -74,30 +75,25 @@ docker run --name postgresql -d \
|
|||||||
postgres:11.8
|
postgres:11.8
|
||||||
|
|
||||||
loopHealthCheck
|
loopHealthCheck
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCreate new site (v13)\e[0m"
|
echo -e "${NEWLINE}${ULINE}Create new site (v13)${ENDULINE}"
|
||||||
docker run -it \
|
docker run -it \
|
||||||
-e "SITE_NAME=test.localhost" \
|
-e "SITE_NAME=test.localhost" \
|
||||||
-e "INSTALL_APPS=erpnext" \
|
-e "INSTALL_APPS=erpnext" \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
frappe/erpnext-worker:v13 new
|
frappe/erpnext-worker:v13 new
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mPing created site\e[0m"
|
echo -e "${NEWLINE}${ULINE}Ping created site${ENDULINE}"
|
||||||
curl -sS http://test.localhost/api/method/version
|
curl -sS http://test.localhost/api/method/version
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck Created Site Index Page\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check Created Site Index Page${ENDULINE}"
|
||||||
curl -s http://test.localhost | w3m -T text/html -dump
|
curl -s http://test.localhost | w3m -T text/html -dump
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mSet version to edge\e[0m"
|
echo -e "${NEWLINE}${ULINE}Set version to edge${ENDULINE}"
|
||||||
sed -i -e "s/v13/edge/g" .env
|
sed -i -e "s/v13/edge/g" .env
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mRestart containers with edge image\e[0m"
|
echo -e "${NEWLINE}${ULINE}Restart containers with edge image${ENDULINE}"
|
||||||
docker-compose \
|
docker-compose \
|
||||||
--project-name frappebench00 \
|
--project-name frappebench00 \
|
||||||
-f installation/docker-compose-common.yml \
|
-f installation/docker-compose-common.yml \
|
||||||
@ -112,18 +108,17 @@ docker-compose \
|
|||||||
up -d
|
up -d
|
||||||
|
|
||||||
checkMigrationComplete
|
checkMigrationComplete
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mPing migrated site\e[0m"
|
echo -e "${NEWLINE}${ULINE}Ping migrated site${ENDULINE}"
|
||||||
sleep 3
|
sleep 3
|
||||||
curl -sS http://test.localhost/api/method/version
|
curl -sS http://test.localhost/api/method/version
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck Migrated Site Index Page\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Check Migrated Site Index Page${ENDULINE}"
|
||||||
curl -s http://test.localhost | w3m -T text/html -dump
|
curl -s http://test.localhost | w3m -T text/html -dump
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCreate new site (pgsql)\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Create new site (pgsql)${ENDULINE}"
|
||||||
docker run -it \
|
docker run -it \
|
||||||
-e "SITE_NAME=pgsql.localhost" \
|
-e "SITE_NAME=pgsql.localhost" \
|
||||||
-e "POSTGRES_HOST=postgresql" \
|
-e "POSTGRES_HOST=postgresql" \
|
||||||
@ -132,96 +127,95 @@ docker run -it \
|
|||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
frappe/erpnext-worker:edge new
|
frappe/erpnext-worker:edge new
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck New PGSQL Site\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Check New PGSQL Site${ENDULINE}"
|
||||||
sleep 3
|
sleep 3
|
||||||
RESTORE_STATUS=$(curl -sS http://pgsql.localhost/api/method/version || echo "")
|
RESTORE_STATUS=$(curl -sS http://pgsql.localhost/api/method/version || echo "")
|
||||||
INCREMENT=0
|
INCREMENT=0
|
||||||
while [[ -z "$RESTORE_STATUS" && $INCREMENT -lt 60 ]]; do
|
while [[ -z "${RESTORE_STATUS}" && ${INCREMENT} -lt 60 ]]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
echo -e "\e[1m\e[4mWait for restoration to complete ..."
|
echo -e "${ULINE}Wait for restoration to complete ..."
|
||||||
RESTORE_STATUS=$(curl -sS http://pgsql.localhost/api/method/version || echo "")
|
RESTORE_STATUS=$(curl -sS http://pgsql.localhost/api/method/version || echo "")
|
||||||
((INCREMENT = INCREMENT + 1))
|
((INCREMENT = INCREMENT + 1))
|
||||||
if [[ -z "$RESTORE_STATUS" && $INCREMENT -eq 60 ]]; then
|
if [[ -z "${RESTORE_STATUS}" && ${INCREMENT} -eq 60 ]]; then
|
||||||
CONTAINER_ID=$(docker-compose \
|
CONTAINER_ID=$(docker-compose \
|
||||||
--project-name frappebench00 \
|
--project-name frappebench00 \
|
||||||
-f installation/docker-compose-common.yml \
|
-f installation/docker-compose-common.yml \
|
||||||
-f installation/docker-compose-erpnext.yml \
|
-f installation/docker-compose-erpnext.yml \
|
||||||
-f installation/erpnext-publish.yml \
|
-f installation/erpnext-publish.yml \
|
||||||
ps -q erpnext-python)
|
ps -q erpnext-python)
|
||||||
docker logs $CONTAINER_ID
|
docker logs ${CONTAINER_ID}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mPing new pgsql site\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Ping new pgsql site${ENDULINE}"
|
||||||
echo $RESTORE_STATUS
|
echo $RESTORE_STATUS
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck New PGSQL Index Page\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Check New PGSQL Index Page${ENDULINE}"
|
||||||
curl -s http://pgsql.localhost | w3m -T text/html -dump
|
curl -s http://pgsql.localhost | w3m -T text/html -dump
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mBackup site\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Backup site${ENDULINE}"
|
||||||
docker run -it \
|
docker run -it \
|
||||||
-e "WITH_FILES=1" \
|
-e "WITH_FILES=1" \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
frappe/erpnext-worker:edge backup
|
frappe/erpnext-worker:edge backup
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
export MINIO_ACCESS_KEY="AKIAIOSFODNN7EXAMPLE"
|
export MINIO_ACCESS_KEY="AKIAIOSFODNN7EXAMPLE"
|
||||||
export MINIO_SECRET_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
|
export MINIO_SECRET_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mStart MinIO container for s3 compatible storage\e[0m"
|
echo -e "${ULINE}Start MinIO container for s3 compatible storage${ENDULINE}"
|
||||||
docker run -d --name minio \
|
docker run -d --name minio \
|
||||||
-e "MINIO_ACCESS_KEY=$MINIO_ACCESS_KEY" \
|
-e "MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY}" \
|
||||||
-e "MINIO_SECRET_KEY=$MINIO_SECRET_KEY" \
|
-e "MINIO_SECRET_KEY=${MINIO_SECRET_KEY}" \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
minio/minio server /data
|
minio/minio server /data
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCreate bucket named erpnext\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Create bucket named erpnext${ENDULINE}"
|
||||||
docker run \
|
docker run \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
vltgroup/s3cmd:latest s3cmd --access_key=$MINIO_ACCESS_KEY \
|
vltgroup/s3cmd:latest s3cmd --access_key=${MINIO_ACCESS_KEY} \
|
||||||
--secret_key=$MINIO_SECRET_KEY \
|
--secret_key=${MINIO_SECRET_KEY} \
|
||||||
--region=us-east-1 \
|
--region=us-east-1 \
|
||||||
--no-ssl \
|
--no-ssl \
|
||||||
--host=minio:9000 \
|
--host=minio:9000 \
|
||||||
--host-bucket=minio:9000 \
|
--host-bucket=minio:9000 \
|
||||||
mb s3://erpnext
|
mb s3://erpnext
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mPush backup to MinIO s3\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${NEWLINE}${ULINE}Push backup to MinIO s3${ENDULINE}"
|
||||||
docker run \
|
docker run \
|
||||||
-e BUCKET_NAME=erpnext \
|
-e BUCKET_NAME=erpnext \
|
||||||
-e REGION=us-east-1 \
|
-e REGION=us-east-1 \
|
||||||
-e BUCKET_DIR=local \
|
-e BUCKET_DIR=local \
|
||||||
-e ACCESS_KEY_ID=$MINIO_ACCESS_KEY \
|
-e ACCESS_KEY_ID=${MINIO_ACCESS_KEY} \
|
||||||
-e SECRET_ACCESS_KEY=$MINIO_SECRET_KEY \
|
-e SECRET_ACCESS_KEY=${MINIO_SECRET_KEY} \
|
||||||
-e ENDPOINT_URL=http://minio:9000 \
|
-e ENDPOINT_URL=http://minio:9000 \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
frappe/erpnext-worker:edge push-backup
|
frappe/erpnext-worker:edge push-backup
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mStop Services\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Stop Services${ENDULINE}"
|
||||||
docker-compose \
|
docker-compose \
|
||||||
--project-name frappebench00 \
|
--project-name frappebench00 \
|
||||||
-f installation/docker-compose-common.yml \
|
-f installation/docker-compose-common.yml \
|
||||||
-f installation/docker-compose-erpnext.yml \
|
-f installation/docker-compose-erpnext.yml \
|
||||||
-f installation/erpnext-publish.yml \
|
-f installation/erpnext-publish.yml \
|
||||||
stop
|
stop
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mPrune Containers\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Prune Containers${ENDULINE}"
|
||||||
docker container prune -f && docker volume prune -f
|
docker container prune -f && docker volume prune -f
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mStart Services\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Start Services${ENDULINE}"
|
||||||
docker-compose \
|
docker-compose \
|
||||||
--project-name frappebench00 \
|
--project-name frappebench00 \
|
||||||
-f installation/docker-compose-common.yml \
|
-f installation/docker-compose-common.yml \
|
||||||
@ -230,120 +224,112 @@ docker-compose \
|
|||||||
up -d
|
up -d
|
||||||
|
|
||||||
loopHealthCheck
|
loopHealthCheck
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mRestore backup from MinIO / S3\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Restore backup from MinIO / S3${ENDULINE}"
|
||||||
docker run \
|
docker run \
|
||||||
-e MYSQL_ROOT_PASSWORD=admin \
|
-e MYSQL_ROOT_PASSWORD=admin \
|
||||||
-e BUCKET_NAME=erpnext \
|
-e BUCKET_NAME=erpnext \
|
||||||
-e BUCKET_DIR=local \
|
-e BUCKET_DIR=local \
|
||||||
-e ACCESS_KEY_ID=$MINIO_ACCESS_KEY \
|
-e ACCESS_KEY_ID=${MINIO_ACCESS_KEY} \
|
||||||
-e SECRET_ACCESS_KEY=$MINIO_SECRET_KEY \
|
-e SECRET_ACCESS_KEY=${MINIO_SECRET_KEY} \
|
||||||
-e ENDPOINT_URL=http://minio:9000 \
|
-e ENDPOINT_URL=http://minio:9000 \
|
||||||
-e REGION=us-east-1 \
|
-e REGION=us-east-1 \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
frappe/erpnext-worker:edge restore-backup
|
frappe/erpnext-worker:edge restore-backup
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck Restored Site (test)\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check Restored Site (test)${ENDULINE}"
|
||||||
sleep 3
|
sleep 3
|
||||||
RESTORE_STATUS=$(curl -sS http://test.localhost/api/method/version || echo "")
|
RESTORE_STATUS=$(curl -sS http://test.localhost/api/method/version || echo "")
|
||||||
INCREMENT=0
|
INCREMENT=0
|
||||||
while [[ -z "$RESTORE_STATUS" && $INCREMENT -lt 60 ]]; do
|
while [[ -z "${RESTORE_STATUS}" && ${INCREMENT} -lt 60 ]]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
echo "Wait for restoration to complete ..."
|
echo "Wait for restoration to complete ..."
|
||||||
RESTORE_STATUS=$(curl -sS http://test.localhost/api/method/version || echo "")
|
RESTORE_STATUS=$(curl -sS http://test.localhost/api/method/version || echo "")
|
||||||
((INCREMENT = INCREMENT + 1))
|
((INCREMENT = INCREMENT + 1))
|
||||||
if [[ -z "$RESTORE_STATUS" && $INCREMENT -eq 60 ]]; then
|
if [[ -z "${RESTORE_STATUS}" && ${INCREMENT} -eq 60 ]]; then
|
||||||
CONTAINER_ID=$(docker-compose \
|
CONTAINER_ID=$(docker-compose \
|
||||||
--project-name frappebench00 \
|
--project-name frappebench00 \
|
||||||
-f installation/docker-compose-common.yml \
|
-f installation/docker-compose-common.yml \
|
||||||
-f installation/docker-compose-erpnext.yml \
|
-f installation/docker-compose-erpnext.yml \
|
||||||
-f installation/erpnext-publish.yml \
|
-f installation/erpnext-publish.yml \
|
||||||
ps -q erpnext-python)
|
ps -q erpnext-python)
|
||||||
docker logs $CONTAINER_ID
|
docker logs ${CONTAINER_ID}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mPing restored site (test)\e[0m"
|
echo -e "${ULINE}Ping restored site (test)${ENDULINE}"
|
||||||
echo $RESTORE_STATUS
|
echo ${RESTORE_STATUS}
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck Restored Site Index Page (test)\e[0m"
|
|
||||||
|
echo -e "${NEWLINE}${ULINE}Check Restored Site Index Page (test)${ENDULINE}"
|
||||||
curl -s http://test.localhost | w3m -T text/html -dump
|
curl -s http://test.localhost | w3m -T text/html -dump
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck Restored Site (pgsql)\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check Restored Site (pgsql)${ENDULINE}"
|
||||||
sleep 3
|
sleep 3
|
||||||
RESTORE_STATUS=$(curl -sS http://pgsql.localhost/api/method/version || echo "")
|
RESTORE_STATUS=$(curl -sS http://pgsql.localhost/api/method/version || echo "")
|
||||||
INCREMENT=0
|
INCREMENT=0
|
||||||
while [[ -z "$RESTORE_STATUS" && $INCREMENT -lt 60 ]]; do
|
while [[ -z "${RESTORE_STATUS}" && ${INCREMENT} -lt 60 ]]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
echo "Wait for restoration to complete ..."
|
echo "Wait for restoration to complete ..."
|
||||||
RESTORE_STATUS=$(curl -sS http://pgsql.localhost/api/method/version || echo "")
|
RESTORE_STATUS=$(curl -sS http://pgsql.localhost/api/method/version || echo "")
|
||||||
((INCREMENT = INCREMENT + 1))
|
((INCREMENT = INCREMENT + 1))
|
||||||
if [[ -z "$RESTORE_STATUS" && $INCREMENT -eq 60 ]]; then
|
if [[ -z "${RESTORE_STATUS}" && ${INCREMENT} -eq 60 ]]; then
|
||||||
CONTAINER_ID=$(docker-compose \
|
CONTAINER_ID=$(docker-compose \
|
||||||
--project-name frappebench00 \
|
--project-name frappebench00 \
|
||||||
-f installation/docker-compose-common.yml \
|
-f installation/docker-compose-common.yml \
|
||||||
-f installation/docker-compose-erpnext.yml \
|
-f installation/docker-compose-erpnext.yml \
|
||||||
-f installation/erpnext-publish.yml \
|
-f installation/erpnext-publish.yml \
|
||||||
ps -q erpnext-python)
|
ps -q erpnext-python)
|
||||||
docker logs $CONTAINER_ID
|
docker logs ${CONTAINER_ID}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mPing restored site (pgsql)\e[0m"
|
echo -e "${ULINE}Ping restored site (pgsql)${ENDULINE}"
|
||||||
echo $RESTORE_STATUS
|
echo ${RESTORE_STATUS}
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck Restored Site Index Page (pgsql)\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check Restored Site Index Page (pgsql)${ENDULINE}"
|
||||||
curl -s http://pgsql.localhost | w3m -T text/html -dump
|
curl -s http://pgsql.localhost | w3m -T text/html -dump
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCreate new site (edge)\e[0m"
|
echo -e "${NEWLINE}${ULINE}Create new site (edge)${ENDULINE}"
|
||||||
docker run -it \
|
docker run -it \
|
||||||
-e "SITE_NAME=edge.localhost" \
|
-e "SITE_NAME=edge.localhost" \
|
||||||
-e "INSTALL_APPS=erpnext" \
|
-e "INSTALL_APPS=erpnext" \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
frappe/erpnext-worker:edge new
|
frappe/erpnext-worker:edge new
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck New Edge Site\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check New Edge Site${ENDULINE}"
|
||||||
sleep 3
|
sleep 3
|
||||||
RESTORE_STATUS=$(curl -sS http://edge.localhost/api/method/version || echo "")
|
RESTORE_STATUS=$(curl -sS http://edge.localhost/api/method/version || echo "")
|
||||||
INCREMENT=0
|
INCREMENT=0
|
||||||
while [[ -z "$RESTORE_STATUS" && $INCREMENT -lt 60 ]]; do
|
while [[ -z "${RESTORE_STATUS}" && ${INCREMENT} -lt 60 ]]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
echo -e "\e[1m\e[4mWait for restoration to complete ..."
|
echo -e "${ULINE}Wait for restoration to complete ...${ENDULINE}"
|
||||||
RESTORE_STATUS=$(curl -sS http://edge.localhost/api/method/version || echo "")
|
RESTORE_STATUS=$(curl -sS http://edge.localhost/api/method/version || echo "")
|
||||||
((INCREMENT = INCREMENT + 1))
|
((INCREMENT = INCREMENT + 1))
|
||||||
if [[ -z "$RESTORE_STATUS" && $INCREMENT -eq 60 ]]; then
|
if [[ -z "${RESTORE_STATUS}" && ${INCREMENT} -eq 60 ]]; then
|
||||||
CONTAINER_ID=$(docker-compose \
|
CONTAINER_ID=$(docker-compose \
|
||||||
--project-name frappebench00 \
|
--project-name frappebench00 \
|
||||||
-f installation/docker-compose-common.yml \
|
-f installation/docker-compose-common.yml \
|
||||||
-f installation/docker-compose-erpnext.yml \
|
-f installation/docker-compose-erpnext.yml \
|
||||||
-f installation/erpnext-publish.yml \
|
-f installation/erpnext-publish.yml \
|
||||||
ps -q erpnext-python)
|
ps -q erpnext-python)
|
||||||
docker logs $CONTAINER_ID
|
docker logs ${CONTAINER_ID}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mPing new edge site\e[0m"
|
echo -e "${NEWLINE}${ULINE}Ping new edge site${ENDULINE}"
|
||||||
echo $RESTORE_STATUS
|
echo ${RESTORE_STATUS}
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck New Edge Index Page\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check New Edge Index Page${ENDULINE}"
|
||||||
curl -s http://edge.localhost | w3m -T text/html -dump
|
curl -s http://edge.localhost | w3m -T text/html -dump
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mMigrate command in edge container\e[0m"
|
echo -e "${NEWLINE}${ULINE}Migrate command in edge container${ENDULINE}"
|
||||||
docker run -it \
|
docker run -it \
|
||||||
-e "MAINTENANCE_MODE=1" \
|
-e "MAINTENANCE_MODE=1" \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
@ -352,79 +338,74 @@ docker run -it \
|
|||||||
frappe/erpnext-worker:edge migrate
|
frappe/erpnext-worker:edge migrate
|
||||||
|
|
||||||
checkMigrationComplete
|
checkMigrationComplete
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mRestore backup from MinIO / S3 (Overwrite)\e[0m"
|
echo -e "${NEWLINE}${ULINE}Restore backup from MinIO / S3 (Overwrite)${ENDULINE}"
|
||||||
docker run \
|
docker run \
|
||||||
-e MYSQL_ROOT_PASSWORD=admin \
|
-e MYSQL_ROOT_PASSWORD=admin \
|
||||||
-e BUCKET_NAME=erpnext \
|
-e BUCKET_NAME=erpnext \
|
||||||
-e BUCKET_DIR=local \
|
-e BUCKET_DIR=local \
|
||||||
-e ACCESS_KEY_ID=$MINIO_ACCESS_KEY \
|
-e ACCESS_KEY_ID=${MINIO_ACCESS_KEY} \
|
||||||
-e SECRET_ACCESS_KEY=$MINIO_SECRET_KEY \
|
-e SECRET_ACCESS_KEY=${MINIO_SECRET_KEY} \
|
||||||
-e ENDPOINT_URL=http://minio:9000 \
|
-e ENDPOINT_URL=http://minio:9000 \
|
||||||
-e REGION=us-east-1 \
|
-e REGION=us-east-1 \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
frappe/erpnext-worker:edge restore-backup
|
frappe/erpnext-worker:edge restore-backup
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck Overwritten Site\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check Overwritten Site${ENDULINE}"
|
||||||
sleep 3
|
sleep 3
|
||||||
RESTORE_STATUS=$(curl -sS http://test.localhost/api/method/version || echo "")
|
RESTORE_STATUS=$(curl -sS http://test.localhost/api/method/version || echo "")
|
||||||
INCREMENT=0
|
INCREMENT=0
|
||||||
while [[ -z "$RESTORE_STATUS" && $INCREMENT -lt 60 ]]; do
|
while [[ -z "${RESTORE_STATUS}" && ${INCREMENT} -lt 60 ]]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
echo -e "\e[1m\e[4mWait for restoration to complete ..."
|
echo -e "${ULINE}Wait for restoration to complete ..."
|
||||||
RESTORE_STATUS=$(curl -sS http://test.localhost/api/method/version || echo "")
|
RESTORE_STATUS=$(curl -sS http://test.localhost/api/method/version || echo "")
|
||||||
((INCREMENT = INCREMENT + 1))
|
((INCREMENT = INCREMENT + 1))
|
||||||
if [[ -z "$RESTORE_STATUS" && $INCREMENT -eq 60 ]]; then
|
if [[ -z "${RESTORE_STATUS}" && ${INCREMENT} -eq 60 ]]; then
|
||||||
CONTAINER_ID=$(docker-compose \
|
CONTAINER_ID=$(docker-compose \
|
||||||
--project-name frappebench00 \
|
--project-name frappebench00 \
|
||||||
-f installation/docker-compose-common.yml \
|
-f installation/docker-compose-common.yml \
|
||||||
-f installation/docker-compose-erpnext.yml \
|
-f installation/docker-compose-erpnext.yml \
|
||||||
-f installation/erpnext-publish.yml \
|
-f installation/erpnext-publish.yml \
|
||||||
ps -q erpnext-python)
|
ps -q erpnext-python)
|
||||||
docker logs $CONTAINER_ID
|
docker logs ${CONTAINER_ID}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mPing overwritten site\e[0m"
|
echo -e "${NEWLINE}${ULINE}Ping overwritten site${ENDULINE}"
|
||||||
echo $RESTORE_STATUS
|
echo ${RESTORE_STATUS}
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck Overwritten Index Page\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check Overwritten Index Page${ENDULINE}"
|
||||||
curl -s http://test.localhost | w3m -T text/html -dump
|
curl -s http://test.localhost | w3m -T text/html -dump
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck console command for site test.localhost\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check console command for site test.localhost${ENDULINE}"
|
||||||
docker run \
|
docker run \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
frappe/erpnext-worker:edge console test.localhost
|
frappe/erpnext-worker:edge console test.localhost
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck console command for site pgsql.localhost\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check console command for site pgsql.localhost${ENDULINE}"
|
||||||
docker run \
|
docker run \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
frappe/erpnext-worker:edge console pgsql.localhost
|
frappe/erpnext-worker:edge console pgsql.localhost
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck drop site: test.localhost (mariadb)\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check drop site: test.localhost (mariadb)${ENDULINE}"
|
||||||
docker run \
|
docker run \
|
||||||
-e SITE_NAME=test.localhost \
|
-e SITE_NAME=test.localhost \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
frappe/erpnext-worker:edge drop
|
frappe/erpnext-worker:edge drop
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck drop site: pgsql.localhost (pgsql)\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check drop site: pgsql.localhost (pgsql)${ENDULINE}"
|
||||||
docker run \
|
docker run \
|
||||||
-e SITE_NAME=pgsql.localhost \
|
-e SITE_NAME=pgsql.localhost \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
frappe/erpnext-worker:edge drop
|
frappe/erpnext-worker:edge drop
|
||||||
|
|
||||||
echo -e "\e[1m\e[4mCheck bench --help\e[0m"
|
echo -e "${NEWLINE}${ULINE}Check bench --help${ENDULINE}"
|
||||||
docker run \
|
docker run \
|
||||||
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
-v frappebench00_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
--network frappebench00_default \
|
--network frappebench00_default \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user