forked from freeleaps/freeleaps-pub
Update for check component start status when init
This commit is contained in:
parent
137c9936b0
commit
b56dc31882
@ -793,6 +793,11 @@ devbox_init_command() {
|
|||||||
local components=("devsvc" "notification" "content" "central_storage" "authentication")
|
local components=("devsvc" "notification" "content" "central_storage" "authentication")
|
||||||
local start_components=()
|
local start_components=()
|
||||||
|
|
||||||
|
# if use online components, check if any component image repo is specified
|
||||||
|
if [[ "$USE_LOCAL_COMPONENT" == false ]]; then
|
||||||
|
is_pull_all_components=false
|
||||||
|
fi
|
||||||
|
|
||||||
echo "==> Checking parameters..."
|
echo "==> Checking parameters..."
|
||||||
for component in "${components[@]}"; do
|
for component in "${components[@]}"; do
|
||||||
if [[ -n "$(get_arg "--${component}-image-repo")" ]]; then
|
if [[ -n "$(get_arg "--${component}-image-repo")" ]]; then
|
||||||
@ -832,6 +837,7 @@ devbox_init_command() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# If is_pull_all_components is true, then pull all components
|
# If is_pull_all_components is true, then pull all components
|
||||||
if [[ "$is_pull_all_components" == true ]]; then
|
if [[ "$is_pull_all_components" == true ]]; then
|
||||||
start_components=("${components[@]}")
|
start_components=("${components[@]}")
|
||||||
@ -1071,11 +1077,8 @@ else
|
|||||||
echo ' ===> Using online components for Freeleaps services.'
|
echo ' ===> Using online components for Freeleaps services.'
|
||||||
echo '============================================'
|
echo '============================================'
|
||||||
# Start Gitea, MongoDB, RabbitMQ containers
|
# Start Gitea, MongoDB, RabbitMQ containers
|
||||||
local_components_docker_compose_output=$(docker-compose -f docker-compose.dev.arm64.new.yaml up -d mongodb rabbitmq)
|
docker-compose -f docker-compose.dev.arm64.new.yaml up -d mongodb rabbitmq
|
||||||
if [[ -z "$local_components_docker_compose_output" ]]; then
|
echo "===> start components is $start_components"
|
||||||
echo "ERROR: Failed to start MongoDB, RabbitMQ containers."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Save MongoDB and RabbitMQ container ids to .mongodb-instance and .rabbitmq-instance
|
# Save MongoDB and RabbitMQ container ids to .mongodb-instance and .rabbitmq-instance
|
||||||
mongo_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-mongodb\$")
|
mongo_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-mongodb\$")
|
||||||
@ -1085,6 +1088,15 @@ else
|
|||||||
echo "$rabbitmq_container_id" > "$WORKING_HOME/.rabbitmq-instance"
|
echo "$rabbitmq_container_id" > "$WORKING_HOME/.rabbitmq-instance"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check all components are started
|
||||||
|
for component in "${start_components[@]}"; do
|
||||||
|
if [[ -z "$(docker ps -a --format '{{.Names}}' | grep "^$component\$")" ]]; then
|
||||||
|
echo "ERROR: Failed to start $component container."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
# Save $USE_LOCAL_COMPONENT false/true to $WORKING_HOME/.use-local-component
|
# Save $USE_LOCAL_COMPONENT false/true to $WORKING_HOME/.use-local-component
|
||||||
echo "$USE_LOCAL_COMPONENT" > "$WORKING_HOME/.use-local-component"
|
echo "$USE_LOCAL_COMPONENT" > "$WORKING_HOME/.use-local-component"
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user