pm2

Will PM2 work with Node.js net API?

梦想与她 提交于 2019-12-11 18:27:15
问题 Background I need to make a server app that listens to several TCP connections. This app must be lightweight and the TCP connections will come from GPS devices ( not from browsers, so I can't use WebSockets for example ). Research To make sure this scales properly to thousands of devices I need to take full advantage of all the machines CPUs. According to my research I found 2 ways of doing it: Create a net server and use the native cluster API Node.js provides Create an app and use PM2 to

PM2 常用命令

萝らか妹 提交于 2019-12-11 15:49:35
PM2 常用命令 $ pm2 start app.js # 启动app.js应用程序 $ pm2 start app.js -i 4 # cluster mode 模式启动4个app.js的应用实例 4个应用程序会自动进行负载均衡 $ pm2 start app.js --name=“api” # 启动应用程序并命名为 “api” $ pm2 start app.js --watch # 当文件变化时自动重启应用 $ pm2 start script.sh # 启动 bash 脚本 $ pm2 list # 列表 PM2 启动的所有的应用程序 $ pm2 monit # 显示每个应用程序的CPU和内存占用情况 $ pm2 show [app-name] # 显示应用程序的所有信息 $ pm2 logs # 显示所有应用程序的日志 $ pm2 logs [app-name] # 显示指定应用程序的日志 $ pm2 flush # 清空所有日志文件 $ pm2 stop all # 停止所有的应用程序 $ pm2 stop 0 # 停止 id为 0的指定应用程序 $ pm2 restart all # 重启所有应用 $ pm2 reload all # 重启 cluster mode下的所有应用 $ pm2 gracefulReload all # Graceful reload

How can I fix this 404 issue that I am having whenever Ubuntu is accessed from an external port. It could be an Ubuntu, pm2, nginx, or express problem

独自空忆成欢 提交于 2019-12-11 15:31:07
问题 I am getting a web page titled " 404 - Not Found " whenever I make a request to my Ubuntu server. So whenever I type my IP address into chrome it gives me the 404. Initially I thought it was an nginx problem because I didn't think the reverse proxy was working. I didn't think it was working because when I hit my domain wwww.mydomain.com it would give me the same 404 page I have been getting. Also I could take www.mydomain.com:4000 and it would load the website. Currently I can still do this

Restart node.js after crash in pm2

喜欢而已 提交于 2019-12-11 14:43:33
问题 According to this question, pm2 should restart crashed applications. When my application crashes nothing happens and the process is missing from pm2 list . Do I have to somehow activate an 'auto restart option'? I am using: pm2 v0.12.3 node v0.11.14 Amazon Linux 回答1: I've had poor results trying to use PM2 as the sole means by which to monitor my Node.js applications. In the end the approach I took was to use to Monit to monitor the application process and use pm2 within the monit

Unable to install npm package || permission denied

我们两清 提交于 2019-12-11 08:43:03
问题 I am getting the following error while installing PM2. I have also tried installing it locally but nothing seems to be working. please help. Command:npm install pm2 -g anil@anil:~/Desktop/restapis$ npm install pm2 -g npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/pm2/node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch

Mapping docker port is failed

左心房为你撑大大i 提交于 2019-12-11 05:41:07
问题 Created new docker image(rm/node:10.0) with centos7 using below dockerfile. FROM rm/node:9.0 EXPOSE 3000 WORKDIR /Reader_Manager/SISPlatform/Auth RUN npm install WORKDIR /Reader_Manager/SISPlatform/Auth/portal CMD npm run-script dev-server-linux "npm run-script dev-server-linux" will invoke below command which defined in package.json file "dev-server-linux": "export NODE_ENV=development && pm2 start --no-daemon AuthServer -o ../../logs/pm2/out/auth_out.log -e ../../logs/pm2/err/auth_error.log

phantomjs-node crashes when attempting to scale behind node-cluster

你。 提交于 2019-12-10 18:35:32
问题 Associated GitHub issue: https://github.com/sgentle/phantomjs-node/issues/280 I have a simple app that does the following: var phantom = require('phantom'), express = require('express'), serve = express(); serve.get('/foo', function (req, res) { try { phantom.create(function (ph) { console.log('Phantom browser created w/ pid: ', ph.process.pid); ph.onError = function (msg, trace) { var msgStack = ['PHANTOM ERROR: ' + msg]; if (trace && trace.length) { msgStack.push('TRACE:'); trace.forEach

Command 'exit' doesn't work when some background process is still piping out

允我心安 提交于 2019-12-10 11:57:35
问题 The 'exit' command doesn't work for my case, and I don't get it why: ssh user@mysever <<'HEREDOC' echo "1. Running PM2 log..." pm2 log & echo "2. PM2 log is now in background" exit echo "3. Won't be here" HEREDOC echo "4. Out." I can't terminate the ssh pipeline, even with the 'exit' command above. I can see the first echo, second echo; no third echo of course; and stuck. I expected the behaviour that I can see the fourth echo. I have to press Ctrl+C, and I see the 4th echo after that. 回答1:

Ubuntu18.04 部署Python脚本开机自启,最稳定解决方案

若如初见. 提交于 2019-12-10 02:34:16
文章目录 Ubuntu10.04 开机自启 更简单高效地添加开机自启和守护进程 安装 PM2 使用PM2启动Python脚本 查看启动列表 查看进程日志 查看进程描述信息 重启进程 停止进程 删除进程 让 PM2 开机自启 执行PM2自启命令 Ubuntu10.04 开机自启 Ubuntu在16.04版本以后就不再使用 initd 管理系统了,改用 systemd 当然,我们还是可以通过软链接,创建systemd文件的形式启用rc.local。但是在rc.local中执行启动脚本也有很多不便之处,比如日志输出和守护进程。。。 更简单高效地添加开机自启和守护进程 PM2 是一个生产级流程管理器,可以轻松管理后台进程。PM2有着良好的命令行使用体验,可以用简单、方便的操作重启崩溃程序,查看程序日志和资源使用情况。 安装 PM2 PM2是 Node 界的东西,但是并不妨碍我们用它来启动Python脚本。Node 界的东西,安装之前是肯定要安装Node 的,然后是 npm 注意:下面的命令需要在root账户下执行。pm2是会区分用户的,root账户启动的脚本其他账户是不可见的,必须要切换到root下执行 pm ls 才能看到root账户使用pm2启动的程序 安装Node.js curl -sL https://deb.nodesource.com/setup_10.x | sudo -E

permission denied, mkdir in container on openshift

落爺英雄遲暮 提交于 2019-12-09 12:41:06
问题 I have a container with nodejs and pm2 as start command and on OpenShift i get this error on startup: Error: EACCES: permission denied, mkdir '/.pm2' I tried same image on a Marathon hoster and it worked fine. Do i need to change something with UserIds? The Dockerfile: FROM node:7.4-alpine RUN npm install --global yarn pm2 RUN mkdir /src COPY . /src WORKDIR /src RUN yarn install --production EXPOSE 8100 CMD ["pm2-docker", "start", "--auto-exit", "--env", "production", "process.yml"] Update