优化部署配置
This commit is contained in:
11
.env.example
11
.env.example
@@ -1,8 +1,9 @@
|
||||
# postgres
|
||||
DB_USERNAME=
|
||||
DB_PASSWORD=
|
||||
DB_NAME=
|
||||
DB_USERNAME=test
|
||||
DB_PASSWORD=test
|
||||
DB_NAME=app
|
||||
DB_PORT=5432
|
||||
|
||||
# redis
|
||||
REDIS_PORT=6379
|
||||
|
||||
PLATFORM_PORT=8080
|
||||
WEB_PORT=3000
|
||||
|
||||
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
init.sql
|
||||
@@ -1,4 +1,4 @@
|
||||
name: lanhu-prod
|
||||
name: lanhu
|
||||
|
||||
services:
|
||||
postgres:
|
||||
@@ -8,7 +8,7 @@ services:
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
POSTGRES_DB: ${DB_NAME}
|
||||
ports:
|
||||
- "localhost:${DB_PORT}:{DB_PORT}"
|
||||
- "127.0.0.1:${DB_PORT}:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
@@ -19,7 +19,7 @@ services:
|
||||
redis:
|
||||
image: redis:7.4
|
||||
ports:
|
||||
- "localhost:${REDIS_PORT}:{REDIS_PORT}"
|
||||
- "127.0.0.1:${REDIS_PORT}:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
restart: unless-stopped
|
||||
@@ -27,24 +27,28 @@ services:
|
||||
driver: local
|
||||
|
||||
platform:
|
||||
image: ghcr.io/wyongk/juip-proxy-back:main
|
||||
image: 43.226.58.254:53000/zxf/lanhu-platform:latest
|
||||
env_file:
|
||||
- .env
|
||||
- .env.platform
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
ports:
|
||||
- "127.0.0.1:${PLATFORM_PORT}:8080"
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: local
|
||||
|
||||
web:
|
||||
image: ghcr.io/wyongk/juip-proxy-react:main
|
||||
image: 43.226.58.254:53000/wmp/lanhu-web:latest
|
||||
env_file:
|
||||
- .env
|
||||
- .env.web
|
||||
depends_on:
|
||||
- platform
|
||||
ports:
|
||||
- "127.0.0.1:${WEB_PORT}:3000"
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: local
|
||||
|
||||
25
startup.sh
Normal file
25
startup.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 检查必要文件
|
||||
req_files=(
|
||||
".env"
|
||||
".env.platform"
|
||||
# ".env.task"
|
||||
".env.web"
|
||||
"init.sql"
|
||||
)
|
||||
|
||||
for i in "${!req_files[@]}"; do
|
||||
if [ ! -f "${req_files[$i]}" ]; then
|
||||
echo "缺少必要文件: ${req_files[$i]}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# 启动项目
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "Docker 未安装,请先安装 Docker"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# docker compose up -d
|
||||
Reference in New Issue
Block a user