Skip to content

Commit 3ff50af

Browse files
committed
fix(docker): update network names from sandbox-network to magic-sandbox-network across all configurations
1 parent 74e1747 commit 3ff50af

File tree

14 files changed

+164
-811
lines changed

14 files changed

+164
-811
lines changed

backend/magic-gateway/deploy.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function check_config_dir {
5454
if [ ! -d "config/$env" ]; then
5555
echo -e "${YELLOW}配置目录 config/$env 不存在,正在创建...${NC}"
5656
mkdir -p config/$env
57-
57+
5858
# 如果没有环境配置文件,从示例文件复制
5959
if [ ! -f "config/$env/.env" ]; then
6060
if [ -f ".env_example" ]; then
@@ -70,11 +70,11 @@ function check_config_dir {
7070

7171
# 检查并创建外部网络
7272
function ensure_network_exists {
73-
if ! docker network ls | grep -q sandbox-network; then
74-
echo -e "${YELLOW}创建外部网络 sandbox-network...${NC}"
75-
docker network create sandbox-network
73+
if ! docker network ls | grep -q magic-sandbox-network; then
74+
echo -e "${YELLOW}创建外部网络 magic-sandbox-network...${NC}"
75+
docker network create magic-sandbox-network
7676
else
77-
echo -e "${GREEN}外部网络 sandbox-network 已存在${NC}"
77+
echo -e "${GREEN}外部网络 magic-sandbox-network 已存在${NC}"
7878
fi
7979
}
8080

@@ -87,15 +87,15 @@ function start_env {
8787
local debug
8888
local redis_port
8989
local redis_db
90-
90+
9191
# 检查配置目录
9292
check_config_dir $env
93-
93+
9494
# 确保外部网络存在
9595
ensure_network_exists
96-
96+
9797
echo -e "${GREEN}正在启动 $env 环境...${NC}"
98-
98+
9999
case $env in
100100
test)
101101
port=8001
@@ -122,7 +122,7 @@ function start_env {
122122
debug="false"
123123
;;
124124
esac
125-
125+
126126
# 检查Redis容器是否已存在
127127
if docker ps -a | grep -q "api-gateway-redis"; then
128128
echo -e "${YELLOW}Redis容器 api-gateway-redis 已存在,跳过创建...${NC}"
@@ -134,13 +134,13 @@ function start_env {
134134
else
135135
echo -e "${YELLOW}创建Redis容器...${NC}"
136136
# 直接启动Redis容器,不通过docker-compose
137-
docker run -d --name api-gateway-redis --network sandbox-network -p ${redis_port}:6379 -v $(pwd)/redis_data:/data redis:alpine redis-server --appendonly yes
137+
docker run -d --name api-gateway-redis --network magic-sandbox-network -p ${redis_port}:6379 -v $(pwd)/redis_data:/data redis:alpine redis-server --appendonly yes
138138
fi
139-
139+
140140
# 获取Redis容器的IP地址
141141
local redis_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' api-gateway-redis)
142142
echo -e "${YELLOW}Redis容器IP地址: ${redis_ip}${NC}"
143-
143+
144144
# 创建临时的docker-compose重写文件
145145
cat > docker-compose.override.yml <<EOF
146146
services:
@@ -153,13 +153,13 @@ services:
153153
magic-redis:
154154
profiles: ["disabled"]
155155
EOF
156-
156+
157157
ENV=$env PORT=$port MAGIC_GATEWAY_PORT=$port MAGIC_GATEWAY_API_KEY=$api_key JWT_SECRET=$jwt_secret MAGIC_GATEWAY_DEBUG=$debug \
158158
docker compose -p magic-gateway-$env up -d --build
159-
159+
160160
# 移除临时文件
161161
rm docker-compose.override.yml
162-
162+
163163
echo -e "${GREEN}$env 环境已启动,访问地址: http://localhost:$port${NC}"
164164
echo -e "${GREEN}Redis信息: IP=${redis_ip}, 端口=6379, DB=${redis_db}${NC}"
165165
}
@@ -190,7 +190,7 @@ function check_status {
190190
function process_operation {
191191
local env=$1
192192
local operation=$2
193-
193+
194194
case $operation in
195195
start)
196196
start_env $env
@@ -214,7 +214,7 @@ function process_operation {
214214
# 处理所有环境
215215
function process_all_envs {
216216
local operation=$1
217-
217+
218218
for env in test pre prod; do
219219
process_operation $env $operation
220220
done
@@ -225,4 +225,4 @@ if [ "$1" == "all" ]; then
225225
process_all_envs $2
226226
else
227227
process_operation $1 $2
228-
fi
228+
fi

backend/magic-gateway/docker-compose.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
- ./config/${ENV:-dev}/.env:/app/.env
1212
restart: unless-stopped
1313
networks:
14-
- sandbox-network
14+
- magic-sandbox-network
1515
# depends_on:
1616
# - magic-redis
1717

@@ -23,7 +23,7 @@ services:
2323
- ./redis_data:/data
2424
restart: unless-stopped
2525
networks:
26-
- sandbox-network
26+
- magic-sandbox-network
2727
command: redis-server --appendonly yes
2828
labels:
2929
- "com.docker.compose.skip.create=true"
@@ -33,7 +33,6 @@ volumes:
3333
caddy_config:
3434

3535
networks:
36-
sandbox-network:
36+
magic-sandbox-network:
3737
external: true
38-
driver: bridge
39-
38+
driver: bridge

backend/sandbox-gateway/.env_example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ APP_ENV=test
33
SUPER_MAGIC_IMAGE_NAME=ghcr.io/dtyq/super-magic:latest
44

55
LOG_LEVEL=DEBUG
6-
SANDBOX_NETWORK=sandbox-network
6+
SANDBOX_NETWORK=magic-sandbox-network
77

88
# API安全配置
99
API_TOKEN=API_TOKEN

backend/sandbox-gateway/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ db.sqlite3-journal
6767
.env.agent
6868
.cursor/
6969
.output/
70+
config/config.yaml
7071

7172
# 临时文件
7273
tmp/
@@ -76,5 +77,4 @@ data/
7677
cache/
7778

7879
debug/
79-
8080
qdrant-config.yaml

backend/sandbox-gateway/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
4141
# 复制并安装项目依赖
4242
COPY requirements.txt .
4343

44-
# 安装依赖,使用缓存挂载优化
45-
RUN --mount=type=cache,target=/root/.cache/pip \
46-
pip install -r requirements.txt
44+
# 安装依赖
45+
RUN pip install -r requirements.txt
4746

4847
# 复制项目文件
4948
COPY . .
@@ -52,4 +51,4 @@ COPY . .
5251
EXPOSE 8003
5352

5453
# 启动命令
55-
CMD ["python", "main.py"]
54+
CMD ["python", "main.py"]

0 commit comments

Comments
 (0)