Code Monkey home page Code Monkey logo

cd-demo's Introduction

Continuous Delivery Demo

This repository contains some simple code to help demonstrate some continuous delivery techniques as part of a talk.

Application

The application itself is a simple hello world style application that is written in Go, and packaged as a lambda to be deployed in AWS infrastructure behind and AWS API Gateway. It has a simple database that will contain the users and any call to /hello/<name> where name matches a user in the database will respond with 'Hello, name'

Database

The app contains a database, which is defined using flyway database migrations under the db directory

Feature Toggles

To demonstrate the use of feature toggles an environmnet variable, ENABLE_BIRTHDAY_COUNTDOWN can be set to true to show the number of days till the user's birthday if it is stored in the database You'll be able to enable the feature toggle by manually updating the environment variable value in the AWS lambda console for the hello_world lambda. Whilst this isn't necessarily the idea way to manage a feature toggle, it is a simple way to demonstrate how it can be done!

Terraform

The terraform code contains all the necessary configuration to produce the AWS infrastructure to run this application. This includes the lambda, the database, the API Gateway as well as the necessary networking and permissions to get them to all work together.

Pipeline

The preferred way of applying any changes to this repository would be to create a continuous delivery pipeline. This project contains a concourse pipeline configuration file that builds a simple pipeline that will build and deploy the application, infrastructure and database migrations in this repository

Concourse

This does assume you have a concourse instance or cluster already setup. It assumes that the concourse setup has access to deploy AWS infrastructure necessary by assuming an IAM role (see below for more details).

Deploying concourse config

To create the pipeline, you'll need to have your concourse instance setup and be logged in to a team that the pipeline will be run on.

To easily spin up a concourse cluster see this repo: https://github.com/EngineerBetter/concourse-up

To create the pipeline, you'll need to set some variables in a file ci/concourse-variables.yml as follows

# optional role for executing terraform
aws_deployment_role: arn:aws:iam::123456789012:role/deploy_role
# aws region we are deploying to>"
aws_region: eu-west-1
# aws account id we will be executing terraform against>"
aws_account_id: 123456789012
# s3 bucket name where terraform will story state>"
terraform_backend_bucket: s3-bucket-for-terraform-state
# object prefix/name for terraform's state file>"
terraform_backend_key: path/to/terraform.tfstate
# s3 bucket where lambda artifacts are to be stored>"
artifact_s3_bucket: artifact-s3-bucket-name
# s3 prefix for lambda artifacts
artifact_s3_key_prefix: artifacts/prefix
# VPC id to deploy the database and lambdas to
vpc_id: vpc-abc123
# Database password
db_pass: 'some password'

then you can run the following fly command, replacing <concourse_team> with your concourse team name.

fly -t <concourse_team> set-pipeline \
        --pipeline cd-demo \
        --config ci/pipeline.yml \
        --load-vars-from ci/concourse-variables.yml

cd-demo's People

Watchers

James Cloos 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.