Upload files to "/"
This commit is contained in:
parent
0aca015ca5
commit
56f3b4397f
3
backup.sh
Normal file
3
backup.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker exec app_db pg_dump -U notesuser notesdb > backup.sql
|
||||||
61
create-vm.sh
Normal file
61
create-vm.sh
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# VARIABLES
|
||||||
|
KEY_NAME="my-key"
|
||||||
|
SECURITY_GROUP="notes-app-sg"
|
||||||
|
INSTANCE_NAME="notes-app-vm"
|
||||||
|
AMI_ID="ami-0e872aee57663ae2d"
|
||||||
|
INSTANCE_TYPE="t2.micro"
|
||||||
|
REGION="eu-central-1"
|
||||||
|
|
||||||
|
# CREATE SECURITY GROUP
|
||||||
|
aws ec2 create-security-group \
|
||||||
|
--group-name $SECURITY_GROUP \
|
||||||
|
--description "Security group for Notes App" \
|
||||||
|
--region $REGION
|
||||||
|
|
||||||
|
# OPEN PORTS
|
||||||
|
aws ec2 authorize-security-group-ingress \
|
||||||
|
--group-name $SECURITY_GROUP \
|
||||||
|
--protocol tcp \
|
||||||
|
--port 22 \
|
||||||
|
--cidr 0.0.0.0/0 \
|
||||||
|
--region $REGION
|
||||||
|
|
||||||
|
aws ec2 authorize-security-group-ingress \
|
||||||
|
--group-name $SECURITY_GROUP \
|
||||||
|
--protocol tcp \
|
||||||
|
--port 80 \
|
||||||
|
--cidr 0.0.0.0/0 \
|
||||||
|
--region $REGION
|
||||||
|
|
||||||
|
aws ec2 authorize-security-group-ingress \
|
||||||
|
--group-name $SECURITY_GROUP \
|
||||||
|
--protocol tcp \
|
||||||
|
--port 443 \
|
||||||
|
--cidr 0.0.0.0/0 \
|
||||||
|
--region $REGION
|
||||||
|
|
||||||
|
aws ec2 authorize-security-group-ingress \
|
||||||
|
--group-name $SECURITY_GROUP \
|
||||||
|
--protocol tcp \
|
||||||
|
--port 8080 \
|
||||||
|
--cidr 0.0.0.0/0 \
|
||||||
|
--region $REGION
|
||||||
|
|
||||||
|
aws ec2 authorize-security-group-ingress \
|
||||||
|
--group-name $SECURITY_GROUP \
|
||||||
|
--protocol tcp \
|
||||||
|
--port 8081 \
|
||||||
|
--cidr 0.0.0.0/0 \
|
||||||
|
--region $REGION
|
||||||
|
|
||||||
|
# CREATE INSTANCE
|
||||||
|
aws ec2 run-instances \
|
||||||
|
--image-id $AMI_ID \
|
||||||
|
--count 1 \
|
||||||
|
--instance-type $INSTANCE_TYPE \
|
||||||
|
--key-name $KEY_NAME \
|
||||||
|
--security-groups $SECURITY_GROUP \
|
||||||
|
--tag-specifications "ResourceType=instance,Tags=[{Key=Name,Value=$INSTANCE_NAME}]" \
|
||||||
|
--region $REGION
|
||||||
10
deploy.sh
Normal file
10
deploy.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
|
|
||||||
|
sudo apt install docker.io docker-compose nginx certbot python3-certbot-nginx -y
|
||||||
|
|
||||||
|
sudo systemctl enable docker
|
||||||
|
sudo systemctl start docker
|
||||||
|
|
||||||
|
docker-compose up -d --build
|
||||||
3
destroy.sh
Normal file
3
destroy.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker-compose down -v
|
||||||
Loading…
Reference in New Issue
Block a user