forked from shaikhsharik/awstutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
running-react-website-aws-on-port-3000
72 lines (39 loc) · 2.01 KB
/
running-react-website-aws-on-port-3000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Create Ec2 Instance
Connect with SSH terminal
Login as a root user - sudo su
If you want to switch back to normal user use command - sudo su ubuntu
Get Ubuntu Updates
=======================
sudo apt-get update
sudo apt-get upgrade
=======================================================
Install Node VIA NVM so that you can manage versions
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.bashrc
nvm ls-remote
nvm install v14.15.0 (use the Latest LTS - version number)
nvm list (check available node versions)
nvm use v14.15.0 (to select the default or any other NVM version)
node --version (verify node version and node install)
=================================================
Using Github, BitBucket or Gitlab - You an also directly upload the project VIA ftp
sudo apt-get install -y git
git --version (verify git version)
I am using the Sample React Bolier plate from https://www.reactboilerplate.com/ website
=========================
Navigate to cd /var - You can create your own path for your website - I usually prefer var/www/website-name
Create a directory mkdir www
Create a directory inside www - and name it whatever you want i will name it - mkdir sample-react
git clone https://github.com/react-boilerplate/react-boilerplate.git
=================================
PLEASE NOTE : Open PORT 3000 in AWS security group inbound rules - CUSTOM TCP 3000
=========================================
INSTALLING PM2 - Process manager to keep alive the node server after closing the session also -https://pm2.keymetrics.io/docs/usage/quick-start/
killall -9 node (this will kill all the node process)
npm install pm2 -g (install it globally)
pm2 start npm -- start (this will run the node app even if you close the terminal)
pm2 list (to check the running process)
======================================================
pm2 startup (For automatically running PM2 when the server stop/restarts)
pm2 save (to save the config)
======================================================