1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
"use strict";(self.webpackChunkupage_docs=self.webpackChunkupage_docs||[]).push([[519],{5036:(e,n,l)=>{l.r(n),l.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>d,metadata:()=>s,toc:()=>h});const s=JSON.parse('{"id":"deployment/source","title":"\u6e90\u7801\u90e8\u7f72","description":"\u672c\u6587\u6863\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4ece\u6e90\u7801\u6784\u5efa\u548c\u90e8\u7f72 UPage\u3002\u5982\u679c\u60a8\u5e0c\u671b\u81ea\u5b9a\u4e49 UPage \u6216\u8005\u53c2\u4e0e\u5f00\u53d1\uff0c\u8fd9\u662f\u6700\u5408\u9002\u7684\u90e8\u7f72\u65b9\u5f0f\u3002","source":"@site/content/deployment/source.md","sourceDirName":"deployment","slug":"/deployment/source","permalink":"/upage/deployment/source","draft":false,"unlisted":false,"editUrl":"https://github.com/halo-dev/upage/edit/main/docs/content/content/deployment/source.md","tags":[],"version":"current","frontMatter":{"id":"source","title":"\u6e90\u7801\u90e8\u7f72"},"sidebar":"tutorialSidebar","previous":{"title":"Docker Compose \u90e8\u7f72","permalink":"/upage/deployment/docker-compose"},"next":{"title":"Logto \u8ba4\u8bc1\u96c6\u6210","permalink":"/upage/deployment/logto"}}');var i=l(6106),r=l(8784);const d={id:"source",title:"\u6e90\u7801\u90e8\u7f72"},a="\u6e90\u7801\u90e8\u7f72",c={},h=[{value:"\u524d\u7f6e\u6761\u4ef6",id:"\u524d\u7f6e\u6761\u4ef6",level:2},{value:"\u4e0b\u8f7d\u5e76\u6784\u5efa\u4ee3\u7801",id:"\u4e0b\u8f7d\u5e76\u6784\u5efa\u4ee3\u7801",level:2},{value:"\u514b\u9686\u4ee3\u7801\u5e93",id:"\u514b\u9686\u4ee3\u7801\u5e93",level:3},{value:"\u5b89\u88c5\u4f9d\u8d56",id:"\u5b89\u88c5\u4f9d\u8d56",level:3},{value:"\u914d\u7f6e\u73af\u5883\u53d8\u91cf",id:"\u914d\u7f6e\u73af\u5883\u53d8\u91cf",level:3},{value:"\u751f\u6210 Prisma \u5ba2\u6237\u7aef",id:"\u751f\u6210-prisma-\u5ba2\u6237\u7aef",level:3},{value:"\u5f00\u53d1\u6a21\u5f0f\u4f7f\u7528",id:"\u5f00\u53d1\u6a21\u5f0f\u4f7f\u7528",level:2},{value:"\u751f\u4ea7\u6a21\u5f0f\u4f7f\u7528",id:"\u751f\u4ea7\u6a21\u5f0f\u4f7f\u7528",level:2},{value:"\u542f\u52a8\u670d\u52a1",id:"\u542f\u52a8\u670d\u52a1",level:3},{value:"\u4f7f\u7528 PM2 \u7ba1\u7406\u670d\u52a1\uff08\u53ef\u9009\uff09",id:"\u4f7f\u7528-pm2-\u7ba1\u7406\u670d\u52a1\u53ef\u9009",level:2},{value:"\u5168\u5c40\u5b89\u88c5 PM2",id:"\u5168\u5c40\u5b89\u88c5-pm2",level:3},{value:"\u521b\u5efa PM2 \u914d\u7f6e\u6587\u4ef6",id:"\u521b\u5efa-pm2-\u914d\u7f6e\u6587\u4ef6",level:3},{value:"\u542f\u52a8\u670d\u52a1",id:"\u542f\u52a8\u670d\u52a1-1",level:3},{value:"\u67e5\u770b\u65e5\u5fd7",id:"\u67e5\u770b\u65e5\u5fd7",level:3},{value:"\u76d1\u63a7\u670d\u52a1",id:"\u76d1\u63a7\u670d\u52a1",level:3},{value:"\u5347\u7ea7 UPage",id:"\u5347\u7ea7-upage",level:2},{value:"\u6545\u969c\u6392\u9664",id:"\u6545\u969c\u6392\u9664",level:2},{value:"\u4f9d\u8d56\u5b89\u88c5\u5931\u8d25",id:"\u4f9d\u8d56\u5b89\u88c5\u5931\u8d25",level:3},{value:"\u6784\u5efa\u5931\u8d25",id:"\u6784\u5efa\u5931\u8d25",level:3},{value:"\u6570\u636e\u5e93\u9519\u8bef",id:"\u6570\u636e\u5e93\u9519\u8bef",level:3},{value:"\u65e5\u5fd7\u67e5\u770b",id:"\u65e5\u5fd7\u67e5\u770b",level:3},{value:"\u4e0b\u4e00\u6b65",id:"\u4e0b\u4e00\u6b65",level:2}];function o(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.header,{children:(0,i.jsx)(n.h1,{id:"\u6e90\u7801\u90e8\u7f72",children:"\u6e90\u7801\u90e8\u7f72"})}),"\n",(0,i.jsx)(n.p,{children:"\u672c\u6587\u6863\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4ece\u6e90\u7801\u6784\u5efa\u548c\u90e8\u7f72 UPage\u3002\u5982\u679c\u60a8\u5e0c\u671b\u81ea\u5b9a\u4e49 UPage \u6216\u8005\u53c2\u4e0e\u5f00\u53d1\uff0c\u8fd9\u662f\u6700\u5408\u9002\u7684\u90e8\u7f72\u65b9\u5f0f\u3002"}),"\n",(0,i.jsx)(n.h2,{id:"\u524d\u7f6e\u6761\u4ef6",children:"\u524d\u7f6e\u6761\u4ef6"}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u7684\u7cfb\u7edf\u6ee1\u8db3\u4ee5\u4e0b\u8981\u6c42\uff1a"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Node.js 18.18.0 \u6216\u66f4\u9ad8\u7248\u672c"}),"\n",(0,i.jsx)(n.li,{children:"pnpm 9.4.0 \u6216\u66f4\u9ad8\u7248\u672c"}),"\n",(0,i.jsx)(n.li,{children:"Git"}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"\u4e0b\u8f7d\u5e76\u6784\u5efa\u4ee3\u7801",children:"\u4e0b\u8f7d\u5e76\u6784\u5efa\u4ee3\u7801"}),"\n",(0,i.jsx)(n.h3,{id:"\u514b\u9686\u4ee3\u7801\u5e93",children:"\u514b\u9686\u4ee3\u7801\u5e93"}),"\n",(0,i.jsx)(n.p,{children:"\u9996\u5148\uff0c\u514b\u9686 UPage \u7684\u4ee3\u7801\u5e93\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"git clone https://github.com/halo-dev/upage.git\ncd upage\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u5b89\u88c5\u4f9d\u8d56",children:"\u5b89\u88c5\u4f9d\u8d56"}),"\n",(0,i.jsx)(n.p,{children:"\u4f7f\u7528 pnpm \u5b89\u88c5\u9879\u76ee\u4f9d\u8d56\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm install\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u914d\u7f6e\u73af\u5883\u53d8\u91cf",children:"\u914d\u7f6e\u73af\u5883\u53d8\u91cf"}),"\n",(0,i.jsxs)(n.p,{children:["\u62f7\u8d1d ",(0,i.jsx)(n.code,{children:".env.example"})," \u6587\u4ef6\uff0c\u521b\u5efa ",(0,i.jsx)(n.code,{children:".env"})," \u6587\u4ef6\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"cp .env.example .env\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u914d\u7f6e\u5fc5\u8981\u7684\u73af\u5883\u53d8\u91cf\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"# \u57fa\u7840\u914d\u7f6e\nPORT=3000\nNODE_ENV=production\nOPERATING_ENV=production\nLOG_LEVEL=info\nUSAGE_LOG_FILE=true\nMAX_UPLOAD_SIZE_MB=5\nSTORAGE_DIR=./storage\n\n# AI \u63d0\u4f9b\u5546\u914d\u7f6e\nLLM_PROVIDER=OpenAILike\nPROVIDER_BASE_URL=your-openai-like-api-base-url\nPROVIDER_API_KEY=your-openai-like-api-key\nLLM_DEFAULT_MODEL=your-default-model\nLLM_MINOR_MODEL=your-minor-model\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u60a8\u53ef\u4ee5\u6839\u636e\u9700\u8981\u914d\u7f6e\u4e0d\u540c\u7684 AI \u63d0\u4f9b\u5546\uff0c\u8be6\u7ec6\u914d\u7f6e\u8bf7\u53c2\u8003",(0,i.jsx)(n.a,{href:"../configuration",children:"\u914d\u7f6e\u53c2\u8003"}),"\u3002"]}),"\n",(0,i.jsx)(n.h3,{id:"\u751f\u6210-prisma-\u5ba2\u6237\u7aef",children:"\u751f\u6210 Prisma \u5ba2\u6237\u7aef"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm setup\n"})}),"\n",(0,i.jsx)(n.h2,{id:"\u5f00\u53d1\u6a21\u5f0f\u4f7f\u7528",children:"\u5f00\u53d1\u6a21\u5f0f\u4f7f\u7528"}),"\n",(0,i.jsx)(n.p,{children:"\u5982\u679c\u60a8\u60f3\u5728\u5f00\u53d1\u6a21\u5f0f\u4e0b\u8fd0\u884c UPage\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm dev\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5f00\u53d1\u670d\u52a1\u5668\u542f\u52a8\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"http://localhost:5173\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8fd9\u5c06\u542f\u52a8\u5f00\u53d1\u670d\u52a1\u5668\uff0c\u652f\u6301\u70ed\u91cd\u8f7d\uff0c\u65b9\u4fbf\u60a8\u8fdb\u884c\u5f00\u53d1\u548c\u8c03\u8bd5\u3002"}),"\n",(0,i.jsx)(n.h2,{id:"\u751f\u4ea7\u6a21\u5f0f\u4f7f\u7528",children:"\u751f\u4ea7\u6a21\u5f0f\u4f7f\u7528"}),"\n",(0,i.jsx)(n.p,{children:"\u6784\u5efa UPage \u9879\u76ee\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm build\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u542f\u52a8\u670d\u52a1",children:"\u542f\u52a8\u670d\u52a1"}),"\n",(0,i.jsx)(n.p,{children:"\u542f\u52a8 UPage \u670d\u52a1\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm preview\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u670d\u52a1\u542f\u52a8\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"http://localhost:3000\n"})}),"\n",(0,i.jsx)(n.h2,{id:"\u4f7f\u7528-pm2-\u7ba1\u7406\u670d\u52a1\u53ef\u9009",children:"\u4f7f\u7528 PM2 \u7ba1\u7406\u670d\u52a1\uff08\u53ef\u9009\uff09"}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 PM2 \u6765\u7ba1\u7406 Node.js \u5e94\u7528\u7a0b\u5e8f\uff1a"}),"\n",(0,i.jsx)(n.h3,{id:"\u5168\u5c40\u5b89\u88c5-pm2",children:"\u5168\u5c40\u5b89\u88c5 PM2"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"npm install -g pm2\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u521b\u5efa-pm2-\u914d\u7f6e\u6587\u4ef6",children:"\u521b\u5efa PM2 \u914d\u7f6e\u6587\u4ef6"}),"\n",(0,i.jsxs)(n.p,{children:["\u521b\u5efa ",(0,i.jsx)(n.code,{children:"ecosystem.config.js"})," \u6587\u4ef6\uff1a"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-javascript",children:"module.exports = {\n apps: [{\n name: 'upage',\n script: './server.mjs',\n instances: 1,\n autorestart: true,\n watch: false,\n max_memory_restart: '1G',\n env: {\n NODE_ENV: 'production',\n OPERATING_ENV: 'production',\n PORT: 3000,\n LLM_PROVIDER: 'OpenAILike',\n PROVIDER_BASE_URL: 'your-openai-like-api-base-url',\n PROVIDER_API_KEY: 'your-openai-like-api-key',\n LLM_DEFAULT_MODEL: 'your-default-model',\n LLM_MINOR_MODEL: 'your-minor-model',\n }\n }]\n};\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u542f\u52a8\u670d\u52a1-1",children:"\u542f\u52a8\u670d\u52a1"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pm2 start ecosystem.config.js\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u67e5\u770b\u65e5\u5fd7",children:"\u67e5\u770b\u65e5\u5fd7"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pm2 logs upage\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u76d1\u63a7\u670d\u52a1",children:"\u76d1\u63a7\u670d\u52a1"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pm2 monit\n"})}),"\n",(0,i.jsx)(n.h2,{id:"\u5347\u7ea7-upage",children:"\u5347\u7ea7 UPage"}),"\n",(0,i.jsx)(n.p,{children:"\u5f53\u6709\u65b0\u7248\u672c\u53d1\u5e03\u65f6\uff0c\u60a8\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u5347\u7ea7 UPage\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"# \u62c9\u53d6\u6700\u65b0\u4ee3\u7801\ngit pull origin main\n\n# \u5b89\u88c5\u4f9d\u8d56\npnpm install\n\n# \u6784\u5efa\u9879\u76ee\npnpm build\n\n# \u5f00\u53d1\u73af\u5883\u4f7f\u7528\npnpm dev\n\n# \u751f\u4ea7\u73af\u5883\u4f7f\u7528\npnpm preview\n\n# \u6216\u8005\u5982\u679c\u4f7f\u7528 PM2\npm2 restart upage\n"})}),"\n",(0,i.jsx)(n.h2,{id:"\u6545\u969c\u6392\u9664",children:"\u6545\u969c\u6392\u9664"}),"\n",(0,i.jsx)(n.h3,{id:"\u4f9d\u8d56\u5b89\u88c5\u5931\u8d25",children:"\u4f9d\u8d56\u5b89\u88c5\u5931\u8d25"}),"\n",(0,i.jsx)(n.p,{children:"\u5982\u679c\u4f9d\u8d56\u5b89\u88c5\u5931\u8d25\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u6e05\u9664 pnpm \u7f13\u5b58\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm store prune\npnpm install\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u6784\u5efa\u5931\u8d25",children:"\u6784\u5efa\u5931\u8d25"}),"\n",(0,i.jsx)(n.p,{children:"\u5982\u679c\u6784\u5efa\u5931\u8d25\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u6e05\u9664\u6784\u5efa\u7f13\u5b58\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm clean\npnpm build\n"})}),"\n",(0,i.jsx)(n.h3,{id:"\u6570\u636e\u5e93\u9519\u8bef",children:"\u6570\u636e\u5e93\u9519\u8bef"}),"\n",(0,i.jsx)(n.p,{children:"\u5982\u679c\u9047\u5230\u6570\u636e\u5e93\u76f8\u5173\u9519\u8bef\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u91cd\u65b0\u521d\u59cb\u5316\u6570\u636e\u5e93"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"pnpm prisma migrate reset\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"danger",children:(0,i.jsx)(n.p,{children:"\u8bf7\u6ce8\u610f\uff0c\u8fd9\u5c06\u6e05\u7a7a\u6240\u6709\u6570\u636e\u5e76\u91cd\u7f6e\u6570\u636e\u5e93\uff0c\u5207\u52ff\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u4f7f\u7528\u3002"})}),"\n",(0,i.jsx)(n.h3,{id:"\u65e5\u5fd7\u67e5\u770b",children:"\u65e5\u5fd7\u67e5\u770b"}),"\n",(0,i.jsx)(n.p,{children:"\u68c0\u67e5\u65e5\u5fd7\u6587\u4ef6\u4ee5\u83b7\u53d6\u66f4\u591a\u9519\u8bef\u4fe1\u606f\uff1a"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:"cat logs/combined-*.log\ncat logs/error-*.log\n"})}),"\n",(0,i.jsx)(n.h2,{id:"\u4e0b\u4e00\u6b65",children:"\u4e0b\u4e00\u6b65"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9605\u8bfb",(0,i.jsx)(n.a,{href:"../user-guide/basics",children:"\u7528\u6237\u6307\u5357"}),"\u5b66\u4e60\u5982\u4f55\u4f7f\u7528 UPage \u521b\u5efa\u7f51\u9875"]}),"\n",(0,i.jsxs)(n.li,{children:["\u63a2\u7d22",(0,i.jsx)(n.a,{href:"../configuration",children:"\u914d\u7f6e\u53c2\u8003"}),"\u4e86\u89e3\u6240\u6709\u53ef\u7528\u7684\u914d\u7f6e\u9009\u9879"]}),"\n",(0,i.jsxs)(n.li,{children:["\u63a2\u7d22",(0,i.jsx)(n.a,{href:"./logto",children:"Logto \u8ba4\u8bc1\u96c6\u6210"}),"\u4e86\u89e3\u5982\u4f55\u96c6\u6210 Logto \u5b9e\u73b0\u7528\u6237\u8ba4\u8bc1"]}),"\n"]})]})}function p(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(o,{...e})}):o(e)}},8784:(e,n,l)=>{l.d(n,{R:()=>d,x:()=>a});var s=l(7378);const i={},r=s.createContext(i);function d(e){const n=s.useContext(r);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:d(e.components),s.createElement(r.Provider,{value:n},e.children)}}}]); |