From 96596110ec858484ef9b69b54a1aeef58861fa24 Mon Sep 17 00:00:00 2001 From: eezd Date: Wed, 21 Oct 2026 12:04:53 +0800 Subject: [PATCH] Add Docker Compose deployment and HTTPS proxy configuration --- .dockerignore | 2 ++ .gitignore | 1 + README.md | 14 ++++++++++++++ deploy/docker-compose.yml | 13 +++++++++++++ deploy/nginx/raw.134333.xyz.conf | 30 ++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 deploy/docker-compose.yml create mode 100644 deploy/nginx/raw.134333.xyz.conf diff --git a/.dockerignore b/.dockerignore index 1a4a1e5..d6e75b1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,5 @@ web/node_modules web/dist CONTEXT.md docs +.dev-data +deploy/data diff --git a/.gitignore b/.gitignore index ec693dd..aa30730 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ web/dist/ # 本地开发数据 .dev-data/ +deploy/data/ diff --git a/README.md b/README.md index 3e5198b..35ab8c2 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,20 @@ ## 部署 +本机部署沿用 `/srv/AlphaPulse/deploy` 的目录约定,端口按 `/docker/main/.env` 的工具类分配为 `RAWMARK_PORT=20080`: + +```sh +cd deploy +install -d -m 750 -o 65532 -g 65532 data +docker compose --env-file /docker/main/.env up -d --build --wait +``` + +持久化数据位于 `deploy/data/`,与 `.dev-data/` 独立。首次初始化的启动码位于 `deploy/data/setup-code.txt`。 +宿主机 Nginx 配置为 `deploy/nginx/raw.134333.xyz.conf`,复用现有通配证书及 WebSocket 升级映射;安装到 `/etc/nginx/conf.d/134333.xyz/` 后,先执行 `nginx -t` 再重载。 +域名 `raw.134333.xyz` 在 DNSPod 设置 CNAME 指向 `cdn.134333.xyz`(与 AlphaPulse 一致),Cloudflare 中对应的源站 A 记录指向部署服务器,访问地址为 `https://raw.134333.xyz`。修改端口时需同步端口登记和 Nginx 上游。 + +其他服务器也可直接构建并运行: + ```sh mkdir -p ~/rawmark-data docker build -t rawmark . diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml new file mode 100644 index 0000000..4990cbc --- /dev/null +++ b/deploy/docker-compose.yml @@ -0,0 +1,13 @@ +name: rawmark + +services: + rawmark: + build: + context: .. + image: rawmark:local + restart: unless-stopped + ports: + - "0.0.0.0:${RAWMARK_PORT:-20080}:8080" + volumes: + - ./data:/data + stop_grace_period: 15s diff --git a/deploy/nginx/raw.134333.xyz.conf b/deploy/nginx/raw.134333.xyz.conf new file mode 100644 index 0000000..9e88c54 --- /dev/null +++ b/deploy/nginx/raw.134333.xyz.conf @@ -0,0 +1,30 @@ +# raw.134333.xyz -> RawMark 容器(127.0.0.1:20080) + +server { + listen 80; + server_name raw.134333.xyz; + return 308 https://raw.134333.xyz$request_uri; +} +server { + listen 443 ssl; + http2 on; + server_name raw.134333.xyz; + + include /etc/nginx/snippets/ssl-134333.xyz.conf; + include /etc/nginx/snippets/no-spider.conf; + access_log /var/log/nginx/raw.134333.xyz.log; + error_log /var/log/nginx/raw.134333.xyz.error.log warn; + + location / { + proxy_pass http://127.0.0.1:20080; + proxy_http_version 1.1; + proxy_buffering off; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 1h; + } +}