This respository consists of multiple tech stacks
- Terraform - Builds AWS instances/resources
- S3/DynamoDB - Holds remote state file/lock
- Packer - Builds the AMI for Terraform to deploy to EC2
- Docker Composer - Spawns 2 docker containers on the EC2
- Nginx web server - Proxy for the app
- Go lang container - Builds and runs the app
- Encryption for S3/DynamoDB/AMI/EBS
- Auto scaling app instances
- Tables arent dropped when new slaves spin up
- App builds itself from source upon launch in container
- Remote state file and lock on AWS
- Terraform 0.12+
- Packer 1.4+
- Packer plugin: packer-post-processor-amazon-ami-management 0.7.0+
- Git
- Suggested OS: Linux/Mac OSX
- brew install terraform
- brew install packer
- Clone repository:
$ git clone https://github.com/dansali/TechTestApp.git
-
Modify
config.tfvars
-
Add AWS credentials into
secrets/credentials.ini
-
Generate new keys
$ chmod +x generate_keys.sh
$ ./generate_keys.sh
- Generate new AMI's
$ chmod +x packer.sh
$ ./packer.sh
- Execute terraform script
$ chmod +x execute_terraform.sh
$ ./execute_terraform.sh
-
Wait until LB url is printed, app & rds might take a few minutes to boot
-
To destroy
$ chmod +x destroy_terraform.sh
$ ./destroy_terraform.sh
- Terraform v0.12.17
- Packer 1.4.5
- Packer plugin: packer-post-processor-amazon-ami-management 0.7.0