Skip to content

KSBolton/deploy-second-containerapp

 
 

Repository files navigation

Introduction

This project is an introduction to running containerized applications in AWS, and using Elastic Container Registry (ECR) as the public source of truth for images. In its current state, the project:

  1. Builds the AWS infrastructure (Networking, EC2, ECR, ALB) via Terraform.
  2. Builds and pushes the images to ECR via GitHub Actions.
  3. Manually (for now!) connects to the EC2 host to pull images from ECR and run the containers.

Steps (fairly simple)

  1. Generate an SSH key pair for the EC2 instance (I named mine 'key' because I'm very imaginative.) The name is hardcode in TF so change it there, as needed.
  2. Run the Terraform code to build the underlying infrastructure on AWS. Docker should be installed on the EC2.
  3. At EC2 CLI:
    • Login to ECR (aws ecr get-login-password --region | docker login -u AWS --password-stdin
    • Create a custom bridge network to allow name resolution among containers.
    • Run the mysqldb container first - it may need a couple seconds to listen on its ports.
    • Run as many webapp containers as you wish, so long as they use these environment variables:
      • DBHOST (the DB container), DBPORT (usually 3306), APP_COLOR, DBPWD
  4. The Terraform code returns the repositories' URL, the IP address of the EC2 instance, and the FQDN of the ALB.

About

clo835_fall2022_assignment1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 57.3%
  • Python 21.7%
  • HTML 18.8%
  • Dockerfile 1.6%
  • Shell 0.6%