diff --git a/devbox/devbox.local/devbox b/devbox/devbox.local/devbox index 6d77294..bb82fbe 100644 --- a/devbox/devbox.local/devbox +++ b/devbox/devbox.local/devbox @@ -792,6 +792,11 @@ devbox_init_command() { local is_pull_all_components=true local components=("devsvc" "notification" "content" "central_storage" "authentication") 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..." for component in "${components[@]}"; do @@ -832,6 +837,7 @@ devbox_init_command() { fi done + # If is_pull_all_components is true, then pull all components if [[ "$is_pull_all_components" == true ]]; then start_components=("${components[@]}") @@ -1071,11 +1077,8 @@ else echo ' ===> Using online components for Freeleaps services.' echo '============================================' # Start Gitea, MongoDB, RabbitMQ containers - local_components_docker_compose_output=$(docker-compose -f docker-compose.dev.arm64.new.yaml up -d mongodb rabbitmq) - if [[ -z "$local_components_docker_compose_output" ]]; then - echo "ERROR: Failed to start MongoDB, RabbitMQ containers." - exit 1 - fi + docker-compose -f docker-compose.dev.arm64.new.yaml up -d mongodb rabbitmq + echo "===> start components is $start_components" # Save MongoDB and RabbitMQ container ids to .mongodb-instance and .rabbitmq-instance mongo_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-mongodb\$") @@ -1085,6 +1088,15 @@ else echo "$rabbitmq_container_id" > "$WORKING_HOME/.rabbitmq-instance" 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 echo "$USE_LOCAL_COMPONENT" > "$WORKING_HOME/.use-local-component"