How to do Production deployment of React + Nodejs? [closed] - node.js

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 months ago.
Improve this question
I am trying to understand how to deploy the web application with docker and do a production level deployment.
I made a web application with react as front end and Nodejs as backend. I used Mangodb for database.
I used proxy to connect both front and back-end , so that they started communicating with each other.
The web application working good as I built and API and routed through front-end.
My Goal:
To deploy using Devops and CI/CD pipelines.
With my research , the best possible options are :
using docker
using circle ci with docker
But I still havent found a way on how to deploy the entire web application .
should I deploy the front-end and back-end using docker and setup github actions? Is this the right way to deploy the applications and if so how does the front-end and back-end can talk with each other?
options: deploy both front-end and back-end with docker and figure out a way on how they communicate with each other.
My last experience was deploying backend on heroku and use that link as proxy in the front-end where I deploy it via netlify.
option 2: use circle-ci and docker combined to deploy both front-end and back-end.
Can anyone suggest the best way to approach this situation ? and best resource to lookup where I can deploy the entire web application using devops tools .
Thanks

I thought of sharing my experience. This could be slightly helpful to your issue.
Are you using any aws services ?
For our projects, we're using aws. To deploy frontend applications, we're hosting them in S3 buckets and use cloudfront as edge locations to serve the requests. For backend, ECS cluster based on EC2 launch type is used. For backend deployment, docker is necessary to containerize each application image and create tasks in ecs cluster.
To use CI/CD, I'm using github, github web hook, codebuild and codepipeline. If any commit is made through a pull request, such changes are identified via web hook and then codebuild and codepipeline runs to build and deploy the changes to relevant environments.

Related

Can we implement frontend and backend separately on AWS Elastic beanstalk?

I have frontend and backend both are using nodejs. Frontend is exposed and every request for api goes through the proxy module in the frontend, and both frontend and backend communicate on different modes.
Is there a way to deploy the above module, using code pipeline onto the Elastic Beanstalk platform ?
Why not deploy the front end on Amplify AWS?
AWS Amplify is a set of tools and services that can be used together or on their own, to help front-end web and mobile developers build scalable full stack applications, powered by AWS.
You just need to link your Repo and select your branch and everything will be deployed and generate also a random free domain or you can set your domain from the domain management section

Deploying PERN stack application with AWS

I developed a PERN (postgres, express, react, node) app that's running on my local machine and I want do deploy it using AWS. What is the "best" way to go about doing this if I want to be able to continuously deploy changes and handle the potential of scaling?
For Database you can use RDS https://aws.amazon.com/rds/
For Hosting you can use EC2 Instance of your own https://aws.amazon.com/ec2/
You should dockerize your app
And Optionally can set up a continuous deployment pipeline using aws-codepipeline and aws-codedeploy . You can also use github actions for this purpose.

Which is the best approach to deploy MERN stack app on AMAZON EC2?

I am googling a lot to be sure the best approach to deploy MERN stack app on aws ec2 ... in some examples Nginx being used in server (expressjs) part and in some cases its being used for Recatjs part and the express js part is just hosted in node , React even can be hosted in s3 I guesss .. so what is the best approach however?
Without configuring the server yourself in EC2, you can simply use managed Node.js hosting provided by AWS Elastic Beanstalk.
If you want to directly configure EC2 instance and deploy, you can follow this tutorial to do the deployment https://jasonwatmore.com/post/2019/11/18/react-nodejs-on-aws-how-to-deploy-a-mern-stack-app-to-amazon-ec2

Flask for server and Node.js for API? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am currently developing a web app using Flask, while one of my peers is developing an API using Node.js. The end goal is to use the API for all database queries and I am currently posting to the API in the backend of the flask application, but I am wondering - do I still need to use Flask as a backend if we have a separate API?
Yes, having a separate application for your web app and your data API is a good idea. This is a good practice for when you want to scale up an application.
Think of it this way... your API will probably service more apps than just your web application. If you decide to build a mobile app, your web app and your mobile app will consume data from the same API, but serve different users. Your web and mobile apps are handling two different pools of users, but your API is handling all of them. Therefore, your API will probably scale up faster than your mobile or web application services.
If your data API and your web app are the same application, you would have to scale them up as one service even though your web app might not be the core contributor to API traffic.
It depends on what you're using for your front end, if you're using some kind of javascript framework (Angular, React) you can just make the API calls from the client side.
But since you haven't mentioned those it sounds like you're just using Flask's template engine (Jinja) which is a server side template system. So you'll still be using Flask on the backend to build the templates.

Which Amazon web service for Node Js server? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am quite confused with Amazon Web Services, all that I want to do is to create a Node Js server on amazon and running it. Which service I should use ?
Here the list of services
Shoud I use CloudFront ? EC2 ? Elastic Beanstalk or or other ?
Any help would be really appreciated
I would not be so categoric as "use ec2" or "use something else" ...
well clearly on AWS if you want to deploy a node application, you have 2 main choices:
ec2 : https://codeforgeek.com/2015/05/setup-node-development-environment-amazon-ec2/
The Infrastructure as a Service (IaaS) offering from Amazon, you're free to do what you want/need and you manage your own servers.
elasticbeanstalk : http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs.html
The Platform as a Service (PaaS) offering from Amazon, aws will provide you machines, sdk versions etc you will use to build your app and you manage only your app not the servers
each comes with their pros and cons. You can read this op about some of the differences.
Basically I will sum up like this:
If you're building a 'small' web app or want to concentrate purely on your app and do not use fancy 3rd party tool/libs go with ElasticBeanstalk, you develop your app you deploy your app and it works. aws will manage the servers, you can set up rules to scale automatically, you can connect to other aws services (mainly RDS for database, SNS for mail notification ...)
If you have access to IT resources who know how to setup and manage a server (including security ...) and need to develop an app with many additional services, lib that might not be supported by aws eb or other aws services (such as setting up a mongo db, there's no out of the box offering from rds or other so you will need to install on ec2 server or user another 3rd party services which provides this)
The topic is not to discuss all aws offering but just to complete on your question, cloud front is the CDN system of AWS so if you use a lot of static assets (JS, css, images ...) you should look into it, wether you use S3, eb or ec2 to deploy your app you will be able to use this service. It speeds up the delivery of static assets to your users by caching them on edge location closed to those users.
For Node js EC2 service should be used.
You have to install a software named putty configure it and run your node js script like you run on your localhost.
Here are some links to tutorials:
https://www.youtube.com/watch?v=WxhFq64FQzA
https://aws.amazon.com/developers/getting-started/nodejs/
To deploy files you can simply use FTP instructions given below:
Connect to Amazon EC2 file directory using Filezilla and SFTP

Resources