Giter Club home page Giter Club logo

skopos-sample-app's Introduction

Join the chat at https://gitter.im/datagridsys/skopos

Skopos Continuous Deployment System for Containers

Before you get started, read this short blog on what Skopos is and what it does.

Below you will find a sample application along with a copy of the Skopos Continuous Deployment System. The instructions share how to download and install both Skopos and the demo app so that you can try out our system. If you want to try out Skopos with your own app, check out our Getting Started Guide.

Sample Skopos application

This is a sample containerized application that can be deployed and upgraded with Skopos.

The application in question exposes two web interfaces - one that allows votes to be cast and one that shows results. The example below can be used as a guide on how to deploy, upgrade (to a version with modified UI) and tear-down this sample application.

skopos sample app

Download Skopos image

docker pull datagridsys/skopos:beta

Extract Skopos CLI

The CLI is a thin wrapper on top of the Skopos REST API. It is packaged in the same container. The CLI does not need to run on the same host as Skopos, it can be run on any Linux host with network access to the Skopos engine.

mkdir -p ~/bin
rm -rf ~/bin/sks-ctl
touch ~/bin/sks-ctl
docker run                               \
    --rm                                 \
    -v ~/bin/sks-ctl:/skopos/bin/sks-ctl \
    --entrypoint "/bin/bash"             \
    datagridsys/skopos:beta              \
    -c 'cp -a engine /skopos/bin/sks-ctl'

Clone this repository

We will need the application model, environment file and same sample scripts which we are using in our model in order to hook up into various stages of the deploy.

git clone https://github.com/datagridsys/skopos-sample-app.git

Start Skopos engine

Start the Skopos container, passing it the docker socket (so it can manage containers) and the user scripts from this repository. These are sample scripts that illustrate how to hook external systems (i.e. monitoring, release/bug tracking, etc.) systems into your deploy process.

cd skopos-sample-app
docker run -d -p 8090:80 --restart=unless-stopped --name skopos   \
    -v /var/run/docker.sock:/var/run/docker.sock                  \
    -v $(pwd)/scripts:/skopos/user/bin/         \
    datagridsys/skopos:beta

Load model for initial deploy

~/bin/sks-ctl load -bind my-ip-or-host:8090 -project skopos-sample -env env.yaml model-v1.yaml

Note: replace my-ip-or-host with the actual host or IP address where Skopos runs.

Open Skopos GUI

It is available on port 8090 on the host where you are running the container. Review the model - it shows in blue the components that will change during the deploy.

You can switch the to plan (icon in upper right corner) to view the generated plan for this particular deploy. The plan shows the top level of steps to be run (one for each component plus pre- and post- flight steps). The plan would take into consideration any dependencies between components and upgrade them in the correct order. Each of the top level steps can be expanded to view the set of steps that will be performed for each component. The outcome of each step can trigger either the next step (on success) or a rollback to the previous version (on failure).

Some of the steps are inserted based on lifecycle events that were defined in the model file - this allows us to insert our own scripts to be executed at certain places in the plan:

plan

Run deploy

Either from the GUI or from CLI. The initial deploy may take a few minutes since container images will need to be downloaded.

~/bin/sks-ctl start -bind my-ip-or-host:8090

Note: replace my-ip-or-host with the actual host or IP address where Skopos runs.

After the deploy, the web interface exposed by the sample application would be available at:

Upgrade to a new version

This repository contains a second model, where the versions of two of the components - result and vote - are updated to 2.0. You can load the new model with the command below. Skopos would generate a plan for getting from the current state (v1.0) to the desired state as described in the model (v2.0 of vote and result components).

~/bin/sks-ctl load -bind my-ip-or-host:8090 -project skopos-sample -env env.yaml model-v2.yaml

Note: replace my-ip-or-host with the actual host or IP address where Skopos runs.

Review the new plan in UI. Notice how, unlike the initial deploy, it only changes two components and instead of a deploy it does a rolling upgrade, making sure each component stays responsive during the operation.

To start the deploy, use the GUI or the CLI as described above. If you open the result and vote web interfaces during the upgrade you will see how some requests are served by the old version and some are served by the new version, but the application is never inaccessible.

Tear down the application

If you want to remove all containers for our sample application, run the following command. This example loads and starts the deploy in a single command. Progress can be still viewed in the Skopos UI (or over the API).

~/bin/sks-ctl run -bind my-ip-or-host:8090 -mode teardown -project skopos-sample -env env.yaml model-v2.yaml

Note: replace my-ip-or-host with the actual host or IP address where Skopos runs.

skopos-sample-app's People

Contributors

pnickolov avatar stefana912 avatar gitter-badger 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.