Skip to content

sree-warrier/django-ha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

djnago-ha

Deploy a dockerized Django Application to AWS in a VPC using Terraform, Docker Registry and EC2 Service.

Includes

  • VPC
  • Internal DNS
  • RDS
  • EC2 instances
  • ELB to distribute requests across the EC2 instances
  • Security groups
  • docker & docker-compose

Prerequisites

Usage

Building the infra using terraform commands

The following steps will walk you through the process:

  1. Clone the repo::

    git clone https://github.com/sree-warrier/django-ha.git

  2. Following should be created before terraform file execution::

    • Create a keypair
    • Use the AMI having docker and docker-compose running
    • Configure aws credentials at your local (Make sure user should have required access to the aws services)
  3. infra-tf directory conatins the terraform file for infra setup, use the following steps::

    cd infra-tf
    terraform init
    terraform plan
    terraform apply
    
  4. Login to the cluster instance using the keys::

  5. Create docker-compose.yml file::

    touch docker-compose.yml

     version: '3.3'
     services:
       django-ha:
           image: sreewarrier24/django-ha:0.5-alpine
           command: /bin/sh /code/docker-entrypoint.sh
           environment:
             DB_NAME: *******
             DB_USER: *******
             DB_PASS: *******
             DB_HOST: *******
             DB_PORT: *******
             ELB_NAME: *******
           ports:
               - "8000:8000"
    

    Update the environment variables which are prompted during the terraform execution

  6. Run docker using the docker-compose file::

    docker-compose up

  7. Use the ELB CNAME record to access via browser

Credits

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published