feat(byhlc112): add project deployment configuration
This commit is contained in:
31
deploy/docker/step1-integral-byhlc112/.env.example
Normal file
31
deploy/docker/step1-integral-byhlc112/.env.example
Normal file
@@ -0,0 +1,31 @@
|
||||
# =============================================================
|
||||
# 步骤一:寄卖商城环境变量 — 宝应宏煜春商贸 byhlc112
|
||||
# cp .env.example .env 并填入真实密码
|
||||
# .env 不入库
|
||||
# =============================================================
|
||||
|
||||
TZ=Asia/Shanghai
|
||||
|
||||
# ---------- Redis(容器内) ----------
|
||||
REDIS_PASSWORD=change-me-redis
|
||||
|
||||
# ---------- H5 对外域名(浏览器可达) ----------
|
||||
INTEGRAL_TITLE=宝应宏煜春商贸
|
||||
INTEGRAL_API_PUBLIC_URL=https://admin.lehoo6.com
|
||||
INTEGRAL_IMG_PUBLIC_URL=https://admin.lehoo6.com
|
||||
INTEGRAL_H5_PUBLIC_URL=https://lehoo6.com/
|
||||
INTEGRAL_SN_ID=17533260260529
|
||||
INTEGRAL_APP_STR=ZFyTNQTWEkCBbyhlc1120529
|
||||
INTEGRAL_CONTRACT_PAGE=10012
|
||||
|
||||
# ---------- 宿主机暴露端口 ----------
|
||||
INTEGRAL_H5_PORT=18080
|
||||
# webman API 直连端口(宝塔 Nginx admin.lehoo6.com → 此端口)
|
||||
RESELL_API_PORT=18085
|
||||
|
||||
# ---------- 宿主机目录映射(bind mount,与原部署路径一致)----------
|
||||
# 寄卖商城 H5 静态文件目录(手动改 JS/configs.js 直接生效,无需重建镜像)
|
||||
RESELL_H5_DIR=/www/wwwroot/lehoo6.com
|
||||
# webman 后台完整应用目录(FTP 上传新 webman.bin/public/ 后 restart 容器即可更新)
|
||||
# 上传图片、public/upload 等均包含在此目录内,无需单独挂载
|
||||
RESELL_HOUTAI_DIR=/www/wwwroot/admin.lehoo6.com
|
||||
2
deploy/docker/step1-integral-byhlc112/.gitignore
vendored
Normal file
2
deploy/docker/step1-integral-byhlc112/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.env
|
||||
houtai.env
|
||||
99
deploy/docker/step1-integral-byhlc112/README.md
Normal file
99
deploy/docker/step1-integral-byhlc112/README.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# 步骤一:寄卖商城 Docker 部署(宝应宏煜春商贸 byhlc112)
|
||||
|
||||
项目:`integral-resell`(寄卖商城)
|
||||
服务:`redis` · `integral-houtai`(Webman PHP 8.0)· `integral-h5`(Nginx 静态站)· `edge-nginx`(Docker HTTPS 入口)
|
||||
|
||||
步骤二(积分商城)与本步骤完全独立,可以单独部署、单独重启。
|
||||
|
||||
> 这套目录结构与 `deploy/docker/step1-integral` 保持一致,按 `czleilei240` 已验证方案复制而来。
|
||||
> 当前默认域名假设为:
|
||||
> - 寄卖商城 H5:`lehoo6.com`
|
||||
> - 寄卖商城后台/API:`admin.lehoo6.com`
|
||||
|
||||
---
|
||||
|
||||
## 快速部署
|
||||
|
||||
```bash
|
||||
cd deploy/docker/step1-integral-byhlc112
|
||||
|
||||
# 1. 准备环境变量
|
||||
cp .env.example .env
|
||||
cp houtai.env.example houtai.env
|
||||
vim .env
|
||||
vim houtai.env
|
||||
|
||||
# 2. 首次部署:在服务器上确保宿主机目录存在
|
||||
mkdir -p /www/wwwroot/lehoo6.com
|
||||
mkdir -p /www/wwwroot/admin.lehoo6.com/public/upload
|
||||
|
||||
# 3. 将 H5 静态文件同步到宿主机目录(首次 / 每次前端更新后)
|
||||
rsync -av integral-resell/h5/ /www/wwwroot/lehoo6.com/
|
||||
|
||||
# 4. 构建并启动,edge-nginx 会在宿主机监听 80/443
|
||||
docker compose --env-file .env up -d --build
|
||||
|
||||
# 5. 查看状态
|
||||
docker compose --env-file .env ps
|
||||
docker compose --env-file .env logs -f integral-houtai
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 目录映射
|
||||
|
||||
| 宿主机路径 | 容器路径 | 用途 |
|
||||
|---|---|---|
|
||||
| `/www/wwwroot/lehoo6.com` | `/usr/share/nginx/html` | H5 静态文件,手动改 JS 即时生效 |
|
||||
| `/www/wwwroot/admin.lehoo6.com` | `/app` | webman 后台完整应用目录 |
|
||||
| `./houtai.env` | `/app/.env` | 运行时配置,只读挂入 |
|
||||
| `integral-runtime`(named vol)| `/app/runtime` | webman PID、session 等运行时数据 |
|
||||
|
||||
| 域名 | 用途 | Docker 容器端口 | 宿主机端口 | Docker 入口 |
|
||||
|---|---|---|---|---|
|
||||
| `lehoo6.com` | 寄卖商城 H5 | integral-h5:80 | **80/443**,直连测试 **18080** | `edge-nginx` |
|
||||
| `admin.lehoo6.com` | 寄卖商城 API / 后台 | integral-houtai:**8785** | **80/443**,直连测试 **18085** | `edge-nginx` |
|
||||
|
||||
---
|
||||
|
||||
## 验证
|
||||
|
||||
| 地址 | 预期 |
|
||||
|------|------|
|
||||
| `https://lehoo6.com/` | 寄卖商城 H5 首页 |
|
||||
| `https://admin.lehoo6.com/api/...` | 寄卖商城 API |
|
||||
| `http://39.97.236.112:18080/` | H5 直连测试 |
|
||||
| `ss -lntp \| grep -E ':(80\|443)'` | 看到 Docker Nginx 监听宿主机 80/443 |
|
||||
|
||||
---
|
||||
|
||||
## 常用命令
|
||||
|
||||
```bash
|
||||
docker compose --env-file .env restart integral-houtai
|
||||
docker compose --env-file .env restart edge-nginx
|
||||
docker compose --env-file .env logs -f integral-houtai
|
||||
docker compose --env-file .env logs -f edge-nginx
|
||||
docker compose --env-file .env exec integral-houtai bash
|
||||
docker compose --env-file .env down
|
||||
docker compose --env-file .env down -v
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 关键一致性检查
|
||||
|
||||
| 位置 | 值 |
|
||||
|---|---|
|
||||
| `.env` INTEGRAL_API_PUBLIC_URL | `https://admin.lehoo6.com` |
|
||||
| `.env` INTEGRAL_H5_PUBLIC_URL | `https://lehoo6.com/` |
|
||||
| `.env` INTEGRAL_APP_STR | `ZFyTNQTWEkCBbyhlc1120529` |
|
||||
| `houtai.env` APP_SECRET | 同上 |
|
||||
| `.env` INTEGRAL_SN_ID | `17533260260529` |
|
||||
|
||||
---
|
||||
|
||||
## 待确认项
|
||||
|
||||
- 短信当前使用阿里云签名 `宝应宏煜春商贸`、模板 `SMS_334545236`,如更换短信账号需同步更新 `houtai.env`
|
||||
- 如果寄卖后台域名不是 `admin.lehoo6.com`,请统一替换 `.env.example`、README 和入口 Nginx 配置
|
||||
100
deploy/docker/step1-integral-byhlc112/docker-compose.yml
Normal file
100
deploy/docker/step1-integral-byhlc112/docker-compose.yml
Normal file
@@ -0,0 +1,100 @@
|
||||
# =============================================================
|
||||
# 步骤一:寄卖商城(integral-resell)独立部署
|
||||
# 客户:宝应宏煜春商贸 byhlc112
|
||||
# 包含服务:redis · integral-houtai(webman) · integral-h5(Nginx) · edge-nginx(HTTPS入口)
|
||||
# =============================================================
|
||||
|
||||
name: resell-byhlc112
|
||||
|
||||
x-common: &common
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "20m"
|
||||
max-file: "5"
|
||||
|
||||
networks:
|
||||
integral-net:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
integral-redis-data:
|
||||
integral-runtime:
|
||||
|
||||
services:
|
||||
redis:
|
||||
<<: *common
|
||||
build:
|
||||
context: .
|
||||
dockerfile: redis.Dockerfile
|
||||
image: resell-byhlc112/redis:local
|
||||
container_name: integral-redis-byhlc112
|
||||
command: ["--requirepass", "${REDIS_PASSWORD}", "--appendonly", "yes"]
|
||||
volumes:
|
||||
- integral-redis-data:/data
|
||||
networks: [integral-net]
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
integral-houtai:
|
||||
<<: *common
|
||||
build:
|
||||
context: ../integral-resell
|
||||
dockerfile: houtai.Dockerfile
|
||||
image: resell-byhlc112/houtai:latest
|
||||
container_name: integral-houtai-byhlc112
|
||||
networks: [integral-net]
|
||||
ports:
|
||||
- "${RESELL_API_PORT:-18085}:8785"
|
||||
volumes:
|
||||
- ${RESELL_HOUTAI_DIR}:/app
|
||||
- ./houtai.env:/app/.env:ro
|
||||
- integral-runtime:/app/runtime
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
|
||||
integral-h5:
|
||||
<<: *common
|
||||
build:
|
||||
context: ../integral-resell
|
||||
dockerfile: h5.Dockerfile
|
||||
image: resell-byhlc112/h5:latest
|
||||
container_name: integral-h5-byhlc112
|
||||
networks: [integral-net]
|
||||
environment:
|
||||
TZ: ${TZ:-Asia/Shanghai}
|
||||
INTEGRAL_TITLE: ${INTEGRAL_TITLE}
|
||||
INTEGRAL_API_PUBLIC_URL: ${INTEGRAL_API_PUBLIC_URL}
|
||||
INTEGRAL_IMG_PUBLIC_URL: ${INTEGRAL_IMG_PUBLIC_URL}
|
||||
INTEGRAL_H5_PUBLIC_URL: ${INTEGRAL_H5_PUBLIC_URL}
|
||||
INTEGRAL_SN_ID: ${INTEGRAL_SN_ID}
|
||||
INTEGRAL_APP_STR: ${INTEGRAL_APP_STR}
|
||||
INTEGRAL_CONTRACT_PAGE: ${INTEGRAL_CONTRACT_PAGE}
|
||||
volumes:
|
||||
- ${RESELL_H5_DIR}:/usr/share/nginx/html
|
||||
ports:
|
||||
- "${INTEGRAL_H5_PORT:-18080}:80"
|
||||
depends_on:
|
||||
- integral-houtai
|
||||
|
||||
edge-nginx:
|
||||
<<: *common
|
||||
image: nginx:1.25-alpine
|
||||
container_name: edge-nginx-byhlc112
|
||||
networks: [integral-net]
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./nginx-edge.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
- ../ssl-cert/lehoo6.com_cert/nginx:/etc/nginx/ssl/lehoo6.com_cert:ro
|
||||
depends_on:
|
||||
- integral-h5
|
||||
- integral-houtai
|
||||
37
deploy/docker/step1-integral-byhlc112/houtai.env.example
Normal file
37
deploy/docker/step1-integral-byhlc112/houtai.env.example
Normal file
@@ -0,0 +1,37 @@
|
||||
# =============================================================
|
||||
# Webman 后端运行时配置 — 宝应宏煜春商贸 byhlc112(寄卖商城)
|
||||
# cp houtai.env.example houtai.env 并填入真实密码
|
||||
# houtai.env 不入库,由 docker-compose volumes: 挂入 /app/.env
|
||||
# =============================================================
|
||||
|
||||
# MySQL(阿里云 RDS)
|
||||
DB_HOST = 'rm-bp1a178eq62lxba9xbo.mysql.rds.aliyuncs.com'
|
||||
DB_PORT = 3306
|
||||
DB_DATABASE = 'byhlc112'
|
||||
DB_USERNAME = 'yangtangyoupin'
|
||||
DB_PASSWORD = 'change-me'
|
||||
|
||||
# Redis(指向同 compose 内的 redis 容器)
|
||||
REDIS_HOST = 'redis'
|
||||
REDIS_PORT = 6379
|
||||
REDIS_PASSWORD = 'change-me-redis'
|
||||
|
||||
# 短信(需按该项目实际通道填写)
|
||||
SMS_CHANNEL = 'alibaba'
|
||||
SMS_SIGNNAME = '宝应宏煜春商贸'
|
||||
SMS_TEMPLATE = 'SMS_334545236'
|
||||
SMS_KEYID = 'change-me'
|
||||
SMS_KEYSECRET = 'change-me'
|
||||
SMS_SDKAPPID = ''
|
||||
|
||||
# OSS(不启用则走本地 public/upload)
|
||||
FILE_STORAGE = 'public'
|
||||
OSS_ACCESS_ID = ''
|
||||
OSS_ACCESS_SECRET = ''
|
||||
OSS_BUCKET = ''
|
||||
OSS_ENDPOINT = ''
|
||||
OSS_URL = ''
|
||||
|
||||
# 业务标识(须与 H5 configs.js 的 sn_id / appStr 以及积分商城 admin 后台一致)
|
||||
APP_SIGN = '1'
|
||||
APP_SECRET = 'ZFyTNQTWEkCBbyhlc1120529'
|
||||
54
deploy/docker/step1-integral-byhlc112/nginx-edge.conf
Normal file
54
deploy/docker/step1-integral-byhlc112/nginx-edge.conf
Normal file
@@ -0,0 +1,54 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name lehoo6.com admin.lehoo6.com;
|
||||
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
server_name lehoo6.com;
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/lehoo6.com_cert/lehoo6.com.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/lehoo6.com_cert/lehoo6.com.key;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 10m;
|
||||
|
||||
client_max_body_size 50m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://integral-h5:80;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
server_name admin.lehoo6.com;
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/lehoo6.com_cert/lehoo6.com.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/lehoo6.com_cert/lehoo6.com.key;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 10m;
|
||||
|
||||
client_max_body_size 50m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://integral-houtai:8785;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
}
|
||||
}
|
||||
13
deploy/docker/step1-integral-byhlc112/redis.Dockerfile
Normal file
13
deploy/docker/step1-integral-byhlc112/redis.Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
||||
# 使用 Alpine 通过 apk 安装 Redis,绕过镜像源问题
|
||||
FROM alpine:3.19
|
||||
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
|
||||
&& apk add --no-cache redis tzdata \
|
||||
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||
&& echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
VOLUME /data
|
||||
WORKDIR /data
|
||||
EXPOSE 6379
|
||||
|
||||
ENTRYPOINT ["redis-server"]
|
||||
Reference in New Issue
Block a user