Skip to content

A sample for Infrastructure as Code and Immutable application versioning and deployment.

License

Notifications You must be signed in to change notification settings

monst3rr/EvAsCo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alt text

EvAsCo(Everything As Code)

EvAsCo is a sample code to demonstrate infrastructure automation, immutable application deployment and versioning using Docker, Kubernetes, Helm and Terraform on Azure Cloud.

Prerequisites

  • Following softwares are prequisite to successfully run this project.
    1. Docker
    2. Kubectl
    3. Helm
    4. Terraform
  • Azure Service role credentials: Configure these credentials in cluster/cred.tfvars.

Installation

$ cd cluster
$ chmod +x ./init.sh
$ ./init.sh

After successfully running, above command will print a url of the application running on azure cluster. API documentation can be found at ApiDocs.

What it does?
  • Initialize Terraform.
  • Creates Kubernetes Cluster and Cosmos DB in Azure.
  • Add Consmos DB connection string as Kubernetes Secret.
  • Initialize kubeconfig and helm.
  • Deploy docker image in Kubernetes
  • Map service ip to a DNS.

By default docker hub is being used as docker repository which can be configured in helm chart. Docker image of application which is in directory "app" can be found at Messages

Diagram

Alt text

   

Run Application on local machine

$ export CONNECTION=<YOUR_MONGODB_CONNECTION_STRING>
$ cd app
$ node index.js

To Run Test:

$ export CONNECTION=<YOUR_MONGODB_CONNECTION_STRING>
$ cd app
$ npm test

Visit http://localhost:1337 to view application.

 


Build and Run Dockerized App on local machine

$ export CONNECTION=<YOUR_MONGODB_CONNECTION_STRING>
$ cd app
$ docker build -t <TAG_NAME> ./
$ docker run -p 1337:1337 -e CONNECTION=$CONNECTION

Visit http://localhost:1337 to view application.

 


Application versioning and Rollback

$ helm list
$ helm rollback release_name release_version

It will rollback the deployed application to required version.

 

Tech Used

This project usees a number of open source technology:

  • Terraform - Write, Plan, and Create Infrastructure as Code.
  • Docker - contenarization.
  • Kubernetes - Container Orchestration.
  • Helm - The package manager for Kubernetes.
  • node.js - JavaScript runtime.
  • Express - fast node.js network app framework
  • VueJs - The Progressive JavaScript Framework
  • bootstrap-vue - Bootstrap + Vue

Todos

  • Integrating in CI/CD pipeline.
  • Code Improvement

License

MIT

Free Software, Hell Yeah!

About

A sample for Infrastructure as Code and Immutable application versioning and deployment.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published