From 17b92d8c2365ba6ca9ac0b414c4964354508faa0 Mon Sep 17 00:00:00 2001 From: WuYongJie <549727955@qq.com> Date: Mon, 10 Aug 2026 10:54:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2=EF=BC=9A=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=96=B0=E7=94=9F=E4=BA=A7=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 4 ++-- deploy/host-nginx-http.conf | 2 +- deploy/host-nginx.conf | 4 ++-- deploy/setup-https.sh | 2 +- docs/开发与部署SOP.md | 16 ++++++++-------- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index b6cae44f..0ac444f4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -106,10 +106,10 @@ ### 8.2 服务器红线 -- 当前服务器只有 2GB 内存,只负责运行容器、健康检查和镜像切换。 +- 当前生产服务器约有 16GB 内存,仍只负责运行容器、健康检查和镜像切换。 - 严禁在服务器执行 `docker build`、`docker compose build`、`npm install`、`npm run production`、`composer install` 或其他源码构建命令。 - `compose.jiangling.yml` 不得出现 `build:`;服务器只能运行开发机已经构建并上传的 `caiwu_akaunting:` 镜像。 -- 生产访问地址固定为 `https://118.196.84.79`(不附加端口);宿主机 Nginx 监听 `80/443`,HTTP 自动跳转 HTTPS,应用容器仅绑定 `127.0.0.1:18088`。 +- 生产访问地址固定为 `https://218.93.190.75`(不附加端口);宿主机 Nginx 监听 `80/443`,HTTP 自动跳转 HTTPS,应用容器仅绑定 `127.0.0.1:18088`。 - HTTPS 使用 Let’s Encrypt 短期 IP 证书,服务器定时器每 8 小时检查续期;证书、私钥和 ACME 账户不得进入 Git 或应用镜像。 - `mariadb:11.4` 运行镜像由开发机缓存并仅随首次初始化全量包上传,服务器不得在发布时临时访问 Docker Hub。 - 日常发布必须通过只监听 `127.0.0.1` 的服务器本机 Registry 和 SSH 隧道传输,仅上传 Registry 中不存在的镜像层;禁止每次上传完整 `docker save` 压缩包。 diff --git a/deploy/host-nginx-http.conf b/deploy/host-nginx-http.conf index efec9ac4..9da4b4ce 100644 --- a/deploy/host-nginx-http.conf +++ b/deploy/host-nginx-http.conf @@ -1,7 +1,7 @@ server { listen 80 default_server; listen [::]:80 default_server; - server_name 118.196.84.79; + server_name 218.93.190.75; client_max_body_size 12m; diff --git a/deploy/host-nginx.conf b/deploy/host-nginx.conf index 52fa0de7..dc2be2e3 100644 --- a/deploy/host-nginx.conf +++ b/deploy/host-nginx.conf @@ -1,7 +1,7 @@ server { listen 80 default_server; listen [::]:80 default_server; - server_name 118.196.84.79; + server_name 218.93.190.75; location ^~ /.well-known/acme-challenge/ { root /var/www/letsencrypt; @@ -16,7 +16,7 @@ server { server { listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; - server_name 118.196.84.79; + server_name 218.93.190.75; ssl_certificate /etc/letsencrypt/live/caiwuxitong-ip/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/caiwuxitong-ip/privkey.pem; diff --git a/deploy/setup-https.sh b/deploy/setup-https.sh index 33bd0185..f7a41f40 100644 --- a/deploy/setup-https.sh +++ b/deploy/setup-https.sh @@ -13,7 +13,7 @@ if [ "$(id -u)" -ne 0 ]; then exit 1 fi -if [ "$SERVER_IP" != "118.196.84.79" ]; then +if [ "$SERVER_IP" != "218.93.190.75" ]; then echo "Refusing to configure an unexpected server IP: $SERVER_IP" >&2 exit 1 fi diff --git a/docs/开发与部署SOP.md b/docs/开发与部署SOP.md index 4e659fe0..1659ad80 100644 --- a/docs/开发与部署SOP.md +++ b/docs/开发与部署SOP.md @@ -22,7 +22,7 @@ 任务分支开发 -> 本机验证 -> PR -> 任务 Codex 独立自审 -> 合并并验证 main -> 开发机复用缓存构建镜像 -> 经 SSH 隧道只上传变化的镜像层 - -> 2GB 服务器只拉取本机 Registry 并切换镜像 + -> 生产服务器只拉取本机 Registry 并切换镜像 -> 本机后端检查 + 公网 HTTPS 验收 -> 保留当前与上一个镜像,清理其余本项目产物 ``` @@ -68,7 +68,7 @@ ```powershell .\scripts\deploy-from-workstation.ps1 ` - -Server 118.196.84.79 ` + -Server 218.93.190.75 ` -KeyPath "C:\Users\你的用户名\.ssh\caiwu.pem" ` -BootstrapServer ``` @@ -76,7 +76,7 @@ 初始化脚本会: - 使用服务器现有 Ubuntu 安全更新源安装并启动 Docker 与 Compose; -- 为 2GB 服务器增加 2GB swap(交换空间),仅用于运行时缓冲; +- 服务器未配置 swap 时增加 2GB 交换空间,仅用于运行时缓冲; - 创建 `/opt/caiwuxitong/runtime/.env`; - 在服务器本地生成数据库密码和 Laravel `APP_KEY`,不会打印出来; - 创建持久化数据库卷和运行文件卷;运行文件卷继续保存缓存、临时文件和可回滚的旧上传原件。 @@ -88,14 +88,14 @@ ```powershell .\scripts\deploy-from-workstation.ps1 ` - -Server 118.196.84.79 ` + -Server 218.93.190.75 ` -KeyPath "C:\Users\你的用户名\.ssh\caiwu.pem" ` -ConfigureHttps ``` 该步骤在服务器安装轻量 Nginx 和独立 Certbot 环境,为公网 IP 申请 Let’s Encrypt 短期证书,并启用每 8 小时检查一次的自动续期。服务器仍不构建任何应用源码或镜像。 -首次打开 `https://118.196.84.79` 后,由负责人或指定人员在网页安装向导中设置管理员账号和密码。 +首次打开 `https://218.93.190.75` 后,由负责人或指定人员在网页安装向导中设置管理员账号和密码。 ## 5. 日常正式发布 @@ -106,7 +106,7 @@ git switch main git pull --ff-only .\scripts\deploy-from-workstation.ps1 ` - -Server 118.196.84.79 ` + -Server 218.93.190.75 ` -KeyPath "C:\Users\你的用户名\.ssh\caiwu.pem" ``` @@ -144,7 +144,7 @@ git pull --ff-only ```powershell .\scripts\deploy-from-workstation.ps1 ` - -Server 118.196.84.79 ` + -Server 218.93.190.75 ` -KeyPath "C:\Users\你的用户名\.ssh\caiwu.pem" ` -AllowMigrations ``` @@ -368,7 +368,7 @@ php artisan system-database:reencrypt-upstream-passwords --apply - 发布分支和完整 Git SHA; - 镜像标签; - 服务器 `caiwu_app`、`caiwu_db` 状态; -- `https://118.196.84.79` 的实际返回结果和证书有效期; +- `https://218.93.190.75` 的实际返回结果和证书有效期; - 是否执行数据库迁移; - 本地临时包是否删除; - 本地/服务器保留了几个本项目镜像; -- 2.47.2