Giter Club home page Giter Club logo

cicd-flaskapp's Introduction

cicd-flaskapp

Build Status

In this project I explore making my own python package and installing it as a dependecy for this flask app, I also give a basic example of a complete continuous integration pipline from development to deployment to a docker swarm hosted on http://lydanny.com. for a live example(hopefully still running since I have student credits)

If you also want to see the condition of the swarm check out

Description: Here we have a example of a python flask complete continuous Integration continuous deployment pipline, the features and technologies used are:

  1. Docker
  2. Docker swarm
  3. Docker Hub
  4. Travis CI
  5. pytest
  6. Flask
  7. Jinja2
  8. Sherperd
  9. Git
  10. redis

The pipline starts at our local development system , cloning the git repo we begin the development, as we develop we can branch to feature branches or stay with master, changing the code base and checking the features on our local machine with docker local host machine.

As we commit and push our code changes, this is sent to travis CI for unit testing and docker build confirmations, this is done with python pytest, to test our new feature builds. Travis will clone our entire repo as well as start its own virtual env on their services, following the defined .travis.yml instructions to set up the build enviroment.

Once the build environment is setup our unit test(pytest) scripts are called, any of the 4 stages of travis build stages that return a non-zero exit code are considered broken build: [before_install],[after_install],[install],[script]. if any of these return non-zero exit codes then travis will notify the users (defined within the travis.yml config) once a build has passed the predefined unittest code, it then moves to a script to test docker image build passes, sometimes unittest passes however the docker build image (in production may fail) so we test this here. If the building and running of the docker image does NOT return a non-zero exit code, we move to start building the actual image appending the latest build version tag to it. once the build has completed travis is instructed to upload/push the new image to our docker hub repo.

We use shepered (very small 4mb) docker image running on our docker swarm, to periodically check for updates on our containers currently running on the cluster, if there is a new digest in our dockerhub( which is all taken care of by docker hub itself) then sherpered will, gracefully perform a rolling update on the current running containers, pulling the new build-passed code updates to the running environment(production)

This example concludes there are alot of configurations to learn and undertand however please check out these tools.

Travis CI Sheperd Docker Flask Jinja2

cicd-flaskapp's People

Contributors

redklouds avatar

Stargazers

M. KHADIR avatar Lionell Loh Jian An  avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

rus19023

cicd-flaskapp's Issues

travis Build Cofig

If the configuration of the .travis.yml is set to after_success, these docker build items will not be flagged as broken if they return a none zero exit code, change after_success with one of the 4 broken build # flags

Docker swarm, will shut down when build deploys a broken image

more rigorous integration testing before deploying the new image to docker hub, if the image deployed on the swarm is broken the swarm will shut down, when a fix is updated to the docker hub swarm has no way to 'redeploy' itself only update, therefore there needs to be more rigorous integration testing to prevent broken images into 'production'

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.