I was going in order to create a Small Discord Bot, and i'm using PM2 to watch and restart the bot. SO yesterday i setted a process file in order to use the clustermode to open more istances.
Until yesterday all works good with no worries.
Today when i launch the process file, it opens a terminal window for each istance that i have, and each time i save a file and PM2 will restart the bot, it gives the error:
[DEP0007] DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
For each istance. I searched online but any thread could not helped me, i also reinstalled the latest version of pm2:
pm2 update
or
npm install -g pm2#latest --save
i also uses the command line insted of the process file:
pm2 start index.js -i 4 --name myapp --watch
but nothing, when i goes on pm2 logs, on restart it gives that error.
How can i solve this?
My Process file:
module.exports = {
apps : [{
name: 'Economy',
script: 'index.js',
instances: 4,
exec_mode: "cluster",
autorestart: true,
watch: true,
ignore_watch: ["database"],
max_memory_restart: '1G',
env: {
NODE_ENV: 'development'
},
env_production: {
NODE_ENV: 'production'
}
}],
};
According to https://github.com/Unitech/pm2/issues/3597:
If you're using Node version <= 8, you can ignore the warning (it's a warning, not an error) OR upgrade to Node version >= 9. (Reminder: Node LTS is currently version 10).
Related
I am trying to run my React App with PM2 on an Ubuntu server. It has been running fine for years before today, and suddenly it stopped.
The one change I made today was that I reset my root password. But I can't think why that would make a difference.
I have created the app build.
If I just serve the app from the root directory of the application with serve -s build it serves correctly.
Then I try to serve the file using PM2 with a file 'ecosystem.config.js' that in my server root directory. This is the module:
apps : [{
name:'myapp',
script: '../../var/www/myapp',
interpreter : 'none',
args: 'sudo serve -s build',
watch: true,
env: {
NODE_ENV:'development',
},
env_production : {
NODE_ENV: 'production'
}
}]
}
I run pm2 restart all and it seems to restart, but then it errors.
The log shows the following:
at WriteStream.emit (events.js:210:5)
at internal/fs/streams.js:299:10
at FSReqCallback.oncomplete (fs.js:146:23)
Error: Cannot find module '/var/www/myapp'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at /usr/local/lib/node_modules/pm2/lib/ProcessContainer.js:297:23
at wrapper (/usr/local/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
at next (/usr/local/lib/node_modules/pm2/node_modules/async/waterfall.js:96:20)
at /usr/local/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
at WriteStream.<anonymous> (/usr/local/lib/node_modules/pm2/lib/Utility.js:186:13)
at WriteStream.emit (events.js:210:5)
at internal/fs/streams.js:299:10
at FSReqCallback.oncomplete (fs.js:146:23)```
Thank you for any ideas.
I am developing an app and I want to deploy it on a linux server. I already have copy my local files to the server . I have read this article but not so clear to me https://github.com/keystonejs/keystone/issues/4687.
things i have already done
Remote server has appropriate versions of Node.js & npm installed (ideally the same as what you have been testing with in development)
Check out (or copy) the latest version of your application source to the remote server.
Run npm install (or npm install --production if this will be a production environment) in the top-level of your application source directory.
but when i run npm start on the server it gives me error which is
Mongoose connection "error" event fired with:
{ MongoError: failed to connect to server [localhost:27017] on first connect
my settings
keystone.init({
'name': 'Test',
'brand': 'Test',
'sass': 'public',
'static': 'public',
'favicon': 'public/favicon.ico',
'auto update': true,
'views': 'templates/views',
'view engine': '.html',
'custom engine': cons.nunjucks,
'mongo': 'mongodb://localhost/test',
'auto update': true,
'emails': 'templates/email',
'session': true,
'auth': true,
'user model': 'User',
});
Do i need to configure more settings on mongo on the server?
Mongoose connection "error" event fired with: { MongoError: failed to connect to server [localhost:27017] on first connect
The above error means that your mongodb service was not started.
To enable & start the mongodb service you can run following command:
1. Enable mongodb service
sudo systemctl enable mongod.service
2. Start mongodb service
sudo service mongod start
3. Start your nodejs app
npm start
I'm trying to deploy a sails.js app (sails.js version 0.11) to Openshift.
I'm aware of the previous questions and answers in here for example;
https://gist.github.com/mdunisch/4a56bdf972c2f708ccc6
I followed the steps from that post.
I also created my app via git://github.com/ryanj/nodejs-custom-version-openshift.git so I have minimum npm version required by sailsjs. Still the application doesn't start. Has anybody attempted deploy sails v0.11 app on openshift before?
Thank you
I see below in the logs
DEBUG: Running node-supervisor with
DEBUG: program 'server.js'
DEBUG: --watch '/var/lib/openshift/55a4256b5973cadc8400000d/app-root/data/.nodewatch'
DEBUG: --ignore 'undefined'
DEBUG: --extensions 'node|js|coffee'
DEBUG: --exec 'node'
DEBUG: Starting child process with 'node server.js'
DEBUG: Watching directory '/var/lib/openshift/55a4256b5973cadc8400000d/app-root/data/.nodewatch' for changes.
Listening on 127.2.103.1, port 8080
DEBUG: Sending SIGTERM to child...
My solution as explained here works.
https://github.com/aug70/openshift-sails-starter
If you follow the instructions to setup a OpenShift cartridge and merge with this repo, you can deploy it on OpenShift.
Couple important points;
OpenShift package.json file is different!
You would want to use forever when running application and your start script should be something like
"start": "./node_modules/forever/bin/forever -l ~/app-root/logs/forever.log --append --pidFile ~/app-root/logs/forever.pid start app.js --prod"
If you happen to use mongodb, your connections.js file mongodb entry would be
"url : process.env.OPENSHIFT_MONGODB_DB_URL + process.env.OPENSHIFT_GEAR_NAME "
Solution is based on Sails.js version 0.11.0
I am trying to set up a GruntFile.js file to automate the process of logging on to my personal website's server via ssh and pulling the latest version of the git repo. The relevant part of my grunt file looks like this:
sshconfig: {
portfolioServer: {
host: 'mySite.com',
username: 'root',
agent: process.env.SSH_AUTH_SOCK,
}
},
sshexec:{
deploy:{
command: [
'cd portfolio',
'git pull'
].join(' && ')
},
options:{
config: 'portfolioServer'
}
},
However, when I run the associated task (I named it "grunt deploy"). I get the following error.
Running "sshexec:deploy" (sshexec) task
Warning: Connection :: error :: Error: Authentication failure. Available authentication methods: publickey,password Use --force to continue.
Aborted due to warnings.
My understanding is that this error means that I have not set up the public/private ssh keys correctly. However, I have already gone through the process of setting up public/private keys.I am already able to run the following command through git bash and log in successfully:
ssh root#mySite.com
I have searched online for this problem and it seems like it might have something to do with process.env.SSH_AUTH_SOCK not behaving in git bash on windows in the same way that it might be expected to be have in a native linux distribution.
What further steps in my setup do I have to take in order to make this deployment configuration work?
I have a digital ocean droplet that I am trying to deploy the most basic of meteor apps to, but I am getting a failing response. Any idea why this is happening?
UPDATE: added entire output
Anderss-iMac:microscope-deploy anderskitson$ mup deploy
Meteor-UP : Production Quality Meteor Deployments
--------------------------------------------------
Bundling Started: /Users/anderskitson/sites/microscope
Started TaskList: Deploying App
[bray.anderskitson.ca] uploading bundle
[bray.anderskitson.ca] uploading bundle: SUCCESS
[bray.anderskitson.ca] setting up env vars
[bray.anderskitson.ca] setting up env vars: SUCCESS
[bray.anderskitson.ca] invoking deployment process
[bray.anderskitson.ca] invoking deployment process: FAILED
-----------------------------------STDERR-----------------------------------
Warning: Permanently added 'bray.anderskitson.ca,162.243.52.235' (RSA) to the list of known hosts.
npm WARN package.json http-proxy#1.0.0 No repository field.
npm http GET https://registry.npmjs.org/fibers
npm http 304 https://registry.npmjs.org/fibers
stop: Unknown instance:
bash: line 46: wait-for-mongo: command not found
-----------------------------------STDOUT-----------------------------------
> fibers#1.0.1 install /opt/meteor/tmp/bundle/programs/server/node_modules/fibers
> node ./build.js
`linux-x64-v8-3.14` exists; testing
Binary is fine; exiting
fibers#1.0.1 node_modules/fibers
meteor start/running, process 10373
wait for mongo(5 minutes) to initiaze
----------------------------------------------------------------------------
Completed TaskList: Deploying App
I ran into same problem and I figured out that this command wasn't fired really well
sudo npm install -g forever userdown wait-for-mongo
and I manually did that so I can see wait-for-mongo a valid command,
see if that helps you too.