forked from freeleaps/freeleaps-pub
Compare commits
1 Commits
master
...
haolou_loc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98347d0eba |
@ -640,38 +640,6 @@ init_compile_env() {
|
|||||||
|
|
||||||
# Update for export environments []
|
# Update for export environments []
|
||||||
docker exec -i "$DEVBOX_NAME" bash <<EOF
|
docker exec -i "$DEVBOX_NAME" bash <<EOF
|
||||||
# Detect the network environment
|
|
||||||
echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Checking network connectivity..."
|
|
||||||
|
|
||||||
# Check if you can access Google
|
|
||||||
if ping -c 1 -W 5 google.com > /dev/null 2>&1; then
|
|
||||||
echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Google is accessible, using default Ubuntu sources"
|
|
||||||
# Use the default Ubuntu source without any modifications
|
|
||||||
echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Keeping default Ubuntu sources"
|
|
||||||
else
|
|
||||||
echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Google is not accessible, switching to Aliyun mirrors"
|
|
||||||
# Back up the original source list
|
|
||||||
cp /etc/apt/sources.list /etc/apt/sources.list.backup
|
|
||||||
echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Backup original sources.list to sources.list.backup"
|
|
||||||
|
|
||||||
# Replace with an Alibaba Cloud mirror source
|
|
||||||
cat > /etc/apt/sources.list << 'SOURCES_EOF'
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
|
||||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
|
|
||||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
|
|
||||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
|
|
||||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
|
|
||||||
SOURCES_EOF
|
|
||||||
echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Successfully replaced with Aliyun mirrors"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update package list
|
|
||||||
echo "[INIT] $(date '+%Y-%m-%d %H:%M:%S') Updating package lists..."
|
|
||||||
apt-get update
|
|
||||||
|
|
||||||
echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Starting DevBox initialization..."
|
echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Starting DevBox initialization..."
|
||||||
|
|
||||||
# Export environment variables
|
# Export environment variables
|
||||||
@ -1020,7 +988,7 @@ compile_backend_service() {
|
|||||||
# Check if it's the first time by verifying if the backend dependencies have been installed
|
# Check if it's the first time by verifying if the backend dependencies have been installed
|
||||||
if [ ! -f "/home/devbox/.backend_deps_installed" ]; then
|
if [ ! -f "/home/devbox/.backend_deps_installed" ]; then
|
||||||
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Install backend dependencies..."
|
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Install backend dependencies..."
|
||||||
pip install --no-cache-dir -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
||||||
if ! pip show async_timeout; then
|
if ! pip show async_timeout; then
|
||||||
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') async_timeout is missing. Installing..."
|
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') async_timeout is missing. Installing..."
|
||||||
pip install async_timeout
|
pip install async_timeout
|
||||||
@ -1066,7 +1034,7 @@ compile_backend_service() {
|
|||||||
|
|
||||||
if [ \$IS_NEW_REQ_ADDED -eq 1 ]; then
|
if [ \$IS_NEW_REQ_ADDED -eq 1 ]; then
|
||||||
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Reinstalling dependencies..."
|
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Reinstalling dependencies..."
|
||||||
pip install --no-cache-dir -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
||||||
fi
|
fi
|
||||||
# Undo update for /home/devbox/freeleaps/apps/requirements.txt
|
# Undo update for /home/devbox/freeleaps/apps/requirements.txt
|
||||||
rm /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
rm /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
||||||
@ -1080,7 +1048,7 @@ compile_backend_service() {
|
|||||||
# Check if all dependencies are installed, if not, install them
|
# Check if all dependencies are installed, if not, install them
|
||||||
if ! pip check; then
|
if ! pip check; then
|
||||||
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Some dependencies are missing. Reinstalling..."
|
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Some dependencies are missing. Reinstalling..."
|
||||||
pip install --no-cache-dir -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
pip install -r /home/devbox/freeleaps/apps/freeleaps/requirements.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# pip install async_timeout if not installed
|
# pip install async_timeout if not installed
|
||||||
@ -1126,7 +1094,7 @@ compile_backend_service() {
|
|||||||
|
|
||||||
if [ \$IS_NEW_REQ_ADDED -eq 1 ]; then
|
if [ \$IS_NEW_REQ_ADDED -eq 1 ]; then
|
||||||
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Reinstalling dependencies..."
|
echo "[BACKEND] \$(date '+%Y-%m-%d %H:%M:%S') Reinstalling dependencies..."
|
||||||
pip install --no-cache-dir -r /home/devbox/freeleaps/apps/requirements.txt
|
pip install -r /home/devbox/freeleaps/apps/requirements.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Undo update for /home/devbox/freeleaps/apps/requirements.txt
|
# Undo update for /home/devbox/freeleaps/apps/requirements.txt
|
||||||
@ -3614,9 +3582,7 @@ devbox_init_parse_requirements() {
|
|||||||
add_arg '--devbox-image-name' "devbox_v1"
|
add_arg '--devbox-image-name' "devbox_v1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$current_arch" = "amd64" ]; then
|
if [ -z "$(get_arg '--devbox-image-tag')" ]; then
|
||||||
add_arg '--devbox-image-tag' "devbox_local_amd64"
|
|
||||||
else
|
|
||||||
add_arg '--devbox-image-tag' "devbox_local"
|
add_arg '--devbox-image-tag' "devbox_local"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -367,7 +367,7 @@ services:
|
|||||||
uvicorn chat.main:app --reload --host=0.0.0.0 --port=8012 --workers 4 --timeout-keep-alive 120 --log-level info
|
uvicorn chat.main:app --reload --host=0.0.0.0 --port=8012 --workers 4 --timeout-keep-alive 120 --log-level info
|
||||||
volumes:
|
volumes:
|
||||||
- type: bind
|
- type: bind
|
||||||
source: ${WORKING_HOME}/logs/freeleaps-chat
|
source: ${WORKING_HOME}/logs/chat
|
||||||
target: /app/log/freeleaps-chat
|
target: /app/log/freeleaps-chat
|
||||||
- type: bind
|
- type: bind
|
||||||
source: ${WORKING_HOME}/freeleaps/apps/chat
|
source: ${WORKING_HOME}/freeleaps/apps/chat
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user