A meditation timer web app written in Golang, JavaScript, CSS, and HTML5.
Deployed as a Dockerized, clustered, Auto Scaling web application to AWS using Terraform.
Links
View the web application deployed to AWS.
View the smithlabs/gomeditateapp-docker GitHub repo contains the source code for the application.
This folder contains the full Terraform configuration that deploys the containerized web app across a cluster of web servers (using EC2 and Auto Scaling in an Amazon Web Services (AWS) account.
This project will deploy the gomeditateapp-docker project using the smithlabs/gomeditateapp:1.0.2
container image from my DockerHub. The following AWS resources are created.
- Elastic Load Balancer (Also known as the Classic Load Balancer)
- Auto Scaling groups
- 2 x EC2 instances of Amazon Linux 2
- Security Groups for the Classic Load Balancer
- Security Groups for the EC2 instances
💡 Below are links to the examples included in this repo.
- Docker Build Example - Deploy the application by building the container from scratch using the Dockerfile.
- Docker Hub Example - Deploy the application by using the pre-built container from my Dockerhub.
Note: The main.tf
in the project root uses the Dockerhub container for the deploy.
main.tf
utilizes my two custom Terraform modules. These modules should be pinned to v1.0.0
.
Name | Version |
---|---|
smithlabs/terraform-aws-asg-rolling-deploy | v1.0.0 |
smithlabs/terraform-aws-elb | v1.0.0 |
Here is where these modules are used in main.tf
.
- You must have Terraform installed on your computer.
- You must have an Amazon Web Services (AWS) account.
- (Optional) - AWS CLI v2 is recommended if you want to deploy Terraform code using multiple AWS credentials.
Please note that this code was written for Terraform 0.13.x.
Name | Version |
---|---|
terraform | >= 0.13.0 |
aws | >= 2.35 |
Please note that this example will deploy real resources into your AWS account. We have made every effort to ensure all the resources qualify for the AWS Free Tier, but we are not responsible for any charges you may incur.
Configure your AWS access keys as environment variables:
export AWS_ACCESS_KEY_ID=(your access key id)
export AWS_SECRET_ACCESS_KEY=(your secret access key)
Deploy the code:
terraform init
terraform apply
When the apply
command completes, it will output the DNS name of the load balancer. Visit the ELB url in your browser.
terraform output
Clean up when you're done:
terraform destroy
Name | Description | Type | Default | Required |
---|---|---|---|---|
environment | The environment name to add to the auto scaling group and ELB resources. | string |
prod |
no |
name | The name to prepend to the auto scaling group and ELB resources. | string |
gma-dockerhub |
no |
server_port | The port the server will use for HTTP requests. | number |
8080 |
no |
Name | Description |
---|---|
elb_dns_name | The DNS name for the Elastic Load Balancer |
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests and examples as appropriate.
Please ⭐️ this repository if this project helped you!
- EmojiTerra - Copy and paste emojis into your README