pm2

机器学习系列(1)——机器学习介绍

蹲街弑〆低调 提交于 2019-12-02 15:01:11
Framework 以影像辨识为例,我们找个function输入一张图片,机器告诉我们这个图片里有什么样的东西。 在做这件事时,首先要准备一个 function set (集合),这个function里面有成千上万的function。举例来说,这个function在里面,有一个f1,你给它看一只猫,他就告诉你输出猫,看到一只狗就输出狗。有一个function f2他很怪,你给他看猫,他说是猴子;你给它看狗,他说是蛇。总之,先假设我们手上有一个function set,这个function set就叫做 model (模型)。 有了这个function set,接下来机器要做的事情是:他有一些训练的资料,这些训练资料告诉机器说一个好的function,它的输入输出应该长什么样子,有什么样的关系。你告诉机器说,现在这个影像辨识的问题里面,如果看到这个猴子图要输出猴子,看到这个猫的图也要输出猫,看到这个狗的图也要输出狗,这样才是对的。只有这些训练资料,你拿出一个function,机器就可以判断说,这个function是好的还是不好的。 机器可以根据训练资料判断一个function是好的,还是不好的。举例来说:在这个例子里面显然f1,他比较符合training data的叙述,比较符合我们的只是。所以f1看起来是比较好的,f2看起来是一个荒谬的function。以上讲的这个task叫做

Sails Js permissions

随声附和 提交于 2019-12-02 07:36:42
I got a sailsjs app on a debian server. My only user is root, I installed everything in root (npm install, npm install sails -g, npm install pm2 -g). When I try to deploy it with my root user (sails lift --prod), I got permissions errors : Grunt :: Running "clean:dev" (clean) task Grunt :: Cleaning .tmp/public... Grunt :: Warning: Cannot delete files outside the current working directory. ** Grunt :: An error occurred. ** error: ------------------------------------------------------------------------ Aborted due to warnings. Running "clean:dev" (clean) task Cleaning .tmp/public...Warning:

node.js中pm2启动应用出错

六眼飞鱼酱① 提交于 2019-12-02 05:27:02
在将公司的应用容器化时,遇到的问题。 之前,同事使用node.js 6版本运行,pm2启动js文件,一切正常。 但我一样将node.js 6版本安装,然后npm install pm2完成。 运行pm2时始终报错: .... async function (options) { 12:09:59 0|websocket | ^^^^^^^^ 12:09:59 0|websocket | SyntaxError: Unexpected token function 12:09:59 0|websocket | at createScript (vm.js:56:10) 12:09:59 0|websocket | at Object.runInThisContext (vm.js:97:10) 12:09:59 0|websocket | at Module._compile (module.js:549:2 ....    之后,进行其它尝试,总是在async remove, await等这些地方报错。 今天描了一下安装的版本,发现pm2现在默认安装的是4.1.2版本, 问了同事,生产上安装的是3.2.2或3.5.1版本, 然后,将npm安装时,指定好pm2版本之后, 问题搞定。 npm --registry https://registry.npm.taobao.org

Use sudo inside Dockerfile (Alpine)

浪尽此生 提交于 2019-12-01 20:19:59
I have this Dockerfile ... FROM keymetrics/pm2:latest-alpine RUN apk update && \ apk upgrade && \ apk add \ bash COPY . ./ EXPOSE 1886 80 443 CMD pm2-docker start --auto-exit --env ${NODE_ENV} ecosystem.config.js How can I execute the CMD command using sudo ? I need to do this because the port 443 is allowed only for sudo user. The su-exec can be used in alpine. Do add it the package, if not already available, add the following to your Dockerfile RUN apk add --no-cache su-exec Inside your scripts you'd run inside docker you can use the following to become another user: exec su-exec <my-user>

How to make sticky session works with socket.io (w/ or w/o pm2)?

百般思念 提交于 2019-12-01 20:11:20
问题 Although the socket.io document said 'sticky session' can make socket.io work with node cluster. I just can't make it work. I find pm2 had several issues opened against it, the closest solution I can find is this, "force to use websock option only", don't use sticky session at all. Has anyone had any experience that makes node cluster work with socket.io? ------- update -------- I checked the other two sticky session implementations mentioned here, sticky-session vs socket.io-sticky-session

How to make sticky session works with socket.io (w/ or w/o pm2)?

僤鯓⒐⒋嵵緔 提交于 2019-12-01 18:05:26
Although the socket.io document said ' sticky session ' can make socket.io work with node cluster. I just can't make it work. I find pm2 had several issues opened against it, the closest solution I can find is this , "force to use websock option only", don't use sticky session at all. Has anyone had any experience that makes node cluster work with socket.io? ------- update -------- I checked the other two sticky session implementations mentioned here, sticky-session vs socket.io-sticky-session node js library ! Which is better? , find 'sticky-cluster' can do the job. Another lesson I learned

Expressjs pm2 ignore watch public/images folder

泄露秘密 提交于 2019-12-01 16:27:02
I have a website using nodejs. Problem is when user upload images the site stop working. That because of PM2 restart server when file change I think. How to solve this problem. thank you PM2 has special flag --ignore-watch flag. Try creating file process.json in the same directory where your app.js/index.js is and paste this: { "watch": ["server", "client"], "ignore_watch" : ["node_modules", "public/images"], "watch_options": { "followSymlinks": false } } More on that topic: http://pm2.keymetrics.io/docs/usage/watch-and-restart/ A simple explanation, from actual experience create a json file

Expressjs pm2 ignore watch public/images folder

可紊 提交于 2019-12-01 15:22:10
问题 I have a website using nodejs. Problem is when user upload images the site stop working. That because of PM2 restart server when file change I think. How to solve this problem. thank you 回答1: PM2 has special flag --ignore-watch flag. Try creating file process.json in the same directory where your app.js/index.js is and paste this: { "watch": ["server", "client"], "ignore_watch" : ["node_modules", "public/images"], "watch_options": { "followSymlinks": false } } More on that topic: http://pm2

一、Centos下搭建sinopia服务

浪子不回头ぞ 提交于 2019-12-01 15:09:10
  因为工作中多个项目同步开发,vue公共前端模块需要共享,但是又不能传到公共npm上,所以需要搭建私有npm服务。经过调研,采用了sinopia的解决方案,具体搭建步骤如下:   1、Centos下安装npdejs: curl --silent --location https://rpm.nodesource.com/setup_5.x | bash - yum -y install nodejs   2、通过npm安装sinopia npm install -g sinopia   3、因为sinopia不再root账号下运行,故进入其他账号(我用的是app),然后启动sinopia sinopia   4、打开/home/app/.config/sinopia/config.yaml进行修改 # # This is the default config file. It allows all users to do anything, # so don't use it on production systems. # # Look here for more config file examples: # https://github.com/rlidwka/sinopia/tree/master/conf # # path to a directory with all

Multer upload files with PM2

强颜欢笑 提交于 2019-12-01 10:31:21
问题 i have a express app and am using multer to uploads files, the problem is when i running the app in the production server with PM2 the multer upload file gave me an error: "Error: ENOENT: no such file or directory, open 'uploads/img.png' at Error (native)" but when i run it with "Debug=projectname:* npm start" its just work fine. note that i already create uploads directory with all the permissions "read and write for anyone". (sorry for my bad english) 回答1: I will try to guess the problem.