如何使用Express,Nginx和pm2部署Parse Server

问题描述 投票:0回答:2

我已经成功地将解析服务器与pm2,MongoDB和Nginx一起部署了,我可以从本地主机外部对其进行POST和GET。我在DigitalOcean上执行此操作,并使用此page作为参考。我现在想将ExpressJS添加到解析的npm全局安装中,但我不知道该怎么做。根据Parse教程parse-server-example,通过手动使用“ npm start”使我可以使用Parse + ExpressJS。如何在全局安装中包括它,以便在pm2开始解析时将其包括在内?

这是我的ecosystem.json,如果有用的话。

{                                      
    "apps" : [{
      "name"        : "parse-wrapper",
      "script"      : "/usr/local/bin/parse-server",
      "watch"       : true,
      "merge_logs"  : true,               
      "cwd"         : "/home/parse",       
      "env": {                             
        "PARSE_SERVER_CLOUD_CODE_MAIN": "/home/parse/cloud/main.js",
        "PARSE_SERVER_DATABASE_URI": "mongodb://<user>:<password>@127.0.0.1:27017/dev",                        
        "PARSE_SERVER_APPLICATION_ID": "<myAppId>",
        "PARSE_SERVER_MASTER_KEY": "myMasterKey",
      }                                 
    }]                                   
}

我使用的pm2命令序列是:

pm2 start ecosystem.json
pm2 save
sudo pm2 startup ubuntu -u parse --hp /home/parse/

谢谢您的帮助。

express parse-platform pm2
2个回答
0
投票

基于您的参考回购快递,已经使用package.json与Parse一起安装了您可以在index.js

中使用快速方法

不需要像在package.json文件中已经提到的那样将express安装为全局文件

要开始使用pm2,您可以如下提及脚本参数

script: "npm run start"

将生态系统.json移动到项目根文件夹中,然后在项目文件夹中运行pm2 start命令。


0
投票

我知道了,这是我用来配置pm2的命令序列。

<login as the parse user, or su -l parse>
git clone https://github.com/ppk007/parse-server-example ~/git/parse-server-dev
cd ~/get/parse-server-dev
npm install
<change the config files - I edited index.js>
pm2 start index.js
pm2 save
exit # exit the parse user shell and go to the normal user shell
sudo pm2 startup ubuntu -u parse --hp /home/parse/
© www.soinside.com 2019 - 2024. All rights reserved.