was wondering whether react webpack node can run on aws
See original GitHub issueNote: This is just a template, so feel free to use/remove the unnecessary things
Description
- Type: Bug | Enhancement | Question
- Related Issue:
#abc
Bug
Expected Behavior
Actual Behavior
Steps to Reproduce
Enhancement
Reason to enhance/problem with existing solution
Suggested enhancement
Pros
Cons
Question
How to?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
3 Best Ways to Run webpack in AWS - YouTube
With webpack v5 out, there's no better time than to learn how to run webpack in the cloud. There are many different ways...
Read more >How to deploy a React + NodeJS Express application to AWS?
Run your Webpack build before deploying the React part. You can do it manually (before deploying on AWS) or automatically (in your CI/CD...
Read more >Bundling applications with webpack ... - AWS Documentation
Bundling for Node.js. You can use webpack to generate bundles that run in Node.js by specifying node as a target in the configuration....
Read more >How to deploy a React app to production on AWS using ...
We will deploy the app to an AWS EC2 instance running an Amazon Linux AMI 2. The setup will use NGINX as a...
Read more >Anyone here got webpack-dev-server to work on Cloud 9? #230
html will have a script tag with the source of the output bundle.js coming from the webpack-dev-server at localhost:8080 which is the default......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have a project that I built with this boilerplate currently up and running on Amazon AWS. Your question of how to is a bit vague, so I will just run down the steps I took. and provide a few links.
I set up an AWS account using the free tier. I didn’t feel it was necessary to go with something like elastic beanstalk, so I used a pure EC2 instance.
Before you make our instances you need to create a security group, which specifies what ports are open on your server, and what if any or all IPs have access to them. The Amazon docs can walk you through it nicely.
Then you should make sure you are in correct region (in the upper right hand corner), and and then pic Launch a new instance, and follow along with the setup wizard. I picked the Ubuntu Server 14.04 free tier, and most of the default options and I moved through the process. And then let it set it self up.
Once this was done I set up an elastic IP and paired it with my instance. This is important to do. because it gives you a dedicated IP for your virtual instance/IP. And make sure you pair it right away, because there is a charge for having unpaired elastic IPs.
Now it is time to connect. There are instructions on the instances page. I use SSH, with the key file that i generated in the creation process. Once you are in you need to run a bunch of updates, and then start installing.
First install node. following the instructions Next install mongo db following this instructions, there are a lot of them so make sure you follow the instructions for the correct version.
To get mongo running fully was a bit of a challenge, I was having some issuing with file permisions but the notes I have look like this. This should be everything, but if something doesn’t work the error and answer is on stack overflow. Because thats how I got it working.
RUN MONGO TEST:
sudo service mongod start
sudo service mongod stop
START MONGOD:sudo /usr/bin/mongod --dbpath /home/ubuntu/db/data
KEEP MONGO RUNNING:sudo /usr/bin/mongod --dbpath /home/ubuntu/db/data --fork --logpath /var/log/mongodb.log
Now you will want to upload your files. open a section terminal window for this. I was using the secure copy command like this, with the hashed values representing your information.
scp -i #KEY#.pem -r #SOURCE# ubuntu@ec2-##-##-##-###.compute-1.amazonaws.com:#DEST#
I would suggest not using this method to copy your node modules, but instead to npm install directly on the server after your package.json is uploaded. Then everything should be good to go.
npm start
should get your project running, and you will be running at the elastic ip address.If you don’t want to use the Port value that you specified then you can set it to 80 and hit the pure IP address like this, with those hashes representing the port you were running on.
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port ####
This works and is how I did it but I’m not actually sure if this is a best practice or not. Dev ops stuff is not what I do.
Your project will not run until you shut down your ssh connection. If you want the keep the site running at all times you will need forever.
sudo npm install forever -g
And then my new npm script looks like this
"stayAlive": "cross-env NODE_ENV=production PORT=9000 forever start server/index.js",
and then you should be good to go.
Hope this helps, The AWS docs are actually a really good resource, but if you have any more questions about something specifically just let me know.
What a champion!!! Hahah!