新建部署配置
This commit is contained in:
8
.env.example
Normal file
8
.env.example
Normal file
@@ -0,0 +1,8 @@
|
||||
# postgres
|
||||
DB_USERNAME=
|
||||
DB_PASSWORD=
|
||||
DB_NAME=
|
||||
DB_PORT=5432
|
||||
|
||||
# redis
|
||||
REDIS_PORT=6379
|
||||
15
caddy/config/Caddyfile
Normal file
15
caddy/config/Caddyfile
Normal file
@@ -0,0 +1,15 @@
|
||||
https://lanhuip.com {
|
||||
reverse_proxy web:3000
|
||||
}
|
||||
|
||||
https://www.lanhuip.com {
|
||||
reverse_proxy web:3000
|
||||
}
|
||||
|
||||
# 后端回调路径
|
||||
https://cb.lanhuip.com {
|
||||
route {
|
||||
reverse_proxy /callback/* platform:8080
|
||||
respond "Not Found" 404
|
||||
}
|
||||
}
|
||||
76
docker-compose.yaml
Normal file
76
docker-compose.yaml
Normal file
@@ -0,0 +1,76 @@
|
||||
name: lanhu-prod
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:17.7
|
||||
environment:
|
||||
POSTGRES_USER: ${DB_USERNAME}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
POSTGRES_DB: ${DB_NAME}
|
||||
ports:
|
||||
- "localhost:${DB_PORT}:{DB_PORT}"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: local
|
||||
|
||||
redis:
|
||||
image: redis:7.4
|
||||
ports:
|
||||
- "localhost:${REDIS_PORT}:{REDIS_PORT}"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: local
|
||||
|
||||
platform:
|
||||
image: ghcr.io/wyongk/juip-proxy-back:main
|
||||
env_file:
|
||||
- .env
|
||||
- .env.platform
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: local
|
||||
|
||||
web:
|
||||
image: ghcr.io/wyongk/juip-proxy-react:main
|
||||
env_file:
|
||||
- .env
|
||||
- .env.web
|
||||
depends_on:
|
||||
- platform
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: local
|
||||
|
||||
# task:
|
||||
# image: ghcr.io/wyongk/juip-proxy-task:main
|
||||
# env_file:
|
||||
# - .env
|
||||
# - .env.task
|
||||
# depends_on:
|
||||
# - platform
|
||||
# restart: unless-stopped
|
||||
|
||||
caddy:
|
||||
image: caddy:latest
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./caddy/config:/etc/caddy
|
||||
- caddy_data:/data
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: local
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
caddy_data:
|
||||
26
run.sh
Normal file
26
run.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/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