diff --git a/.gitignore b/.gitignore index 366f79e..42254ab 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/aws/infra/ebs.tf b/aws/infra/ebs.tf index eea0061..e96e3aa 100644 --- a/aws/infra/ebs.tf +++ b/aws/infra/ebs.tf @@ -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 +} diff --git a/aws/infra/scripts/server-setup.sh b/aws/infra/scripts/server-setup.sh new file mode 100644 index 0000000..b63e95b --- /dev/null +++ b/aws/infra/scripts/server-setup.sh @@ -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 + diff --git a/aws/readme.md b/aws/readme.md new file mode 100644 index 0000000..e5aa035 --- /dev/null +++ b/aws/readme.md @@ -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. \ No newline at end of file