pm2

Using a batch file to start pm2 when windows starts?

≡放荡痞女 提交于 2020-05-15 13:25:25
问题 I can't get pm2 to start my apps on Windows start. I'm running Windows Server 2012 R2 Standard and pm2 2.4.2 . I have a pm2 process file in JSON format which I use to start all my apps. c:\pm2\process.json { "apps": [ { "name" : "my-app", "script" : "c:\\node\\myapp\index.js" } ] } I have a batch file which uses the JSON file: c:\pm2\pm2-startup.bat @echo off set HOMEDRIVE=C: set PM2_HOME=C:\etc\.pm2 setx /M PM2_HOME C:\etc\.pm2 cd C:\pm2 & pm2 start process.json I have a Windows task

Using a batch file to start pm2 when windows starts?

微笑、不失礼 提交于 2020-05-15 13:25:11
问题 I can't get pm2 to start my apps on Windows start. I'm running Windows Server 2012 R2 Standard and pm2 2.4.2 . I have a pm2 process file in JSON format which I use to start all my apps. c:\pm2\process.json { "apps": [ { "name" : "my-app", "script" : "c:\\node\\myapp\index.js" } ] } I have a batch file which uses the JSON file: c:\pm2\pm2-startup.bat @echo off set HOMEDRIVE=C: set PM2_HOME=C:\etc\.pm2 setx /M PM2_HOME C:\etc\.pm2 cd C:\pm2 & pm2 start process.json I have a Windows task

pm2 Unexpected token import

天涯浪子 提交于 2020-05-15 10:52:08
问题 I have a webserver that works when I use node or nodemon (e.g. "nodemon index.js"). However, when I try to use pm2 ("pm2 start index.js"), I get "SyntaxError: Unexpected token import". The full error log is below. What am I doing wrong here? /usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:29 import(process.env.pm_exec_path); ^^^^^^ SyntaxError: Unexpected token import at new Script (vm.js:51:7) at createScript (vm.js:136:10) at Object.runInThisContext (vm.js:197:10) at Module.

What's the difference between pm2 and pm2-runtime?

一曲冷凌霜 提交于 2020-05-11 04:28:19
问题 I've been transferring some projects that have been executing on the same machine to individual dockers each. I've tried to use pm2 on one of these docker projects to make sure the service would restart if something go wrong (it's a volatile project) and some of the examples demands the Dockerfile to use pm2-runtime instead of pm2 . I've been searching for the differences of these two but I couldn't find something specific, could someone help? 回答1: The main difference between pm2 and pm2

How to start node.js app with pm2 in cluster mode?

冷暖自知 提交于 2020-05-09 19:40:19
问题 We are trying to start our app with pm2 0.12.8 on ubuntu 14.04 with octa core proccessor. The read me on the git hub has a very straight forward command for running node app in cluster mode. # Cluster mode $ pm2 start app.js -i 0 **# Will start maximum processes with LB depending on available CPUs** $ pm2 start app.js -i max **# Same as above, but deprecated yet.** But the above command are not working for us. When we try to run these commands only one instance is listed by pm2. Why? Any

Running Node app via PM2 on port 80

北战南征 提交于 2020-04-12 11:55:36
问题 I have an express that I want to run on port 80. --> app.listen(80); I'm using PM2 to manage the app (restarting, stopping, monitoring, etc.) . I have a deployment shell script whose last command is PM2 restart index . From the console output, I see no errors and PM2 reports that it successfully completed the command. Yet when I got to my.ec2.ip.address:80 the site is not up. Furthermore, if I run node index.js in my server project directory, I get a Error: listen EACCES 0.0.0.0:80 . This

Running Node as a service with PM2 - connection refused

一曲冷凌霜 提交于 2020-04-11 03:11:32
问题 I am following this tutorial for setting up a node project on a Digital Ocean Ubuntu distribution. systemctl status pm2 shows the service is online: App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching server │ 1 │ fork │ 19999 │ online │ 0 │ 0s │ 21.219 MB │ disabled │ However I get a connection refused error when I attempt to navigate to the domain. The application starts fine on port 5000 if I run it with npm start. I have Nginx installed and configured as follows:

CentOS 7.4安装nodejs & nginx & pm2

橙三吉。 提交于 2020-03-20 18:33:25
一、安装nodejs 1、查看操作系统信息    uname -a      cat /etc/centos-release    2、安装wget    yum install wget -y 3、安装nodejs   1、下载 wget https://nodejs.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.xz   2、解压 xz -d node-v10.13.0-linux-x64.tar.xz   3、解压 tar xvf node-v10.13.0-linux-x64.tar   4、安装nodejs     1、cd node-v10.13.0-linux-x64     2、cd bin     3、mv ./node /bin/     4、mv ./npm /bin/     5、mv ./npx /bin/     6、cd .. cd lib     7、mv ./node_modules /lib/   5、安装nrm     # npm install nrm -g   6、安装 ngnix       #rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm  

centos6安装yapi

馋奶兔 提交于 2020-03-20 12:30:38
环境要求 nodejs(7.6+) mongodb(2.6+) git 此处nodejs和git安装非常简单,此处只记录mongodb的安装过程: 安装mongodb curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6.tgz # 下载 tar -zxvf mongodb-linux-x86_64-3.0.6.tgz # 解压 mv mongodb-linux-x86_64-3.0.6/ /usr/local/mongodb # 将解压包拷贝到指定目录 MongoDB 的可执行文件位于 bin 目录下,所以可以将其添加到 PATH 路径中: vi ~/.bashrc 在.bashrc文件内最后面添加: export PATH=/usr/local/mongodb/bin:$PATH 保存文件退出,执行命令 source ~/.bashrc 创建数据库目录 MongoDB的数据存储在data目录的db目录下,但是这个目录在安装过程不会自动创建,所以你需要手动创建data目录,并在data目录中创建db目录。 以下实例中我们将data目录创建于根目录下(/)。 创建mongod日志文件在/data/db/logs/目录下 注意:/data/db 是 MongoDB 默认的启动的数据库路径(-

nuxt.js项目上传部署到服务器(ubuntu+nginx+node+pm2)

雨燕双飞 提交于 2020-03-02 03:11:47
全篇比较啰嗦,可以酌情选择对自己有帮助的看。 1.购买一个服务器 ​ 有服务器的可以自行跳过哈。 ​ 有闲置电脑的话也可以,具体的可以自己找找看,我这篇主要说网上的云服务器。 ​ 不过这几天阿里云有活动, 大学生免费送半年ECS服务器 ,前提是原来没有ECS服务器,如果原来有轻量应用服务器的话也是可以再领的(正好到期了,不用续费了哈哈哈), 活动网址:https://developer.aliyun.com/adc/student/ ​ 如果不是学生的话,只能自己购买了,购买的话基本是傻瓜式的,不解释了。可以自己从任何地方买。 阿里云ECS服务器购买:https://www.aliyun.com/product/ecs ​ 系统的话本篇是Ubuntu 16.04.6 ,centos也行,大同小异都是Linux。不过如果你是初学者,最好和我使用一样的,因为因为发行版本不同而导致的差异可能导致运行某些东西失败,找问题要找好久。windows server不推荐了,企业用的多,小服务器跑windows server比较费劲。 具体区别:https://www.linuxprobe.com/ubuntu-comparison-centos.html 1.1购买域名 域名可买可不买,就是方便记忆你的网址,没有什么实质的用处。 我选择的万网,地址给你们,自己看着挑,反正不是很贵。 万网