forked from freeleaps/freeleaps-pub
Update for fix use local component default value change when bash 3 issue fixing
This commit is contained in:
parent
bf5138c3b2
commit
a3ebe70dac
@ -37,6 +37,7 @@ get_arg() {
|
||||
local key="$1"
|
||||
local default="${2:-}"
|
||||
local i
|
||||
|
||||
for i in "${!args_keys[@]}"; do
|
||||
if [ "${args_keys[$i]}" = "$key" ]; then
|
||||
echo "${args_values[$i]}"
|
||||
@ -203,7 +204,7 @@ devbox_init_usage() {
|
||||
|
||||
# :flag.usage devsvc image tag
|
||||
printf " %s\n" "--devsvc-image-tag DEVSVC_IMAGE_TAG"
|
||||
printf " Specifies the image tag for devsvc component. (Optional, default=latest)\n"
|
||||
printf " Specifies the image tag for devsvc component. (Optional, default=latest-)\n"
|
||||
printf " %s\n" "Default: latest"
|
||||
echo
|
||||
|
||||
@ -688,7 +689,6 @@ check_docker_running() {
|
||||
|
||||
start_local_mongodb() {
|
||||
echo "==> Starting MongoDB service..."
|
||||
echo "Step 3. [INFO] Starting MongoDB container..."
|
||||
|
||||
MONGO_CONTAINER_NAME="freeleaps2-mongodb"
|
||||
MONGO_IMAGE="mongo:latest"
|
||||
@ -1068,7 +1068,7 @@ devbox_init_command() {
|
||||
# 6. linbwang: pull and start other components
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
echo "==> [INIT] Starting Freeleaps services... $USE_LOCAL_COMPONENT"
|
||||
echo "==> [INIT] Starting Freeleaps services... Use Local component $USE_LOCAL_COMPONENT"
|
||||
|
||||
if [[ "$(lower "$USE_LOCAL_COMPONENT")" == "true" ]]; then
|
||||
# 3.Create and start MongoDB container
|
||||
@ -1078,6 +1078,7 @@ if [[ "$(lower "$USE_LOCAL_COMPONENT")" == "true" ]]; then
|
||||
|
||||
# 4. Pull and start RabbitMQ container
|
||||
start_local_rabbitMQ
|
||||
|
||||
echo ' ===> Using local components for Freeleaps services.'
|
||||
|
||||
# Local components for Freeleaps services (devsvc, payment, content, central_storage, authentication)
|
||||
@ -1111,7 +1112,6 @@ if [[ "$(lower "$USE_LOCAL_COMPONENT")" == "true" ]]; then
|
||||
component_full_image="${!COMPONENT_REPO}/${!COMPONENT_IMAGE}:${!COMPONENT_TAG}"
|
||||
fi
|
||||
|
||||
|
||||
echo "==> Pulling ${component} image: $component_full_image"
|
||||
if ! docker pull "$component_full_image"; then
|
||||
echo "WARNING: Failed to pull ${component} image: $component_full_image, please Check the image and specify it to initialize the component."
|
||||
@ -1154,9 +1154,6 @@ if [[ "$(lower "$USE_LOCAL_COMPONENT")" == "true" ]]; then
|
||||
|
||||
echo "${component} container created: $component_container_id"
|
||||
done
|
||||
|
||||
|
||||
|
||||
else
|
||||
echo '============================================'
|
||||
echo ' ===> Using online components for Freeleaps services.'
|
||||
@ -1172,6 +1169,8 @@ if [ ! -d $WORKING_HOME/freeleaps ]; then
|
||||
git clone --depth 5 $FRONTEND_GIT_URL
|
||||
else
|
||||
pushd $WORKING_HOME/freeleaps
|
||||
pwd
|
||||
ls -la
|
||||
echo "Git pulling freeleaps.com:3443/products/freeleaps.git"
|
||||
git pull
|
||||
fi
|
||||
@ -1247,16 +1246,6 @@ fi
|
||||
|
||||
source /home/.devbox/freeleaps/apps/.env
|
||||
|
||||
# Echo the environment variables
|
||||
echo "==================================================="
|
||||
echo "Environment variables:"
|
||||
echo " MONGODB_NAME=\$MONGODB_NAME"
|
||||
echo " MONGODB_URI=\$MONGODB_URI"
|
||||
echo " RABBITMQ_HOST=\$RABBITMQ_HOST"
|
||||
echo " RABBITMQ_PORT=\$RABBITMQ_PORT"
|
||||
echo " FREELEAPS_DEVSVC_ENDPOINT=\$FREELEAPS_DEVSVC_ENDPOINT"
|
||||
echo "==================================================="
|
||||
|
||||
# Ensure /home/.devbox/logs exists
|
||||
mkdir -p /home/.devbox/logs
|
||||
|
||||
@ -1418,7 +1407,7 @@ EOF
|
||||
echo "DevBox init completed successfully!"
|
||||
echo " DevBox container ID: $container_id"
|
||||
[[ -f "${WORKING_HOME}/.devbox-instance" ]] && echo " devbox container ID: $(cat "${WORKING_HOME}/.devbox-instance")"
|
||||
echo " Repository cloned to: $repo_dir"
|
||||
echo " Repository cloned to: $WORKING_HOME/freeleaps"
|
||||
echo " Backend logs: $WORKING_HOME/logs/backend.logs"
|
||||
echo " Frontend logs: $WORKING_HOME/logs/frontend.logs"
|
||||
echo " Backend PID: $WORKING_HOME/.backend.pid"
|
||||
@ -1435,8 +1424,9 @@ devbox_deinit_command() {
|
||||
# src/deinit_command.sh
|
||||
echo "# It contains the implementation for the 'devbox deinit' command."
|
||||
local WORKING_HOME="$(get_arg '--working-home' "${HOME}/.devbox")"
|
||||
local CLEAR_LOGS="$(get_arg '--clear-logs' 'false')"
|
||||
local CLEAR_REPO="$(get_arg '--clear-repo' 'false')"
|
||||
local CLEAR_LOGS="$(get_arg '--clear-logs')"
|
||||
local CLEAR_REPO="$(get_arg '--clear-repo')"
|
||||
|
||||
local FORCE="$(get_arg '--force')"
|
||||
|
||||
# print the parameters
|
||||
@ -1464,7 +1454,7 @@ devbox_deinit_command() {
|
||||
echo "==> Skipping repository deletion."
|
||||
fi
|
||||
|
||||
# 停止并删除容器等
|
||||
# Stop and remove DevBox container
|
||||
if [[ -f "$WORKING_HOME/.devbox-instance" ]]; then
|
||||
local container_id
|
||||
container_id=$(cat "$WORKING_HOME/.devbox-instance")
|
||||
@ -1472,8 +1462,49 @@ devbox_deinit_command() {
|
||||
docker stop "$container_id" &>/dev/null || true
|
||||
docker rm "$container_id" &>/dev/null || true
|
||||
rm -f "$WORKING_HOME/.devbox-instance"
|
||||
|
||||
# Remove the frontend and backend ports if the file exists
|
||||
rm -f "$WORKING_HOME/.devbox-frontend-port"
|
||||
rm -f "$WORKING_HOME/.devbox-backend-port"
|
||||
|
||||
# Remove the backend and frontend process IDs
|
||||
rm -f "$WORKING_HOME/.backend.pid"
|
||||
rm -f "$WORKING_HOME/.frontend.pid"
|
||||
fi
|
||||
|
||||
# Stop and remove MongoDB container
|
||||
if [[ -f "$WORKING_HOME/.mongodb-instance" ]]; then
|
||||
local mongodb_container_id
|
||||
mongodb_container_id=$(cat "$WORKING_HOME/.mongodb-instance")
|
||||
echo "==> Stopping and removing MongoDB container: $mongodb_container_id"
|
||||
docker stop "$mongodb_container_id" &>/dev/null || true
|
||||
docker rm "$mongodb_container_id" &>/dev/null || true
|
||||
rm -f "$WORKING_HOME/.mongodb-instance"
|
||||
fi
|
||||
|
||||
# Stop and remove RabbitMQ container
|
||||
if [[ -f "$WORKING_HOME/.rabbitmq-instance" ]]; then
|
||||
local rabbitmq_container_id
|
||||
rabbitmq_container_id=$(cat "$WORKING_HOME/.rabbitmq-instance")
|
||||
echo "==> Stopping and removing RabbitMQ container: $rabbitmq_container_id"
|
||||
docker stop "$rabbitmq_container_id" &>/dev/null || true
|
||||
docker rm "$rabbitmq_container_id" &>/dev/null || true
|
||||
rm -f "$WORKING_HOME/.rabbitmq-instance"
|
||||
fi
|
||||
|
||||
# Stop and remove other components
|
||||
local components=("devsvc" "payment" "content" "central_storage" "authentication")
|
||||
for component in "${components[@]}"; do
|
||||
if [[ -f "$WORKING_HOME/.${component}-instance" ]]; then
|
||||
local component_container_id
|
||||
component_container_id=$(cat "$WORKING_HOME/.${component}-instance")
|
||||
echo "==> Stopping and removing ${component} container: $component_container_id"
|
||||
docker stop "$component_container_id" &>/dev/null || true
|
||||
docker rm "$component_container_id" &>/dev/null || true
|
||||
rm -f "$WORKING_HOME/.${component}-instance"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "==> DevBox deinitialization completed."
|
||||
}
|
||||
|
||||
@ -2750,7 +2781,7 @@ devbox_init_parse_requirements() {
|
||||
fi
|
||||
|
||||
if [ -z "$(get_arg '--use-local-component')" ]; then
|
||||
add_arg '--use-local-component' "true"
|
||||
add_arg '--use-local-component' "false"
|
||||
fi
|
||||
|
||||
|
||||
@ -2846,7 +2877,7 @@ devbox_deinit_parse_requirements() {
|
||||
add_arg '--working-home' "${HOME}/.devbox"
|
||||
fi
|
||||
if [ -z "$(get_arg '--clear-logs')" ]; then
|
||||
add_arg '--clear-logs' "true"
|
||||
add_arg '--clear-logs' "false"
|
||||
fi
|
||||
if [ -z "$(get_arg '--clear-repo')" ]; then
|
||||
add_arg '--clear-repo' "false"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user