Meteor & mup - on linux server - linux

I have successfully installed a meteor app with MUP on my linux server my app files appear in
/opt/myapp
when I run myapp start I get
start: Job is already running: myapp
In my setting files I have
"ROOT_URL": "http://xx.xxx.xxx.xx",
Wat url should the app resolve to? I have also tried
"ROOT_URL": "http://xx.xx.xxx.xxx/myapp",

The correct way is to use mup to stop/start, don't log into your server and use upstart manually. ROOT_URL should be http://yourapp.com, do not use subdirectories as it'll confuse your router.

Related

Error running nextjs with PM2 on Azure App Service on Linux

The pipelines and releases seem to work finely as they get the artifact deployed on the app service or so it seems as the output error happens on start of the PM2 process.
I haven't found anything on this error on google, and don't know if there is a way to update PM2 on the app service machine as PM2 itself suggests.
These are the logs.
Error message
summary image
I was expecting the app to work and no longer show an application error as I fixed both build and release pipelines.
This is a picture of the important bit of info of the error as its really long
Check the below steps to run nextjs with PM2.
First create a nextJS app.
Run npm run dev command to run the app in development.
Deploy the app to Azure Linux App Service.
Open the SSH of the Azure App Service to run the PM2 commands.
We can open directly with the below URL.
Path to SSH - https://YourDeployedAppName.scm.azurewebsites.net/
OR
Navigate to the deployed Azure Linux App => Advanced Tools => Go => SSH.
Run the below command to install PM2.
npm install pm2 -g
Thanks #Azure OSS Developer Support for the commands.
In Configuration section => General Settings add the Startup command.
pm2 start site/root/index.js --name mynpmnextapp
Your path may differ for the index.js file.
My app entry point is index.js.For some apps it can be server.js.Change it according to your app.
cannot find module `../build/output/log'
Make sure you are not running the PM2 with the output folder. As mentioned above it has to be the entry point either server.js or index.js based on your code files.
don't know if there is a way to update PM2 on the app service
In the KUDU Console use npm install pm2#latest -g to update the PM2.
References taken from MSDoc and npmjs.

how to deploy node app to Heroku if the code is in a subfolder?

I have a nextjs and nodejs app in client and server directories respectively, and I know that heroku needs package.json in the root folder to deploy the node app but, it is in the server directory, how can I deploy this, I tried everything I found in other StackOverflow questions but they have ancient solutions, that doesn't seem to work now, is there any workaround?
/myProject
-- client
-- server
It's possible to specify your start script by adding a file Procfile in the root directory.
You may need a Procfile like this:
web: cd client && npm start
worker: cd server && npm start
Next, Enable both web and worker in Heroku App > Resources Tab.
See the official doc also: https://devcenter.heroku.com/articles/deploying-nodejs#specifying-a-start-script

Is there any way to manage node.js server from web interface?

I am in need to manage my node server without entering into server console. I have tried using forever, nodemon and pm2 npms. Whenever, I need to start or stop the node application, I need to connect the server via terminal. I want to avoid that and willing to see the possibility if that can be managed through any web interface or any browser plugin/extension.
Already tried forever, nodemon and pm2
You can use npm pm2-gui install it by this command npm i pm2-gui
See the docs and guides from here https://www.npmjs.com/package/pm2-gui
I started looking for some GUI and Web interface of PM2. Tried several npms but "mc-pm2-web" worked really good for me.
I am using Node via NVM and my node version was v10.15.3. Installed this https://www.npmjs.com/package/mc-pm2-web and it was straight forward what I was actually looking for.
Here's are the step if anybody wants to install and configure "mc-pm2-web" in AWS EC2.
I am using Amazon Linux
I am using NVM and running v10.15.3
Already had NGINX & PHP-FPM running on server using port 9000
pm2 already installed
Visit this link:
https://www.npmjs.com/package/mc-pm2-web
npm install -g pm2-web
pm2-web
If you encountered any error then you may check your config.json file. In my case the config file path was:
/home/ec2-user/.nvm/versions/node/v10.15.3/bin/pm2-web/config.json
I made following changes in config file to make it working:
Port from 9000 to 9010 because 9000 was being used by PHP-FPM
Changed the host name from "localhost" to "my-domain" which was already hosted in NGINX
Enabled authentication and set the Username and Password for making it secure
Allowed 9010 port from AWS EC2 firewall / security group of that instance
Added pm2-web in pm2 by executing "pm2 start pm2-web" command

Connecting app to AWS EC2 instance

I'm pretty new to DevOps and I'm trying to set up my Node.js app on a AWS server instance. Steps I've taken:
Set up Elastic IP
Launched EC2 instance with Ubuntu server
Connected IP to instance
Allowed incoming connections on port 3000
SSH'd into the server with a .pem file
Now I'm at the point where I need to get my files uploaded to the server. I've used FileZilla (and like it) in the past to upload files but the initial part was already set up. When I set up the site on FileZilla there is no /var/www folder on the remote site.
Don't know how to connect these dots.
Also not sure what I need to run once I successfully upload the files. I imagine npm install when I'm ssh'd into the server? Most of the tutorials out there only go through the basic instance setup.
Thanks!
You don't need to have /var/www. Also, it's better that you use a version control and a remote repository like Github and then SSH to your EC2 and then clone your repository there.
Then cd into your repo and run npm install and then start your app.
And check.
Once you connect to the EC2 instance then clone your code in there. It not mandatory to be in /var/www/html but, it's best practice to keep it there. Once you clone npm install into your project home directory so all the required packages get installed. Then for running your node application in production you have to run it on service as pm2, supervisor, forever, passenger, etc. You can use any of these services and configured appropriately to run your application on desired port. As with pm2, you can follow this guide, install pm2 Then you can run with the following command w.r.t. your environment, like I want to run my application on port 5555 for production
$ PORT=5555 pm2 start app.js --name API --env production -f
Check the status using pm2 list Now, your application is running on http://server-ip:5555/ But, you won't be typing port number every-time. So, you need to configure the web server in front of your application like apache or nginx which will forward all request to your application running port. You could find the best guide to their home page. Then your application is available at http://server-ip/ You can follow this for single configuration of multiple node apps
Hope this helps.

How to run `OpenFin Process Manager`

Refer to https://github.com/openfin/process-manager
Based on the README.md, I have done the following steps:
npm install
node server
I am able to see the following message from terminal(windows 7)
$ node server
Express server listening on port 5040
How do I launch the application?
I have tried to point to the localhost:5040 through chrome browser and ONLY see three tabs 'Processes', 'Cache', 'Logs' without any information.
How can I fix the issues?
npm i -g openfin-cli
openfin -l -c http://localhost:5040/app_local.json
The server script is running a local express server that hosts an OpenFin enriched web app so all you need to do it launch it on OpenFin, which in the case above we are doing with the CLI.
You can also use a node module to launch i.e. here

Resources