-
Notifications
You must be signed in to change notification settings - Fork 2
/
userdata.txt
33 lines (33 loc) · 1.04 KB
/
userdata.txt
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
#!/bin/bash
#general
sudo yum -y update
sudo yum -y install epel-release
sudo yum -y install git vim-enhanced ruby wget
#Installing the CodeDeploy agent on EC2
cd /home/ec2-user/
wget https://aws-codedeploy-eu-west-1.s3.eu-west-1.amazonaws.com/latest/install
sudo chmod +x ./install
sudo ./install auto
sudo service codedeploy-agent status
#nodejs
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
sudo yum install -y nodejs
#restaurant-management
cd /home/ec2-user/
sudo git clone https://github.com/lucasfdsilva/restaurant-management.git
cd /home/ec2-user/restaurant-management/backend
sudo npm install
#dbmigrations
cd /home/ec2-user/restaurant-management/backend
sudo npx knex migrate:latest
#pm2
sudo npm install -g pm2@latest
sudo pm2 start /home/ec2-user/restaurant-management/backend/src/app.js --name restaurant-backend
#web-deployment
cd /home/ec2-user/restaurant-management/web
sudo npm install -g serve
sudo npm install
sudo npm run build
sudo pm2 start /home/ec2-user/restaurant-management/web/app.config.json
sudo pm2 startup
sudo pm2 save