Ver Fonte

docs: 新增部署文档

zhangyuhan há 1 ano atrás
pai
commit
c5c8bafe89
1 ficheiros alterados com 53 adições e 19 exclusões
  1. 53 19
      README.md

+ 53 - 19
README.md

@@ -1,7 +1,45 @@
 
-# PDF 生成服务
+# PDF、HTML 生成服务
+
+> 基于 puppeteer koa 的 pdf、html 生成服务
+
+
+## 部署
+
+### node相关环境
+1. 安装 Node V16.18.1 版本
+2. 安装 yarn
+```
+npm install -g yarn
+```
+3. 安装项目依赖
+```
+yarn install
+```
+
+> puppeteer 需要安装 chrome,需接入国际互联网。
+
+```
+npx @puppeteer/browsers install chrome@latest 
+```
+
+### nginx API代理
+1. 将当前服务 http://localhost:8088 对外提供。
+
+2. 将 /prod-api/* 的请求代理到测试环境,或正式环境。
+
+```
+# 该配置未经测试,仅供参考,请自行配置
+
+location /prod-api/ {
+    proxy_pass https://www.jianyu360.cn/;
+    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 $scheme;
+}
+```
 
-> 基于 puppeteer koa 的 pdf 生成服务
 
 ## 启动
 
@@ -9,9 +47,22 @@
 yarn run serve
 `
 ## 访问
+
+### 可视化界面-生成服务
+`
+http://localhost:8088/page_big_pc/#/pdf-create
+`
+### 生成PDF接口
 `
 http://localhost:8088/api/to-pdf/文件名?dir=目录名&url=https://www.baidu.com?search=test
 `
+### 生成HTML接口
+> 已锁定页面ID选择器,不支持自定义页面生成,仅限 page_big_pc/#/html-report 页面可用
+
+`
+http://localhost:8088/api/to-html/文件名?dir=目录名&url=https://www.baidu.com?search=test
+`
+
 
 ## 配置项
 
@@ -24,20 +75,3 @@ height: puppeteer设置 高度
 ... 更多 puppeteer 设置
 
 url: 页面URL(如含有query参数,务必作为最后一个参数,详见代码参数截取逻辑)
-
-
-## Docker 启动命令
-
-`docker build -t pdfserver .`
-
-`docker run -p 8081:8088 -v /opt/Downloads/:/home/create-pdf/web/pdf-files --privileged=true -d pdfserver`
-
-`docker run -p 8079:8088 -v /nas/shareFile/pdffiles/:/home/create-pdf/web/pdf-files --privileged=true -d -m 2048M --memory-swap=4096M --cpus=4 pdfserver`
-
-
-## 特殊提示
-
-### pdf 页头页尾植入
-> 参考 index.html \ test.html
-> 
-> 最终版本参照剑鱼项目报告