GithubHelp home page GithubHelp logo

baraka_docker_aws's Introduction

AWS/Docker/Django Demo

The following instructions describe how to deploy an extended user authentication Django web application using an AWS CloudFormation stack and docker-compose.

Overview

  • Create cloudformation stack
  • Edit .env values
  • Build and push docker image to DockerHub
  • Launch docker-compose to run container on AWS

Instructions

CloudFormation Stack

  1. Clone github repository to a new directory on local machine
  2. Create EC2 key pair in AWS management console and save to project folder directory
  3. Open fullstack.yml and replace the MyKeyName parameter with your KeyPair (line 26)
  4. Run aws cloudformation command in proj_commands.sh
  5. Once completed, open the Outputs tab on the CloudFormation page in AWS console. Save the access key id and secret access key in a text editor.
  6. Open RDS instance on console, save RDS endpoint address to text file.
  7. Open EC2 instance next, and save Public IP address and Public DNS address to text.

Edit .env values

  1. Open .env.example file in text editor and rename file to .env
  2. Replace aws_s3_access_key_id and aws_s3_secret_access_key with the values from CloudFormation Outputs
  3. Replace RDS Host with RDS endpoint obtained from previous step.
  4. (optional) Replace django_key with a random secret key that can be generated from https://www.miniwebtool.com/django-secret-key-generator/
  5. Save changes and exit .env

Docker Image and Docker Hub

  1. Open proj_commands.sh and replace all instances of baraka215/docker-aws with yourdockerhubname/[yourprojectname]
  2. Also, in proj_commands.sh replace DOCKER_HOST ip address with your EC2 ip address obtained from AWS console
  3. Open docker-compose.yml and replace baraka215/docker-aws with yourdockerhubname/[yourprojectname]
  4. Run docker build, docker image tag and docker image push commands

Docker-Compose

  1. Run the remainder of docker-compose commands in proj_commands.sh(enter yes when prompted during collectstatic)
  2. After docker-compose up -d is executed, go to EC2 public DNS address and baraka_docker_aws website will be up and running.
  3. Explore site: register new users, subscribe to plans, change passwords, edit user profiles, view home page and pricing plans
  4. To stop and remove containers, networks, volumes, and images created by up: docker-compose down -v --rmi all

(Optional) Run additional docker command

  1. Create a django superuser to access Django's admin interface: docker exec -it <container id> bash
  2. Once inside the running container type: python manage.py createsuperuser
  3. Fill out usrname, email, password
  4. Access admin page and login as new superuser: ec2publicDNS/admin

baraka_docker_aws's People

Contributors

minkahbaraka avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.