Update for add chat component in devbox

This commit is contained in:
Tianyong Qiu 2025-02-27 13:44:49 +08:00
parent 570e047205
commit 0d2c4f1a29
2 changed files with 171 additions and 74 deletions

View File

@ -105,6 +105,10 @@ devbox_init_usage() {
printf " --authentication-image-repo -V [Optional] : Specifies the repository for authentication component.\n" printf " --authentication-image-repo -V [Optional] : Specifies the repository for authentication component.\n"
printf " --authentication-image-name -L [Optional] : Specifies the image name for authentication component.\n" printf " --authentication-image-name -L [Optional] : Specifies the image name for authentication component.\n"
printf " --authentication-image-tag -W [Optional] : Specifies the image tag for authentication component. Default: latest.\n" printf " --authentication-image-tag -W [Optional] : Specifies the image tag for authentication component. Default: latest.\n"
printf " --chat-image-repo -B [Optional] : Specifies the repository for chat component.\n"
printf " --chat-image-name -N [Optional] : Specifies the image name for chat component.\n"
printf " --chat-image-tag -T [Optional] : Specifies the image tag for chat component. Default: latest.\n"
printf " --force -f [Optional] : Force initialization even if resources already exist.\n\n" printf " --force -f [Optional] : Force initialization even if resources already exist.\n\n"
printf "Global Arguments\n" printf "Global Arguments\n"
@ -151,8 +155,8 @@ devbox_start_usage() {
printf " devbox start : Start the local development environment based on DevBox container.\n\n" printf " devbox start : Start the local development environment based on DevBox container.\n\n"
printf "Arguments\n" printf "Arguments\n"
printf " --component COMPONENT [Optional] : Specifies the name of the component to start (e.g., mongodb, rabbitmq, backend, frontend, devsvc, content, central_storage, authentication).\n\n" printf " --component COMPONENT [Optional] : Specifies the name of the component to start (e.g., mongodb, rabbitmq, devsvc, content, central_storage, notification, chat, authentication).\n\n"
printf " --freeleaps-endpoint -e [Optional] : Specifies the Freeleaps.com endpoint to start in the DevBox container.\n\n" printf " --freeleaps-endpoint -e [Optional] : Specifies the Freeleaps.com endpoint backend & frontend to start in the DevBox container.\n\n"
printf "Global Arguments\n" printf "Global Arguments\n"
printf " --help, -h : Show this help message and exit.\n\n" printf " --help, -h : Show this help message and exit.\n\n"
@ -174,7 +178,7 @@ devbox_stop_usage() {
printf "Command\n" printf "Command\n"
printf " devbox stop : Stop the local development environment based on DevBox container.\n\n" printf " devbox stop : Stop the local development environment based on DevBox container.\n\n"
printf "Arguments\n" printf "Arguments\n"
printf " --component -c [Optional] : Specifies the name of the component to stop (e.g., mongodb, rabbitmq, devbox, devsvc, content, central_storage, authentication).\n\n" printf " --component -c [Optional] : Specifies the name of the component to stop (e.g., mongodb, rabbitmq, devbox, devsvc, content, central_storage, notification, chat, authentication).\n\n"
printf "Global Arguments\n" printf "Global Arguments\n"
printf " --help -h : Show this help message and exit.\n\n" printf " --help -h : Show this help message and exit.\n\n"
printf "Examples\n" printf "Examples\n"
@ -195,7 +199,7 @@ devbox_status_usage() {
printf " devbox status : Display the status of the local development environment based on DevBox container.\n\n" printf " devbox status : Display the status of the local development environment based on DevBox container.\n\n"
printf "Arguments\n" printf "Arguments\n"
printf " --component -c [Optional] : Specifies the component to show status (e.g., devbox, devsvc, etc.).\n\n" printf " --component -c [Optional] : Specifies the component to show status (e.g., devbox, devsvc, content, central_storage, notification, chat, authentication).\n\n"
printf "Global Arguments\n" printf "Global Arguments\n"
printf " --help -h : Show this help message and exit.\n\n" printf " --help -h : Show this help message and exit.\n\n"
@ -217,9 +221,9 @@ devbox_restart_usage() {
printf "Command\n" printf "Command\n"
printf " devbox restart : Restart the local development environment based on DevBox container.\n\n" printf " devbox restart : Restart the local development environment based on DevBox container.\n\n"
printf "Arguments\n" printf "Arguments\n"
printf " --component -c [Optional] : Specifies the component to restart (e.g., backend, frontend, etc.).\n" printf " --component -c [Optional] : Specifies the component to restart (e.g., devbox, devsvc, content, central_storage, notification, chat, authentication).\n"
printf " --freeleaps-endpoint -e [Optional] : Specifies the Freeleaps.com endpoint to restart in the DevBox container.\n" printf " --freeleaps-endpoint -e [Optional] : Specifies the Freeleaps.com backend & frontend to restart in the DevBox container.\n"
printf " --force -f : Force the restart operation without prompt.\n\n" printf " --force -f [Optional] : Force the restart operation without prompt.\n\n"
printf "Global Arguments\n" printf "Global Arguments\n"
printf " --help -h : Show this help message and exit.\n" printf " --help -h : Show this help message and exit.\n"
printf "Examples\n" printf "Examples\n"
@ -430,8 +434,11 @@ check_docker_running() {
} }
# Define the local components and their corresponding ports # Define the local components and their corresponding ports
local_components_ports_keys=("devsvc" "notification" "content" "central_storage" "authentication") # local_components_ports_keys=("devsvc" "notification" "content" "central_storage" "chat" "authentication")
local_components_ports_values=("8007" "8003" "8013" "8005" "8004")
declare -g local_components_ports_keys=("devsvc" "notification" "content" "central_storage" "chat" "authentication")
local_components_ports_values=("8007" "8003" "8013" "8005" "8012" "8004")
# Get the port number for a local component # Get the port number for a local component
get_port() { get_port() {
@ -494,6 +501,10 @@ devbox_init_command() {
local NOTIFICATION_IMAGE="$args_notification_image_image" # --notification-image-image local NOTIFICATION_IMAGE="$args_notification_image_image" # --notification-image-image
local NOTIFICATION_TAG="$args_notification_image_tag" # --notification-image-tag local NOTIFICATION_TAG="$args_notification_image_tag" # --notification-image-tag
local CHAT_REPO="$args_chat_image_repo" # --chat-image-repo
local CHAT_IMAGE="$args_chat_image_image" # --chat-image-image
local CHAT_TAG="$args_chat_image_tag" # --chat-image-tag
local CUSTOM_GIT_REPO="$args_custom_git_repo" # --custom-git-repo local CUSTOM_GIT_REPO="$args_custom_git_repo" # --custom-git-repo
# --force flag to overwrite existing resources # --force flag to overwrite existing resources
@ -527,12 +538,16 @@ devbox_init_command() {
local NOTIFICATION_REPO="$(get_arg '--notification-image-repo')" local NOTIFICATION_REPO="$(get_arg '--notification-image-repo')"
local NOTIFICATION_IMAGE="$(get_arg '--notification-image-name')" local NOTIFICATION_IMAGE="$(get_arg '--notification-image-name')"
local NOTIFICATION_TAG="$(get_arg '--notification-image-tag')" local NOTIFICATION_TAG="$(get_arg '--notification-image-tag')"
local CHAT_REPO="$(get_arg '--chat-image-repo')"
local CHAT_IMAGE="$(get_arg '--chat-image-name')"
local CHAT_TAG="$(get_arg '--chat-image-tag')"
local CUSTOM_GIT_REPO="$(get_arg '--custom-git-repo')" local CUSTOM_GIT_REPO="$(get_arg '--custom-git-repo')"
local FORCE_INIT="$(get_arg '--force')" local FORCE_INIT="$(get_arg '--force')"
local is_pull_all_components=true local is_pull_all_components=true
local components=("devsvc" "notification" "content" "central_storage" "authentication") local components=("devsvc" "notification" "content" "central_storage" "chat" "authentication")
local start_components=() local start_components=()
# Check if using local components # Check if using local components
@ -583,6 +598,12 @@ devbox_init_command() {
elif [[ "$ARCH" == "arm64" && "$component" == "notification" ]]; then elif [[ "$ARCH" == "arm64" && "$component" == "notification" ]]; then
NOTIFICATION_TAG="latest-linux-arm64" NOTIFICATION_TAG="latest-linux-arm64"
fi fi
if [[ "$ARCH" == "amd64" && "$component" == "chat" ]]; then
CHAT_TAG="latest-linux-amd64"
elif [[ "$ARCH" == "arm64" && "$component" == "chat" ]]; then
CHAT_TAG="latest-linux-arm64"
fi
done done
@ -621,6 +642,9 @@ devbox_init_command() {
echo " NOTIFICATION_REPO = $NOTIFICATION_REPO" echo " NOTIFICATION_REPO = $NOTIFICATION_REPO"
echo " NOTIFICATION_IMAGE= $NOTIFICATION_IMAGE" echo " NOTIFICATION_IMAGE= $NOTIFICATION_IMAGE"
echo " NOTIFICATION_TAG = $NOTIFICATION_TAG" echo " NOTIFICATION_TAG = $NOTIFICATION_TAG"
echo " CHAT_REPO = $CHAT_REPO"
echo " CHAT_IMAGE = $CHAT_IMAGE"
echo " CHAT_TAG = $CHAT_TAG"
echo " FORCE_INIT = $FORCE_INIT" echo " FORCE_INIT = $FORCE_INIT"
echo echo
@ -815,18 +839,35 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
exit 1 exit 1
fi fi
# Echo OWNER_GROUP
echo "OWNER_GROUP: $OWNER_GROUP"
# Copy gitea data to the gitea container
GITEA_HOST_DIR="${WORKING_HOME}/freeleaps2-gitea"
# Remove existing data directories
sudo rm -rf ${GITEA_HOST_DIR}/git
sudo rm -rf ${GITEA_HOST_DIR}/gitea
sudo rm -rf ${GITEA_HOST_DIR}/ssh
echo "==> Starting Gitea, MongoDB, RabbitMQ containers..." # Move data directories to the gitea container
# Start local components by docker compose file and start up specified services. docker compose file is in the same directory as the script (docker-compose.dev.arm64.new.yaml) sudo mv data/git ${GITEA_HOST_DIR}/
docker-compose -f docker-compose.dev.arm64.new.yaml up -d mongodb rabbitmq gitea sudo mv data/gitea ${GITEA_HOST_DIR}/
sudo mv data/ssh ${GITEA_HOST_DIR}/
sleep 5 # Change the owner group of the gitea data directories
sudo chown -R "${OWNER_GROUP}" ${GITEA_HOST_DIR}
echo "Gitea data copying is done"
# start component service from start_components array # Check if gitea data directories exist in the gitea container
docker-compose -f docker-compose.dev.arm64.new.yaml up -d "${start_components[@]}" if [[ ! -d "${GITEA_HOST_DIR}/gitea" ]]; then
echo "ERROR: Failed to copy gitea data."
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[@]}"
gitea_container_id=$(docker ps --no-trunc -a --filter "name=^freeleaps2-gitea$" --format "{{.ID}}") 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"
@ -853,43 +894,6 @@ if [[ $USE_LOCAL_COMPONENT_VAL == true ]]; then
OWNER_GROUP=$(stat -c "%U:%G" "${WORKING_HOME}") OWNER_GROUP=$(stat -c "%U:%G" "${WORKING_HOME}")
fi fi
# Echo OWNER_GROUP
echo "OWNER_GROUP: $OWNER_GROUP"
# Copy gitea data to the gitea container
GITEA_HOST_DIR="${WORKING_HOME}/freeleaps2-gitea"
# Remove existing data directories
sudo rm -rf ${GITEA_HOST_DIR}/git
sudo rm -rf ${GITEA_HOST_DIR}/gitea
sudo rm -rf ${GITEA_HOST_DIR}/ssh
# Move data directories to the gitea container
sudo mv data/git ${GITEA_HOST_DIR}/
sudo mv data/gitea ${GITEA_HOST_DIR}/
sudo mv data/ssh ${GITEA_HOST_DIR}/
# Change the owner group of the gitea data directories
sudo chown -R "${OWNER_GROUP}" ${GITEA_HOST_DIR}
echo "Gitea data copying is done"
# Check if gitea data directories exist in the gitea container
if [[ ! -d "${GITEA_HOST_DIR}/gitea" ]]; then
echo "ERROR: Failed to copy gitea data."
exit 1
fi
# restart gitea container
docker-compose -f docker-compose.dev.arm64.new.yaml restart rabbitmq
sleep 10
docker-compose -f docker-compose.dev.arm64.new.yaml restart gitea
sleep 5
# restart notification if it is in the start_components
if [[ " ${start_components[@]} " =~ "notification" ]]; then
docker-compose -f docker-compose.dev.arm64.new.yaml restart notification
fi
else else
echo '============================================' echo '============================================'
echo ' ===> Using online components for Freeleaps services.' echo ' ===> Using online components for Freeleaps services.'
@ -955,21 +959,32 @@ if ! git ls-remote "https://$FREELEAPS_USERNAME:$FREELEAPS_PASSWORD@freeleaps.co
exit 1 exit 1
fi fi
FREELEAPS_DIR="$WORKING_HOME/freeleaps"
FRONTEND_GIT_URL="https://$FREELEAPS_USERNAME:$FREELEAPS_PASSWORD@freeleaps.com:3443/products/freeleaps.git" FRONTEND_GIT_URL="https://$FREELEAPS_USERNAME:$FREELEAPS_PASSWORD@freeleaps.com:3443/products/freeleaps.git"
# Check if freeleaps2-frontend exists, if not git clone it # Check if freeleaps2-frontend exists, if not git clone it
if [ ! -d $WORKING_HOME/freeleaps ]; then if [ ! -d "$FREELEAPS_DIR" ]; then
echo "Git cloning freeleaps.com:3443/products/freeleaps.git" echo "Git cloning freeleaps.com:3443/products/freeleaps.git"
git clone --depth 5 $FRONTEND_GIT_URL git clone --depth 5 $FRONTEND_GIT_URL
else else
pushd $WORKING_HOME/freeleaps pushd "$FREELEAPS_DIR" > /dev/null
# Check $WORKING_HOME/freeleaps exists and it is a git repository, if not git clone it # 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 if ! git rev-parse --is-inside-work-tree &>/dev/null; then
echo "Git cloning freeleaps.com:3443/products/freeleaps.git" popd > /dev/null # Exit from $FREELEAPS_DIR
git clone --depth 5 $FRONTEND_GIT_URL 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 else
echo "Git pulling freeleaps.com:3443/products/freeleaps.git" echo "Git pulling freeleaps.com:3443/products/freeleaps.git"
git pull git pull
fi fi
popd > /dev/null
fi fi
@ -1316,7 +1331,7 @@ devbox_deinit_command() {
fi fi
# Stop and remove other components # Stop and remove other components
local components=("devsvc" "notification" "content" "central_storage" "authentication") local components=("devsvc" "notification" "content" "central_storage" "chat" "authentication")
for component in "${components[@]}"; do for component in "${components[@]}"; do
if [[ -f "$WORKING_HOME/.${component}-instance" ]]; then if [[ -f "$WORKING_HOME/.${component}-instance" ]]; then
local component_container_id local component_container_id
@ -1407,7 +1422,7 @@ devbox_start_command() {
if [[ "$USE_LOCAL_COMPONENT" == "true" ]]; then if [[ "$USE_LOCAL_COMPONENT" == "true" ]]; then
# If no component is specified, start all components # If no component is specified, start all components
if [[ -z "$COMPONENT" ]]; then if [[ -z "$COMPONENT" ]]; then
COMPONENTS=( "gitea" "mongodb" "rabbitmq" "devbox" "devsvc" "notification" "content" "central_storage" "authentication") COMPONENTS=( "gitea" "mongodb" "rabbitmq" "devbox" "devsvc" "notification" "content" "central_storage" "chat" "authentication")
else else
COMPONENTS=("$COMPONENT") COMPONENTS=("$COMPONENT")
fi fi
@ -1416,7 +1431,7 @@ devbox_start_command() {
if [[ -z "$COMPONENT" ]]; then if [[ -z "$COMPONENT" ]]; then
COMPONENTS=("mongodb" "rabbitmq" "devbox") COMPONENTS=("mongodb" "rabbitmq" "devbox")
else else
if [[ "$COMPONENT" == "devsvc" || "$COMPONENT" == "notification" || "$COMPONENT" == "content" || "$COMPONENT" == "central_storage" || "$COMPONENT" == "authentication" ]]; then if [[ "$COMPONENT" == "devsvc" || "$COMPONENT" == "notification" || "$COMPONENT" == "content" || "$COMPONENT" == "central_storage" || "$COMPONENT" == "chat" || "$COMPONENT" == "authentication" ]]; then
echo "ERROR: Remote component $COMPONENT cannot be restarted." echo "ERROR: Remote component $COMPONENT cannot be restarted."
exit 1 exit 1
fi fi
@ -1429,7 +1444,7 @@ devbox_start_command() {
# Start the specified components # Start the specified components
for comp in "${COMPONENTS[@]}"; do for comp in "${COMPONENTS[@]}"; do
case "$comp" in case "$comp" in
"gitea" | "mongodb" | "rabbitmq" | "devbox" | "devsvc" | "notification" | "content" | "central_storage" | "authentication") "gitea" | "mongodb" | "rabbitmq" | "devbox" | "devsvc" | "notification" | "content" | "central_storage" | "chat" | "authentication")
echo "==> Starting $comp service..." echo "==> Starting $comp service..."
# Check if the component container file exists # Check if the component container file exists
local component_container_id_file_path="${WORKING_HOME}/.${comp}-instance" local component_container_id_file_path="${WORKING_HOME}/.${comp}-instance"
@ -1607,7 +1622,7 @@ devbox_stop_command() {
# If the DevBox container is not running, exit # If the DevBox container is not running, exit
if [[ -z "$COMPONENT" ]]; then if [[ -z "$COMPONENT" ]]; then
COMPONENTS=("gitea" "mongodb" "rabbitmq" "devbox" "devsvc" "notification" "content" "central_storage" "authentication") COMPONENTS=("gitea" "mongodb" "rabbitmq" "devbox" "devsvc" "notification" "content" "central_storage" "chat" "authentication")
else else
COMPONENTS=("$COMPONENT") COMPONENTS=("$COMPONENT")
fi fi
@ -1633,7 +1648,7 @@ devbox_stop_command() {
fi fi
;; ;;
"gitea"| "mongodb"| "rabbitmq" | "devsvc" | "notification" | "content" | "central_storage" | "authentication") "gitea"| "mongodb"| "rabbitmq" | "devsvc" | "notification" | "content" | "central_storage" | "chat" | "authentication")
if [[ -f "${WORKING_HOME}/.${comp}-instance" ]]; then if [[ -f "${WORKING_HOME}/.${comp}-instance" ]]; then
local container_id local container_id
container_id=$(cat "${WORKING_HOME}/.${comp}-instance") container_id=$(cat "${WORKING_HOME}/.${comp}-instance")
@ -1679,7 +1694,7 @@ devbox_status_command() {
# If no component is specified, check all components # If no component is specified, check all components
if [[ -z "$COMPONENT" ]]; then if [[ -z "$COMPONENT" ]]; then
COMPONENTS=("mongodb" "rabbitmq" "devbox" "devsvc" "notification" "content" "central_storage" "authentication") COMPONENTS=("mongodb" "rabbitmq" "devbox" "devsvc" "notification" "content" "central_storage" "chat" "authentication")
else else
COMPONENTS=("$COMPONENT") COMPONENTS=("$COMPONENT")
fi fi
@ -1732,7 +1747,7 @@ devbox_status_command() {
fi fi
;; ;;
"devsvc" | "notification" | "content" | "central_storage" | "authentication") "devsvc" | "notification" | "content" | "central_storage" | "chat" | "authentication")
echo "==> Checking $comp service status..." echo "==> Checking $comp service status..."
if [[ -f "${WORKING_HOME}/.${comp}-instance" ]]; then if [[ -f "${WORKING_HOME}/.${comp}-instance" ]]; then
local container_id local container_id
@ -1777,7 +1792,7 @@ devbox_restart_command() {
if [[ "$USE_LOCAL_COMPONENT" == "true" ]]; then if [[ "$USE_LOCAL_COMPONENT" == "true" ]]; then
echo "==> Using local components..." echo "==> Using local components..."
if [[ -z "$COMPONENT" ]]; then if [[ -z "$COMPONENT" ]]; then
COMPONENTS=("gitea" "mongodb" "rabbitmq" "devbox" "devsvc" "notification" "content" "central_storage" "authentication") COMPONENTS=("gitea" "mongodb" "rabbitmq" "devbox" "devsvc" "notification" "content" "central_storage" "chat" "authentication")
else else
COMPONENTS=("$COMPONENT") COMPONENTS=("$COMPONENT")
fi fi
@ -1786,7 +1801,7 @@ devbox_restart_command() {
if [[ -z "$COMPONENT" ]]; then if [[ -z "$COMPONENT" ]]; then
COMPONENTS=("mongodb" "rabbitmq" "devbox") COMPONENTS=("mongodb" "rabbitmq" "devbox")
else else
if [[ "$COMPONENT" == "devsvc" || "$COMPONENT" == "notification" || "$COMPONENT" == "content" || "$COMPONENT" == "central_storage" || "$COMPONENT" == "authentication" ]]; then if [[ "$COMPONENT" == "devsvc" || "$COMPONENT" == "notification" || "$COMPONENT" == "content" || "$COMPONENT" == "central_storage" || "$COMPONENT" == "chat" || "$COMPONENT" == "authentication" ]]; then
echo "ERROR: Remote component $COMPONENT cannot be restarted." echo "ERROR: Remote component $COMPONENT cannot be restarted."
exit 1 exit 1
fi fi
@ -1813,7 +1828,7 @@ devbox_restart_command() {
fi fi
;; ;;
"gitea" | "mongodb" | "rabbitmq" | "devsvc" | "notification" | "content" | "central_storage" | "authentication") "gitea" | "mongodb" | "rabbitmq" | "devsvc" | "notification" | "content" | "central_storage" | "chat" | "authentication")
if [[ -f "${WORKING_HOME}/.${comp}-instance" ]]; then if [[ -f "${WORKING_HOME}/.${comp}-instance" ]]; then
local container_id local container_id
@ -1834,7 +1849,7 @@ devbox_restart_command() {
# Start the specified components # Start the specified components
for comp in "${COMPONENTS[@]}"; do for comp in "${COMPONENTS[@]}"; do
case "$comp" in case "$comp" in
"gitea" | "mongodb" | "rabbitmq" | "devbox" | "devsvc" | "notification" | "content" | "central_storage" | "authentication") "gitea" | "mongodb" | "rabbitmq" | "devbox" | "devsvc" | "notification" | "content" | "central_storage" | "chat" | "authentication")
echo "==> Restarting $comp service..." echo "==> Restarting $comp service..."
if [[ -f "${WORKING_HOME}/.${comp}-instance" ]]; then if [[ -f "${WORKING_HOME}/.${comp}-instance" ]]; then
local container_id local container_id
@ -2415,6 +2430,36 @@ devbox_init_parse_requirements() {
fi fi
;; ;;
# :flag.case # :flag.case
--chat-image-repo | -B)
if [[ -n ${2+x} ]]; then
add_arg '--chat-image-repo' "$2"
shift 2
else
printf "%s\n" "--chat-image-repo requires an argument: --chat-image-repo FREELEAPS_CHAT_IMAGE_REPO" >&2
exit 1
fi
;;
# :flag.case
--chat-image-name | -N)
if [[ -n ${2+x} ]]; then
add_arg '--chat-image-name' "$2"
shift 2
else
printf "%s\n" "--chat-image-name requires an argument: --chat-image-name FREELEAPS_CHAT_IMAGE_NAME" >&2
exit 1
fi
;;
# :flag.case
--chat-image-tag | -T)
if [[ -n ${2+x} ]]; then
add_arg '--chat-image-tag' "$2"
shift 2
else
printf "%s\n" "--chat-image-tag requires an argument: --chat-image-tag FREELEAPS_CHAT_IMAGE_TAG" >&2
exit 1
fi
;;
# :flag.case
--force | -f) --force | -f)
# :flag.case_no_arg # :flag.case_no_arg
add_arg '--force' '1' add_arg '--force' '1'

View File

@ -48,6 +48,10 @@ services:
container_name: devsvc container_name: devsvc
image: freeleaps/devsvc:${DEVSVC_IMAGE_TAG:-latest-linux-arm64} image: freeleaps/devsvc:${DEVSVC_IMAGE_TAG:-latest-linux-arm64}
restart: always restart: always
depends_on:
- gitea
- mongodb
- rabbitmq
environment: environment:
- APP_NAME=devsvc - APP_NAME=devsvc
- SERVICE_API_ACCESS_HOST=localhost - SERVICE_API_ACCESS_HOST=localhost
@ -181,6 +185,8 @@ services:
# profiles: [ prod, alpha, dev ] # profiles: [ prod, alpha, dev ]
platform: linux/${ARCH:-arm64} platform: linux/${ARCH:-arm64}
restart: always restart: always
depends_on:
- rabbitmq
environment: environment:
- APP_NAME=notification - APP_NAME=notification
- SERVICE_API_ACCESS_HOST=localhost - SERVICE_API_ACCESS_HOST=localhost
@ -243,6 +249,52 @@ services:
- type: bind - type: bind
source: /var/lib/docker/app/payment/log source: /var/lib/docker/app/payment/log
target: /app/log/payment target: /app/log/payment
chat:
container_name: chat
image: freeleaps/chat:${NOTIFICATION_IMAGE_TAG:-latest-linux-arm64}
platform: linux/${ARCH:-arm64}
restart: always
depends_on:
- mongodb
- rabbitmq
ports:
- 8012:8012
environment:
- APP_NAME=chat
- CERT_PATH=/app/certs
- EMAIL_FROM=freeleaps@freeleaps.com
- MONGODB_NAME=freeleaps2
- MONGODB_URI=mongodb://freeleaps2-mongodb:27017/
- SITE_URL_ROOT=http://localhost
- JWT_SECRET_KEY=8f87ca8c3c9c3df09a9c78e0adb0927855568f6072d9efc892534aee35f5867b
- JWT_ALGORITHM=HS256
- SERVICE_API_ACCESS_PORT=8012
- RABBITMQ_HOST=freeleaps2-rabbitmq
- RABBITMQ_PORT=5672
- LOG_BASE_PATH=/app/log/freeleaps-chat
- BACKEND_LOG_FILE_NAME=freeleaps-chat.log
- APPLICATION_ACTIVITY_LOG=freeleaps-chat.application.log
- FREELEAPS_ENV=dev
- FREELEAPS_CHAT_ENDPOINT=http://freeleaps-alpha.com/api/chat/
- FREELEAPS_DEVSVC_ENDPOINT=http://devsvc:8007/api/devsvc/
- FREELEAPS_CONTENT_ENDPOINT=http://content:8013/api/content/
- FREELEAPS_NOTIFICATION_ENDPOINT=http://notification:8003/api/notification/
- FREELEAPS_CENTRAL_STORAGE_ENDPOINT=http://central_storage:8005/api/central_storage/
- FREELEAPS_AUTHENTICATION_ENDPOINT=http://authentication:8004/api/auth/
- TZ=Asia/Shanghai
command:
# Use a conditional check for RabbitMQ in alpha profile
- /bin/sh
- -c
- |
uvicorn chat.main:app --reload --host=0.0.0.0 --port=8012 --workers 4 --timeout-keep-alive 120 --log-level info
- echo "Chat service is up and running $CONTAINER_APP_ROOT"
volumes:
- type: bind
source: ${WORKING_HOME}/logs/freeleaps-chat
target: /app/log/freeleaps-chat
networks:
- devbox_freeleaps2-network
volumes: volumes:
freeleaps2-mongodb-data: freeleaps2-mongodb-data:
freeleaps2-gitea-data: freeleaps2-gitea-data: