2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-08 14:21:05 +00:00

ci: revert shell script functions

This commit is contained in:
Revant Nandgaonkar 2021-11-22 13:22:09 +05:30
parent 91648299ba
commit 1427907a82
2 changed files with 50 additions and 50 deletions

View File

@ -24,53 +24,3 @@ ping_site() {
exit 1
fi
}
check_migration_complete() {
print_group Check migration
container_id=$(docker_compose_with_args ps -q frappe-python)
cmd="docker logs ${container_id} 2>&1 | grep 'Starting gunicorn' || echo ''"
worker_log=$(eval "$cmd")
INCREMENT=0
while [[ ${worker_log} != *"Starting gunicorn"* && ${INCREMENT} -lt 120 ]]; do
sleep 3
((INCREMENT = INCREMENT + 1))
echo "Wait for migration to complete..."
worker_log=$(eval "$cmd")
if [[ ${worker_log} != *"Starting gunicorn"* && ${INCREMENT} -eq 120 ]]; then
echo Migration timeout
docker logs "${container_id}"
exit 1
fi
done
echo Migration Log
docker logs "${container_id}"
}
check_health() {
print_group Loop health check
docker run --name frappe_doctor \
-v "${project_name}_sites-vol:/home/frappe/frappe-bench/sites" \
--network "${project_name}_default" \
frappe/frappe-worker:edge doctor || true
cmd='docker logs frappe_doctor | grep "Health check successful" || echo ""'
doctor_log=$(eval "$cmd")
INCREMENT=0
while [[ -z "${doctor_log}" && ${INCREMENT} -lt 60 ]]; do
sleep 1
((INCREMENT = INCREMENT + 1))
container=$(docker start frappe_doctor)
echo "Restarting ${container}..."
doctor_log=$(eval "$cmd")
if [[ ${INCREMENT} -eq 60 ]]; then
docker logs "${container}"
exit 1
fi
done
}

View File

@ -16,6 +16,56 @@ docker_compose_with_args() {
$@
}
check_migration_complete() {
print_group Check migration
container_id=$(docker_compose_with_args ps -q frappe-python)
cmd="docker logs ${container_id} 2>&1 | grep 'Starting gunicorn' || echo ''"
worker_log=$(eval "$cmd")
INCREMENT=0
while [[ ${worker_log} != *"Starting gunicorn"* && ${INCREMENT} -lt 120 ]]; do
sleep 3
((INCREMENT = INCREMENT + 1))
echo "Wait for migration to complete..."
worker_log=$(eval "$cmd")
if [[ ${worker_log} != *"Starting gunicorn"* && ${INCREMENT} -eq 120 ]]; then
echo Migration timeout
docker logs "${container_id}"
exit 1
fi
done
echo Migration Log
docker logs "${container_id}"
}
check_health() {
print_group Loop health check
docker run --name frappe_doctor \
-v "${project_name}_sites-vol:/home/frappe/frappe-bench/sites" \
--network "${project_name}_default" \
frappe/frappe-worker:edge doctor || true
cmd='docker logs frappe_doctor | grep "Health check successful" || echo ""'
doctor_log=$(eval "$cmd")
INCREMENT=0
while [[ -z "${doctor_log}" && ${INCREMENT} -lt 60 ]]; do
sleep 1
((INCREMENT = INCREMENT + 1))
container=$(docker start frappe_doctor)
echo "Restarting ${container}..."
doctor_log=$(eval "$cmd")
if [[ ${INCREMENT} -eq 60 ]]; then
docker logs "${container}"
exit 1
fi
done
}
# Initial group
echo ::group::Setup .env
cp env-example .env