Deploying the Tooplate websites with Docker

Deployment automated with bash scripts in Test environment.

Getting Started

Install Terraform in your local machine

Install AWS CLI in your local machine

sudo apt install curl unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install -i /usr/local/aws-cli -b /usr/local/bin

Confirm the AWS CLI installation

aws --version

Clone this repository in your local machine

cd /
git clone git@github.com:odennav/website-deployment-test-archive.git

Execute these Terraform commands sequentially in your local machine to create the AWS VPC(Virtual Private Cloud) and EC2 instances.

Initializes terraform working directory

cd website-deployment-test-archive/terraform
terraform init

Validate the syntax of the terraform configuration files

terraform validate

Create an execution plan that describes the changes terraform will make to the infrastructure

terraform plan

Apply the changes described in execution plan

terraform apply -auto-approve

Check AWS console for instances created and running

SSH access

Use .pem key from AWS to SSH into the public EC2 instance. IPv4 address of the public EC2 instance will be shown in terraform outputs.

ssh -i private-key/terraform-key.pem ec2-user@<ipaddress>

Clone this repository to the docker build machine provisioned and install git in VM.

sudo apt-get install git

Download HTML template from Tooplate and extract webfiles to your working directory

cd bash-scripts/
bash get_html.sh

Run the deploy script to automate deployment of the website


Clean Up Deployment(Optional)

Delete docker images and containers used to host the website

cd bash-scripts/
bash clean_up.sh 

Special thanks to Tooplate for the free HTML templates