Deploying React & Node.JS as a service Linux Ubuntu 14 - node.js

Have a Node.Js API and a React app semi finished. Working on deploying to get the development cycle churning. Currently using npm start for viewing the react server during development. Same for the Node API. When deployed to AWS EC2 I am building in the most basic fashion, npm build pushing to a 'release' folder.
Once the deploy folder is up, I can go into it and run serve -s release
This gets me up and running. I can do the same for api server.
To get the apps running as a service, for the api, I can see how I can build a systemd process and run that with no issue.
For the react app, is there an easy way to run that server as a system... I'm new to this stack, so I might be confused. I have read in some places that once you've built your react app that you need to serve it out via apache or nginx? (e.g. in development it hosts itself, in production, you need to serve it) Is that sort of the general idea - build with local hosting, deploy with a production webhost?
Help appreciated. This is my last major issue before I can get Jenkins running a nice pipeline for deployment. Thanks!

Since you are already running a NodeJs server, It would be a good idea to host your ReactJs App in the NodeJs App itself.
You can pipline in the Jenkins to Build the ReactJs App first and the move it to static serving folder in the server and then you just need to deploy the NodeJs app in which ever environment that you want.

Related

How to deploy Meteor Application on cPanel shared hosting

I am trying to deploy a meteor.js application on cPanel shared hosting. I don't have access to their cli.
I have followed this tutorial Host your Node.js app on Shared hosting. Go beyond localhost.
Now I am having hard time with a couple of things. I can't find any tutorial specific for meteor.js which is why I am facing some issues. Which are as follows
1. Without meteor Build
I uploaded the development version of my code. i.e the one with client,server,lib folders(without meteor build). The problem is that I am not sure about the "Application startup file".
I tried with "./client/main.js" and "./server/main.js" seperately but the site then returns 503.
2. With meteor Build
I then built my application and the build was generated with some errors. I then uploaded the tar.gz file and went with the main.js as Application Startup file. But now the cPanel is unable to detect package.json
Can someone please refer to a full guide of how to deploy a meteor app with cPanel.

trouble deploying full stack application on heroku

I have made a full-stack app with react js and node js with express and MongoDB but I am having a little bit of difficulty deploying I first tried to deploy the front end but I was getting the invalid host header coming up when I tried to deploy in Heroku its been tested and works fine in the dev environment.
But also my application has two separate git repos one for the back and one for the front end and every tutorial I have seen to deploy they always have the client in the same folder as the server.
Can someone either tell me how to deploy or point me in the right direction on how to deploy.
What you have to do for React/Express/Node/MongoDB is,
build your frontend app first by using "npm run build". This will create a build folder under your app folder.
move your "build" folder to backend app folder.
update your backend app to use "app.use(express.static('build'))".
Then you can push your code to git and Heroku and try to deploy it.
There should be some tutorials available on Heroku website.

Angular Universal app running in shared hosting

So I have created an angular universal app and I have successfully deployed it in Heroku and it's running great. I would like to know if it is possible I can run it in a shared hosting. More specifically I have A2Hosting shared plan which supports node.js. More over which commands should I execute in the server in order to start the node server? Thank you.

Deploy Angular Universal to Shared Hosting without npm or node.js

I currently have access to an standard cPanel shared hosting, without SSH
I have an angular application running there https://www.rednots.com
However now I need the app to have server side rendering for Facebook share, I've been using Universal toolkit from https://github.com/maciejtreder/ng-toolkit and it works great in local
Now my issue is: can I deploy the Universal app the same way I've deployed the Angular client side app by uploading the dist folder? Do I need node.js installed in the server and run commands? Or is it any workaround so I don't need to use commands?
ng-toolkit is using lambda functions and api gateways to be used by the services.
Technically speaking you only need to deploy the dist folder and everything should work out of the box since you mentioned that you already tested it locally and it works which means that the lambda functions are already deployed and the services are pointing to AWS gateway properly.

how to deploy nodejs rest api with express framework on production server windows

I have created a node.js rest api created using express framework for routing. I have used tutorial
Now I want to deploy that rest api on actual production server. How to achieve that thing.
I have gone through below links.
Deploy node js application with express framework on production mode --- Only for linux. I need for windows.
Deploying NodeJs Express Rest API to Windows 10 IoT -- a little bit similar problem but no solution
https://stackoverflow.com/a/38652869/2810015 -- this said to run npm start on production server after copying all of the files on server. But this is not working fine either.
Any help will be highly useful.
You use pm2?
Usually I use it to start the application. It works for both windows and linux. He leaves the service initated, and in case something happens that knocks the service up again.
You install it on the server, and instead of using it
node server.js
You use the command below
pm2 server.js start
Link: http://pm2.keymetrics.io/docs/advanced/pm2-module-system/

Resources