Update for support chat

This commit is contained in:
Tianyong Qiu 2025-02-28 10:42:39 +08:00
parent 20cfc792b0
commit f9f4811549
3 changed files with 55 additions and 47 deletions

View File

@ -803,7 +803,54 @@ devbox_init_command() {
# 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_BACKEND_PORT" > "$WORKING_HOME/.devbox-backend-port"]
# Check if username and password are set
if [[ -z "$FREELEAPS_USERNAME" || -z "$FREELEAPS_PASSWORD" ]]; then
echo "Warining: Username and password are required to pull freeleaps.com code."
echo "==> [INIT] DevBox environment initialization completed."
exit 1
fi
# Test if the user can access the freeleaps.com repository
echo "==> Testing access to freeleaps.com repository..."
if ! git ls-remote "https://$FREELEAPS_USERNAME:$FREELEAPS_PASSWORD@freeleaps.com:3443/products/freeleaps.git" &>/dev/null; then
echo "ERROR: Failed to access freeleaps.com repository. Please check your username and password."
echo "==> [INIT] DevBox environment initialization completed successfully, but access to the freeleaps.com repository failed."
exit 1
fi
DOVBOX_CLI_DIR=$(pwd)
FREELEAPS_DIR="$WORKING_HOME/freeleaps"
FRONTEND_GIT_URL="https://$FREELEAPS_USERNAME:$FREELEAPS_PASSWORD@freeleaps.com:3443/products/freeleaps.git"
# Check if freeleaps2-frontend exists, if not git clone it
if [ ! -d "$FREELEAPS_DIR" ]; then
pushd "$WORKING_HOME" > /dev/null
echo "Git cloning freeleaps.com:3443/products/freeleaps.git 1"
git clone --depth 5 $FRONTEND_GIT_URL
else
echo "Git pulling 2"
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
rm -rf "$FREELEAPS_DIR" # Remove $FREELEAPS_DIR
rmdir "$FREELEAPS_DIR" # Remove $FREELEAPS_DIR
# Git clone freeleaps.com:3443/products/freeleaps.git
echo "Cloning repository again: $FRONTEND_GIT_URL"
sudo chown -R "$OWNER_GROUP" "$WORKING_HOME"
git clone --depth 5 "$FRONTEND_GIT_URL"
else
echo "Git pulling freeleaps.com:3443/products/freeleaps.git"
git pull
fi
popd > /dev/null
fi
pushd $DOVBOX_CLI_DIR > /dev/null
# -------------------------------------------------------------------
# 6. linbwang: pull and start other components
@ -866,6 +913,8 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
exit 1
fi
# Start Gitea, MongoDB, RabbitMQ and other components containers
echo "===> start Gitea, MongoDB, RabbitMQ and other components containers"
docker-compose -f docker-compose.dev.arm64.new.yaml up -d mongodb rabbitmq gitea "${start_components[@]}"
@ -945,49 +994,6 @@ fi
IS_START_FRONTEND=true
# Check if username and password are set
if [[ -z "$FREELEAPS_USERNAME" || -z "$FREELEAPS_PASSWORD" ]]; then
echo "Warining: Username and password are required to pull freeleaps.com code."
echo "==> [INIT] DevBox environment initialization completed."
exit 1
fi
# Test if the user can access the freeleaps.com repository
echo "==> Testing access to freeleaps.com repository..."
if ! git ls-remote "https://$FREELEAPS_USERNAME:$FREELEAPS_PASSWORD@freeleaps.com:3443/products/freeleaps.git" &>/dev/null; then
echo "ERROR: Failed to access freeleaps.com repository. Please check your username and password."
echo "==> [INIT] DevBox environment initialization completed successfully, but access to the freeleaps.com repository failed."
exit 1
fi
FREELEAPS_DIR="$WORKING_HOME/freeleaps"
FRONTEND_GIT_URL="https://$FREELEAPS_USERNAME:$FREELEAPS_PASSWORD@freeleaps.com:3443/products/freeleaps.git"
# Check if freeleaps2-frontend exists, if not git clone it
if [ ! -d "$FREELEAPS_DIR" ]; then
echo "Git cloning freeleaps.com:3443/products/freeleaps.git"
git clone --depth 5 $FRONTEND_GIT_URL
else
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
rm -rf "$FREELEAPS_DIR" # Remove $FREELEAPS_DIR
ls -la "$WORKING_HOME"
rmdir "$FREELEAPS_DIR" # Remove $FREELEAPS_DIR
ls -la "$WORKING_HOME"
# Git clone freeleaps.com:3443/products/freeleaps.git
echo "Cloning repository again: $FRONTEND_GIT_URL"
sudo chown -R "$OWNER_GROUP" "$WORKING_HOME"
git clone --depth 5 "$FRONTEND_GIT_URL"
else
echo "Git pulling freeleaps.com:3443/products/freeleaps.git"
git pull
fi
popd > /dev/null
fi
# Run banckend service and frontend service in the container
docker exec -i "$DEVBOX_NAME" bash <<EOF

View File

@ -251,8 +251,9 @@ services:
target: /app/log/payment
chat:
container_name: chat
image: freeleaps/chat:${CHAT_IMAGE_TAG:-latest-linux-arm64}
platform: linux/${ARCH:-arm64}
build:
context: ${WORKING_HOME}/freeleaps/apps
dockerfile: ${WORKING_HOME}/freeleaps/apps/chat/Dockerfile
restart: always
depends_on:
- mongodb

@ -0,0 +1 @@
Subproject commit ca58e0b8f9d91c297da64c440b799ff913cb24f2