Skip to content

All-in-one django/angular2 seed with cli interface for multi-environment devops on aws using ansible/packer/terraform

License

Notifications You must be signed in to change notification settings

stphivos/django-angular2-fullstack-devops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-angular2-fullstack-devops

All-in-one django/angular2 seed with cli interface for multi-environment devops on aws using ansible/packer/terraform.

Save weeks or even months of work!

Features

  • Vagrant box
  • Ansible playbook
  • Devops cli interface
  • Travis CI configurations
  • Tests with code coverage
  • Isolated frontend/backend projects
  • Build virtual images with packer
  • Launch infrastructure using terraform
  • Central project variables configuration
  • Jenkins pipeline workflow server (TODO)

Stack

Frontend

  • Angular 2.0
  • TypeScript 1.8
  • Bootstrap 3.3

Backend

  • Django 1.9
  • PostgreSQL 9.4
  • Django REST Framework 3.3

Requirements

The following are needed for building and deploying your infrastructure:

Setup

$ git clone https://github.com/stphivos/django-angular2-fullstack-devops
$ cd django-angular2-fullstack-devops

$ vim vars          # Edit project variables based on your project
$ ./devops setup    # Equivalent to `vagrant up` the first time, except that it destroys and re-creates the machine
$ vagrant ssh       # Log into the virtual machine. See all vagrant commands: https://www.vagrantup.com/docs/cli/

Run

Frontend

$ cd frontend
$ npm start

README..

Backend

$ cd backend
$ ./manage.py runserver

README..

Devops

Build

The first time:

$ ./devops build dev            # Calls commands below in the order shown

For building a specific project, either of the following can be run separately:

$ ./devops build dev backend    # Uses packer/ansible to provision an amazon machine image (ami)
$ ./devops build dev frontend   # Uses gulp to create a target environment distribution

Deploy

The first time:

$ ./devops deploy dev           # Calls commands below in the order shown

After updating a specific component, either of the following can be run separately:

$ ./devops deploy dev core      # Uses terraform to launch shared infrastructure such as vpc/gateway/subnets etc.
$ ./devops deploy dev rds       # Uses terraform to launch a db instance on RDS
$ ./devops deploy dev backend   # Uses terraform to launch an EC2 instance and load balancer for the backend api
$ ./devops deploy dev frontend  # Uses aws-cli to upload the frontend static files to a bucket on S3

Examples

Rebuild and deploy frontend for prod environment:

$ ./devops pipeline prod frontend  # ~30 seconds

Rebuild and deploy backend for prod environment:

$ ./devops pipeline prod backend  # ~7 minutes

Credits