Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactPress 生产环境如何部署? #7

Open
redteav2 opened this issue Nov 24, 2024 · 2 comments
Open

ReactPress 生产环境如何部署? #7

redteav2 opened this issue Nov 24, 2024 · 2 comments
Assignees

Comments

@redteav2
Copy link

目前看了README中的部署流程,主要是本地开发的流程,请问生产环境如何部署呢?

@fecommunity
Copy link
Owner

环境准备

$ git clone --depth=1 https://github.com/fecommnity/reactpress.git
$ cd reactpress
$ npm i -g pnpm
$ pnpm i

配置文件

项目启动后会加载根目录下的 .env 配置文件,请确保MySQL数据库服务和下面的配置保持一致,并提前创建好 reactpress 数据库

DB_HOST=127.0.0.1 // 数据库地址
DB_PORT=3306 // 端口
DB_USER=reactpress // 用户名
DB_PASSWD=reactpress // 密码
DB_DATABASE=reactpress // 数据库

环境准备好后,执行启动命令:

$ pnpm run build

启动服务

$ pnpm run pm2

至此,ReactPress 服务就启动成功了。

代码更新启动

当ReactPress代码更新后,可以按照如下Shell重新启动服务:

# 更新代码
git checkout master
git pull

# 安装依赖&构建
pnpm install
pnpm run build

# 启动进程
pm2 delete @reactpress/server
pm2 delete @reactpress/client
pnpm run pm2

# 开机启动
pm2 startup
pm2 save

以上就是ReactPress生成环境的完整部署流程。

具体可以参考下这篇文章:https://blog.gaoredu.com/knowledge/c7edfecf-4f47-4bd3-ba93-093e43cf5314/880aa991-c47a-4f9f-bd0f-7c41e47cb94d

@redteav2
Copy link
Author

感谢🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants