-
Create EC2 instance for the backend (mongoDB and express).
- Security group rules:
- ssh port 22, source: My IP
- custom tcp port 27017, source: My IP
- custom tcp port 27017, source: Backend-SG
- custom tcp port 3005, source: ALL
- custom tcp port 3005, source: Frontend-SG
- HTTP port 80, source: Frontend-SG
- EC2 instance User Data: Refer to 'whist-backened-userdata-script'
- Security group rules:
-
Create EBS volume for mongodb consistent storage (gp2).
- Make sure the instance is in the same availab zone as the EBS volume.
-
Attach the EBS volume to the EC2-backend that was create in the previous steps.
-
SSH into the EC2 and then:
- Make sure the instance is in the same availability zone as the EBS volume
- Attach the EBS volume using the following commands:
sudo mkfs -t ext4 /dev/xvdf sudo mkdir /dbvolume sudo mount /dev/xvdf /dbvolume/- Run the following docker commands to start containers:
docker run --restart always -d --name mongodb -v /dbvolume/mongo-data:/data/db -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=mongo -e MONGO_INITDB_ROOT_PASSWORD=mongo mongo docker run --restart always -d --name nodexpress -p 3005:3005 matanski/nodexpress:yuvali6 -
Create DB for the first time (in the next time it will be already be configured because of the docker -v volume option) with mongo compass via:
mongodb://mongo:mongo@*VM_PUBLIC_IP*:27017/
-
Create EC2 instance for the frontend (vue)
- Security group rules:
- ssh port 22, source: My IP
- custom tcp port 8080, source: ALL
- EC2 instance User Data: Refer to 'whist-frontend-userdata-script'
- Security group rules:
-
SSH into the EC2 and then:
- Run the following docker commands to start containers:
- vue:
docker run --restart always -d --name vueapp -p 8080:8080 matanski/vueapp:yuvali3
- Run the following docker commands to start containers:
