Merge pull request 'fix(devbox): fix the requirement import' (#2) from devbox_fix into master

Reviewed-on: freeleaps/freeleaps-pub#2
This commit is contained in:
jingyao1991 2025-05-01 02:26:29 +00:00
commit 7d48c3442a

View File

@ -52,7 +52,6 @@ exit_with_message() {
exit $code
}
detect_os() {
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "darwin"
@ -65,7 +64,6 @@ detect_os() {
fi
}
# Add a key-value pair to the args array
add_arg() {
local key="$1"
@ -91,7 +89,6 @@ get_arg() {
return 1
}
devbox_init_guidance() {
printf "Welcome to DevBox CLI!\n\n"
# if $1 is empty, then ask user select a choice or match user input $1 action to be product_id
@ -231,7 +228,6 @@ devbox_usage() {
echo
}
# :command.usage
devbox_init_usage() {
if [[ -n $long_usage ]]; then
@ -440,7 +436,7 @@ inspect_args() {
for key in $sorted_keys; do
value=""
# Find the value based on the key
for i in `seq 0 $((${#args_keys[@]} - 1))`; do
for i in $(seq 0 $((${#args_keys[@]} - 1))); do
if [ "${args_keys[$i]}" = "$key" ]; then
value="${args_values[$i]}"
break
@ -459,7 +455,7 @@ inspect_args() {
log_info "deps:"
for key in $sorted_keys; do
value=""
for i in `seq 0 $((${#deps_keys[@]} - 1))`; do
for i in $(seq 0 $((${#deps_keys[@]} - 1))); do
if [ "${deps_keys[$i]}" = "$key" ]; then
value="${deps_values[$i]}"
break
@ -481,7 +477,6 @@ inspect_args() {
fi
}
install_docker() {
log_info "Installing Docker..."
@ -633,21 +628,18 @@ build_local_image() {
fi
}
# used for repository username and password encoding
url_encode() {
echo "$1" | sed 's/@/%40/g'
}
###############################################
# Initialize the development environment
###############################################
init_compile_env() {
# Update for export environments []
docker exec -i "$DEVBOX_NAME" bash <<EOF
# Update for export environments []
docker exec -i "$DEVBOX_NAME" bash <<EOF
echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Starting DevBox initialization..."
# Export environment variables
@ -908,23 +900,22 @@ EOF
}
###############################################
# Backend compilation and startup logic
###############################################
compile_backend_service() {
echo "[BACKEND] $(date '+%Y-%m-%d %H:%M:%S') Start backend service at home path $WORKING_HOME."
echo "[BACKEND] $(date '+%Y-%m-%d %H:%M:%S') Start backend service at home path $WORKING_HOME."
devbox_container_id_file_path="${WORKING_HOME}/.devbox-instance"
DEVBOX_NAME=$(cat "$devbox_container_id_file_path")
devbox_container_id_file_path="${WORKING_HOME}/.devbox-instance"
DEVBOX_NAME=$(cat "$devbox_container_id_file_path")
devbox_backend_port_file_path="${WORKING_HOME}/.devbox-backend-port"
DEVBOX_BACKEND_PORT=$(cat "$devbox_backend_port_file_path")
devbox_backend_port_file_path="${WORKING_HOME}/.devbox-backend-port"
DEVBOX_BACKEND_PORT=$(cat "$devbox_backend_port_file_path")
echo "[BACKEND] $(date '+%Y-%m-%d %H:%M:%S') Start backend service from $DEVBOX_NAME."
echo "[BACKEND] $(date '+%Y-%m-%d %H:%M:%S') Start backend service from $DEVBOX_NAME."
docker exec -i "$DEVBOX_NAME" bash <<EOF
docker exec -i "$DEVBOX_NAME" bash <<EOF
# Check if /home/devbox/.backend.pid exits
if [ -f /home/devbox/.backend.pid ]; then
backend_pid=\$(cat /home/devbox/.backend.pid)
@ -997,7 +988,7 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
# Check if it's the first time by verifying if the backend dependencies have been installed
if [ ! -f "/home/devbox/.backend_deps_installed" ]; then
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Install backend dependencies..."
pip install -r /home/devbox/freeleaps/apps/requirements.txt
pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
if ! pip show async_timeout; then
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') async_timeout is missing. Installing..."
pip install async_timeout
@ -1007,10 +998,10 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
mkdir -p /home/devbox/tmp
## Backup the requirements.txt file
cp /home/devbox/freeleaps/apps/requirements.txt /home/devbox/tmp/requirements.txt.bak
cp /home/devbox/freeleaps/apps/freeleaps/requirements.txt /home/devbox/tmp/requirements.txt.bak
ORIGINAL_REQ="/home/devbox/freeleaps/apps/requirements.txt"
ORIGINAL_REQ="/home/devbox/freeleaps/apps/freeleaps/requirements.txt"
NEW_REQ="/home/devbox/tmp/requirements.txt"
# Check if /home/devbox/tmp/requirements.txt exists, if yes, remove it
@ -1043,11 +1034,11 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
if [ \$IS_NEW_REQ_ADDED -eq 1 ]; then
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Reinstalling dependencies..."
pip install -r /home/devbox/freeleaps/apps/requirements.txt
pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
fi
# Undo update for /home/devbox/freeleaps/apps/requirements.txt
rm /home/devbox/freeleaps/apps/requirements.txt
mv /home/devbox/tmp/requirements.txt.bak /home/devbox/freeleaps/apps/requirements.txt
rm /home/devbox/freeleaps/apps/freeleaps/requirements.txt
mv /home/devbox/tmp/requirements.txt.bak /home/devbox/freeleaps/apps/freeleaps/requirements.txt
touch /home/devbox/.backend_deps_installed
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Run backend service..."
@ -1057,7 +1048,7 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
# Check if all dependencies are installed, if not, install them
if ! pip check; then
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Some dependencies are missing. Reinstalling..."
pip install -r /home/devbox/freeleaps/apps/requirements.txt
pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
fi
# pip install async_timeout if not installed
@ -1071,7 +1062,7 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
mkdir -p /home/devbox/tmp
## Backup the requirements.txt file
cp /home/devbox/freeleaps/apps/requirements.txt /home/devbox/tmp/requirements.txt.bak
cp /home/devbox/freeleaps/apps/freeleaps/requirements.txt /home/devbox/tmp/requirements.txt.bak
ORIGINAL_REQ="/home/devbox/freeleaps/apps/requirements.txt"
@ -1107,8 +1098,8 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
fi
# Undo update for /home/devbox/freeleaps/apps/requirements.txt
rm /home/devbox/freeleaps/apps/requirements.txt
mv /home/devbox/tmp/requirements.txt.bak /home/devbox/freeleaps/apps/requirements.txt
rm /home/devbox/freeleaps/apps/freeleaps/requirements.txt
mv /home/devbox/tmp/requirements.txt.bak /home/devbox/freeleaps/apps/freeleaps/requirements.txt
# Check if the backend service is already running
SERVICE_API_ACCESS_PORT=\$(cat /home/devbox/.devbox-backend-port)
@ -1179,21 +1170,21 @@ EOF
# Frontend compilation and startup logic
###############################################
compile_frontend_service() {
echo "[FRONTEND] $(date '+%Y-%m-%d %H:%M:%S') start frontend service at home path $WORKING_HOME."
echo "[FRONTEND] $(date '+%Y-%m-%d %H:%M:%S') start frontend service at home path $WORKING_HOME."
devbox_container_id_file_path="${WORKING_HOME}/.devbox-instance"
if [ ! -f "$devbox_container_id_file_path" ]; then
devbox_container_id_file_path="${WORKING_HOME}/.devbox-instance"
if [ ! -f "$devbox_container_id_file_path" ]; then
# Check if devbox container exists by checking the container name of devbox
if ! docker ps -a --format "{{.Names}}" | grep -q "devbox"; then
exit_with_message "DevBox container is not running. Please start the DevBox container first." 1
fi
fi
fi
DEVBOX_NAME=$(cat "$devbox_container_id_file_path")
DEVBOX_NAME=$(cat "$devbox_container_id_file_path")
DEVBOX_NGINX_HOST_PORT=$(cat "$WORKING_HOME/.devbox-nginx-port") # Nginx Host Port
DEVBOX_NGINX_HOST_PORT=$(cat "$WORKING_HOME/.devbox-nginx-port") # Nginx Host Port
docker exec -i "$DEVBOX_NAME" bash <<EOF
docker exec -i "$DEVBOX_NAME" bash <<EOF
# Check if Nginx or frontend process is already running
nginx_running=false
@ -1764,7 +1755,6 @@ devbox_init_command() {
sudo apt-get install docker-compose -y
fi
# 3.2 Check disk space
local free_space_kb
free_space_kb="$(df -Pk "$HOME" | awk 'END{print $4}')"
@ -1788,10 +1778,10 @@ devbox_init_command() {
echo
read -p "DevBox instance already exists. Do you want to force remove it? (y/N): " ans
case "$ans" in
[Yy]* )
[Yy]*)
FORCE_INIT=true
;;
* )
*)
exit_with_message "DevBox instance already exists. Use --force to remove it." 1
;;
esac
@ -1810,11 +1800,11 @@ devbox_init_command() {
echo
read -p "Container '$comp' is already running. Do you want to force update it? (y/N): " ans
case "$ans" in
[Yy]* )
[Yy]*)
FORCE_INIT=true
break
;;
* )
*)
exit_with_message " Container '$comp' is already running. Use --force to override." 1
;;
esac
@ -1870,8 +1860,6 @@ devbox_init_command() {
fi
fi
local devbox_full_image="${DEVBOX_REPO}/${DEVBOX_IMAGE}:${DEVBOX_TAG}"
# Check local and remote version. User doesn't need to rebuild devbox if local version is consistent with remote version
@ -1988,10 +1976,10 @@ devbox_init_command() {
fi
# record container id, DEVBOX_FRONTEND_PORT, DEVBOX_BACKEND_PORT
echo "$container_id" > "$WORKING_HOME/.devbox-instance"
echo "$DEVBOX_FRONTEND_PORT" > "$WORKING_HOME/.devbox-frontend-port"
echo "$DEVBOX_BACKEND_PORT" > "$WORKING_HOME/.devbox-backend-port"
echo "$DEVBOX_NGINX_PORT" > "$WORKING_HOME/.devbox-nginx-port"
echo "$container_id" >"$WORKING_HOME/.devbox-instance"
echo "$DEVBOX_FRONTEND_PORT" >"$WORKING_HOME/.devbox-frontend-port"
echo "$DEVBOX_BACKEND_PORT" >"$WORKING_HOME/.devbox-backend-port"
echo "$DEVBOX_NGINX_PORT" >"$WORKING_HOME/.devbox-nginx-port"
DOVBOX_CLI_DIR=$(pwd)
@ -2011,25 +1999,25 @@ devbox_init_command() {
FRONTEND_GIT_URL="https://$ENCODEING_FREELEAPS_USERNAME:$ENCODEING_FREELEAPS_PASSWORD@gitea.freeleaps.mathmast.com/products/freeleaps.git"
# Check if freeleaps2-frontend exists, if not git clone it
if [ ! -d "$FREELEAPS_DIR" ]; then
pushd "$WORKING_HOME" > /dev/null
pushd "$WORKING_HOME" >/dev/null
log_info "Git cloning gitea.freeleaps.mathmast.com/products/freeleaps.git to $FREELEAPS_DIR"
git clone --depth 5 $FRONTEND_GIT_URL
# Checkout the specified branch
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
pushd "$FREELEAPS_DIR" > /dev/null
pushd "$FREELEAPS_DIR" >/dev/null
log_info "Checking out branch: $GIT_BRANCH"
if ! git checkout $GIT_BRANCH; then
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
git checkout main
fi
popd > /dev/null
popd >/dev/null
fi
else
pushd "$FREELEAPS_DIR" > /dev/null
pushd "$FREELEAPS_DIR" >/dev/null
# Check $WORKING_HOME/freeleaps exists and it is a git repository, if not git clone it
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
popd > /dev/null # Exit from $FREELEAPS_DIR
popd >/dev/null # Exit from $FREELEAPS_DIR
rm -rf "$FREELEAPS_DIR" # Remove $FREELEAPS_DIR
rmdir "$FREELEAPS_DIR" # Remove $FREELEAPS_DIR
@ -2043,13 +2031,13 @@ devbox_init_command() {
# Checkout the specified branch
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
pushd "$FREELEAPS_DIR" > /dev/null
pushd "$FREELEAPS_DIR" >/dev/null
log_info "Checking out branch: $GIT_BRANCH"
if ! git checkout $GIT_BRANCH; then
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
git checkout main
fi
popd > /dev/null
popd >/dev/null
fi
else
log_info "Git pulling gitea.freeleaps.mathmast.com/products/freeleaps.git"
@ -2074,7 +2062,7 @@ devbox_init_command() {
fi
fi
popd > /dev/null
popd >/dev/null
fi
else
@ -2094,25 +2082,25 @@ devbox_init_command() {
CUSTOM_FOLDER_NAME=$(basename "$USE_CUSTOM_REPOSITORY" .git)
CUSTOM_DIR="$WORKING_HOME/$CUSTOM_FOLDER_NAME"
if [ ! -d "$CUSTOM_DIR" ]; then
pushd "$WORKING_HOME" > /dev/null
pushd "$WORKING_HOME" >/dev/null
log_info "Git cloning custom repository: $ECHO_USE_CUSTOM_REPOSITORY"
git clone --depth 5 "$USE_CUSTOM_REPOSITORY"
# Checkout the specified branch
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
pushd "$CUSTOM_DIR" > /dev/null
pushd "$CUSTOM_DIR" >/dev/null
log_info "Checking out branch: $GIT_BRANCH"
if ! git checkout $GIT_BRANCH; then
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
git checkout main
fi
popd > /dev/null
popd >/dev/null
fi
else
pushd "$CUSTOM_DIR" > /dev/null
pushd "$CUSTOM_DIR" >/dev/null
# Check $WORKING_HOME/custom exists and it is a git repository, if not git clone it
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
popd > /dev/null # Exit from $CUSTOM_DIR
popd >/dev/null # Exit from $CUSTOM_DIR
rm -rf "$CUSTOM_DIR" # Remove $CUSTOM_DIR
rmdir "$CUSTOM_DIR" # Remove $CUSTOM_DIR
@ -2126,13 +2114,13 @@ devbox_init_command() {
# Checkout the specified branch
if [[ -n "$GIT_BRANCH" && "$GIT_BRANCH" != "main" ]]; then
pushd "$CUSTOM_DIR" > /dev/null
pushd "$CUSTOM_DIR" >/dev/null
log_info "Checking out branch: $GIT_BRANCH"
if ! git checkout $GIT_BRANCH; then
log_warn "Failed to checkout branch $GIT_BRANCH, falling back to main branch"
git checkout main
fi
popd > /dev/null
popd >/dev/null
fi
else
log_info "Git pulling custom repository"
@ -2152,30 +2140,28 @@ devbox_init_command() {
fi
fi
popd > /dev/null
popd >/dev/null
fi
fi
pushd $DOVBOX_CLI_DIR > /dev/null
pushd $DOVBOX_CLI_DIR >/dev/null
# -------------------------------------------------------------------
# 6. linbwang: pull and start other components
# -------------------------------------------------------------------
log_info "[INIT] Starting Freeleaps services... Use Local component $USE_LOCAL_COMPONENT_VAL"
log_info "[INIT] Starting Freeleaps services... Use Local component $USE_LOCAL_COMPONENT_VAL"
export ARCH="$ARCH"
export WORKING_HOME="$WORKING_HOME"
export ARCH="$ARCH"
export WORKING_HOME="$WORKING_HOME"
# Save $USE_CUSTOM_REPOSITORY url to .custom-repository file
echo "$USE_CUSTOM_REPOSITORY" > "$WORKING_HOME/.custom-repository"
# Save $USE_CUSTOM_REPOSITORY url to .custom-repository file
echo "$USE_CUSTOM_REPOSITORY" >"$WORKING_HOME/.custom-repository"
# If USE_CUSTOM_REPOSITORY is not empty, initialize the custom repository completed
if [[ -n "$USE_CUSTOM_REPOSITORY" ]]; then
# If USE_CUSTOM_REPOSITORY is not empty, initialize the custom repository completed
if [[ -n "$USE_CUSTOM_REPOSITORY" ]]; then
# Remove the ':' and password from USE_CUSTOM_REPOSITORY
echo
echo "==========================================================="
echo
@ -2188,27 +2174,27 @@ if [[ -n "$USE_CUSTOM_REPOSITORY" ]]; then
echo
exit 0
fi
fi
# Check if docker-compose command exists
log_info "Cehck if docker-compose command exists"
# Check if docker-compose is installed
local DC_CMD
if command -v docker-compose >/dev/null 2>&1; then
# Check if docker-compose command exists
log_info "Cehck if docker-compose command exists"
# Check if docker-compose is installed
local DC_CMD
if command -v docker-compose >/dev/null 2>&1; then
DC_CMD="docker-compose"
# 如果没有找到 docker-compose再检查 docker composev2 插件)
elif docker compose version >/dev/null 2>&1; then
# 如果没有找到 docker-compose再检查 docker composev2 插件)
elif docker compose version >/dev/null 2>&1; then
DC_CMD="docker compose"
else
else
DC_CMD=""
log_error "docker-compose is not installed."
fi
if [[ "$DC_CMD" == "" ]]; then
fi
if [[ "$DC_CMD" == "" ]]; then
exit_with_message "Please install docker-compose or docker compose (v2) and try again." 1
fi
fi
# If USE_LOCAL_COMPONENT is true, then use local components
if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
# If USE_LOCAL_COMPONENT is true, then use local components
if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
log_info ' = Using local components for Freeleaps services.'
export DEVSVC_IMAGE_TAG="$component_tag"
@ -2231,7 +2217,6 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
exit_with_message " Failed to extract gitea data backup, please check the backup file." 1
fi
# Copy gitea data to the gitea container
GITEA_HOST_DIR="${WORKING_HOME}/freeleaps2-gitea"
@ -2256,7 +2241,6 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
exit_with_message " Failed to copy gitea data, please check the data directories." 1
fi
mkdir -p ${WORKING_HOME}/logs
# for each component create log directory
@ -2267,7 +2251,6 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
done
# Check if FORCE_INIT is set, if not just docker compose up or docker-compose up --force
# Start Gitea, MongoDB, RabbitMQ and other components containers
log_info "start Gitea, MongoDB, RabbitMQ and other components containers"
@ -2280,22 +2263,21 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
fi
gitea_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-gitea$" --format "{{.ID}}")
echo "$gitea_container_id" > "$WORKING_HOME/.gitea-instance"
echo "$gitea_container_id" >"$WORKING_HOME/.gitea-instance"
mongo_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-mongodb$" --format "{{.ID}}")
echo "$mongo_container_id" > "$WORKING_HOME/.mongodb-instance"
echo "$mongo_container_id" >"$WORKING_HOME/.mongodb-instance"
rabbitmq_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-rabbitmq$" --format "{{.ID}}")
echo "$rabbitmq_container_id" > "$WORKING_HOME/.rabbitmq-instance"
echo "$rabbitmq_container_id" >"$WORKING_HOME/.rabbitmq-instance"
redis_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-redis$" --format "{{.ID}}")
echo "$redis_container_id" > "$WORKING_HOME/.redis-instance"
echo "$redis_container_id" >"$WORKING_HOME/.redis-instance"
# Get all components container ids and save to .component-instance file
for component in "${start_components[@]}"; do
tmp_container_id=$(docker ps --no-trunc -a --filter "name=^$component$" --format "{{.ID}}")
echo "$tmp_container_id" > "$WORKING_HOME/.${component}-instance"
echo "$tmp_container_id" >"$WORKING_HOME/.${component}-instance"
done
log_info "${component} container created: $component_container_id"
@ -2306,7 +2288,7 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
exit_with_message " Failed to start $component container. Please check the logs for more information." 1
fi
done
else
else
echo '============================================================'
log_info 'Using online components for Freeleaps services.'
echo '============================================================'
@ -2321,33 +2303,31 @@ else
# Save MongoDB and RabbitMQ container ids to .mongodb-instance and .rabbitmq-instance
mongo_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-mongodb\$")
echo "$mongo_container_id" > "$WORKING_HOME/.mongodb-instance"
echo "$mongo_container_id" >"$WORKING_HOME/.mongodb-instance"
rabbitmq_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-rabbitmq\$")
echo "$rabbitmq_container_id" > "$WORKING_HOME/.rabbitmq-instance"
echo "$rabbitmq_container_id" >"$WORKING_HOME/.rabbitmq-instance"
redis_container_id=$(docker ps -a --format '{{.Names}}' | grep "^freeleaps2-redis\$")
echo "$redis_container_id" > "$WORKING_HOME/.redis-instance"
fi
echo "$redis_container_id" >"$WORKING_HOME/.redis-instance"
fi
# Save $USE_LOCAL_COMPONENT false/true to $WORKING_HOME/.use-local-component
echo "$USE_LOCAL_COMPONENT" > "$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"
pushd $WORKING_HOME
pushd $WORKING_HOME
IS_START_FRONTEND=false
IS_START_FRONTEND=false
# Make a user input (Y/N) to continue pull freeleaps.com code and start if N then exit
echo
read -p "Do you want to continue to pull freeleaps.com code and start the services? (Y/N): " user_input
echo
# Initialize the compile environment
init_compile_env
# Make a user input (Y/N) to continue pull freeleaps.com code and start if N then exit
echo
read -p "Do you want to continue to pull freeleaps.com code and start the services? (Y/N): " user_input
echo
# Initialize the compile environment
init_compile_env
if [[ "$user_input" == "N" || "$user_input" == "n" ]]; then
if [[ "$user_input" == "N" || "$user_input" == "n" ]]; then
# Echo as init job completed and exit
reset_freeleaps_repo
@ -2360,16 +2340,15 @@ if [[ "$user_input" == "N" || "$user_input" == "n" ]]; then
echo "==========================================================="
echo
exit 0
fi
fi
IS_START_FRONTEND=true
IS_START_FRONTEND=true
# Run banckend service and frontend service in the container
compile_backend_service
compile_frontend_service
# Run banckend service and frontend service in the container
compile_backend_service
compile_frontend_service
reset_freeleaps_repo
reset_freeleaps_repo
# -------------------------------------------------------------------
# 10. Final notification
@ -2393,7 +2372,7 @@ reset_freeleaps_repo
echo
# Save $GIT_BRANCH to .git-branch file
echo "$GIT_BRANCH" > "$WORKING_HOME/.git-branch"
echo "$GIT_BRANCH" >"$WORKING_HOME/.git-branch"
}
# :command.function
@ -2591,7 +2570,6 @@ devbox_deinit_command() {
fi
done
# Clear the DevBox container logs
if [[ "$CLEAR_LOGS" == "true" ]]; then
log_info "Clearing logs in $WORKING_HOME/logs..."
@ -2787,8 +2765,6 @@ devbox_start_command() {
fi
done
# Check if $FREELEAPS_ENDPOINT is not empty and start the frontend and backend services
if [[ "$FREELEAPS_ENDPOINT" != "" ]]; then
# Sleep for 10 seconds to allow the services to start and echo 10 seconds increase from 1 to 10 in each second
@ -2892,7 +2868,6 @@ devbox_stop_command() {
stoped_freeleaps_service_names+=("backend")
fi
# Combine the stoped_freeleaps_service_names array to a string with "and" if there are more than one service
if [[ "${#stoped_freeleaps_service_names[@]}" -gt 1 ]]; then
stoped_freeleaps_service_names="frontend and backend"
@ -2900,12 +2875,10 @@ devbox_stop_command() {
stoped_freeleaps_service_names="${stoped_freeleaps_service_names[0]}"
fi
exit_message="Stopped Freeleaps $stoped_freeleaps_service_names services successfully."
exit_with_message "$exit_message" 0
fi
# If the DevBox container is not running, exit
if [[ -z "$COMPONENT" ]]; then
COMPONENTS=("mongodb" "rabbitmq" "gitea" "redis" "devbox")
@ -2972,7 +2945,6 @@ devbox_stop_command() {
fi
done
exit_with_message "Stopped Freeleaps services successfully. " 0
}
@ -3204,7 +3176,6 @@ devbox_restart_command() {
fi
done
exit_with_message " DevBox services restarted successfully." 0
}
@ -3327,7 +3298,6 @@ parse_requirements() {
}
# :command.parse_requirements
devbox_init_parse_requirements() {
# :command.fixed_flags_filter
@ -3564,7 +3534,7 @@ devbox_init_parse_requirements() {
detected_arch=$(uname -m)
if [ "$detected_arch" = "x86_64" ]; then
current_arch="amd64"
elif [ "$detected_arch" = "aarch64" ] || [ "$detected_arch" = "arm64" ] ; then
elif [ "$detected_arch" = "aarch64" ] || [ "$detected_arch" = "arm64" ]; then
current_arch="arm64"
else
echo "ERROR: Unsupported architecture detected: $detected_arch"
@ -3574,7 +3544,6 @@ devbox_init_parse_requirements() {
add_arg '--arch' "$current_arch"
fi
if [ -z "$(get_arg '--devbox-container-name')" ]; then
add_arg '--devbox-container-name' "devbox"
fi
@ -3623,7 +3592,6 @@ devbox_init_parse_requirements() {
fi
}
# :command.parse_requirements
devbox_deinit_parse_requirements() {
# :command.fixed_flags_filter
@ -3748,7 +3716,6 @@ devbox_start_parse_requirements() {
exit
;;
*)
break
;;
@ -3924,7 +3891,6 @@ devbox_status_parse_requirements() {
fi
;;
-?*)
printf "invalid option: %s\n" "$key" >&2
exit 1