+ ebs section for terraform build

+ Basic nginx setup script
certbot commands are not included
This commit is contained in:
shockrah 2021-10-21 23:55:58 -07:00
parent 9775ae9cb7
commit a5f649a284
4 changed files with 53 additions and 0 deletions

7
.gitignore vendored
View File

@ -16,3 +16,10 @@ build/
gitpage/public/
gitpage/resources/
gitpage/hugo.exe
aws/infra/keys/
aws/infra/*.hcl
aws/infra/*.tfstate
aws/infra/*.backup
aws/infra/.terraform/providers/registry.terraform.io/hashicorp/aws/3.63.0/linux_amd64/terraform-provider-aws_v3.63.0_x5
aws/infra/plan
aws/infra/terraform.tfvars

View File

@ -6,3 +6,9 @@ resource "aws_ebs_volume" "app_volume" {
Name = "APP Video block storage"
}
}
resource "aws_volume_attachment" "ebs_att" {
device_name = "/dev/sdf"
volume_id = aws_ebs_volume.app_volume.id
instance_id = aws_instance.app_instance.id
}

View File

@ -0,0 +1,32 @@
#!/bin/sh
# This script runs in order to to set things up for so that we don't have to do
# much else by ourselves
# No harm in using sudo even as root its just a little pointless
# Doing this with our ami however means we don't have to check if we're root
# for privileged operations at provision-time
apt="sudo apt"
server_name=$1
if [ -z "$server_name" ];then
echo A servername must be given as an argument
fi
$apt update
$apt upgrade
$apt install -y nginx certbot
sudo mkdir -p /var/www/clippable
# Creating the reverse proxy configuration for nginx
# WARN: Also we're assuming that the webserver has the default port
# Only this because certbot does the rest
cat << EOF > /etc/nginx/sites-available/clippable
server {
server_name $server_name;
location / {
proxy_pass http://0.0.0.0:8482;
};
}
EOF

8
aws/readme.md Normal file
View File

@ -0,0 +1,8 @@
# AWS Configuration
For those that would like to deploy a minimal instance to AWS via terraform
this directory will basically have everything you need to get a working instance
up and running for very cheap with an EC2 instance.
There is still the question of preparing the EC2 instance itself however the
amount of configuration is very light.