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.
The CLI is a thin wrapper on top of the Skopos REST API. The CLI does not need to run on the same host as Skopos, it can be run on any host with network access to the Skopos engine.
The sks-ctl utility is a self-contained executable available for the following operating systems:
Linux: https://s3.amazonaws.com/get-skopos/edge/linux/sks-ctl
OS X: https://s3.amazonaws.com/get-skopos/edge/darwin/sks-ctl
Windows: https://s3.amazonaws.com/get-skopos/edge/windows/sks-ctl.exe
To download and install on Linux:
wget https://s3.amazonaws.com/get-skopos/edge/linux/sks-ctl
chmod +x sks-ctl
mkdir -p ~/bin
mv sks-ctl ~/bin
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
cd skopos-sample-app
docker run -d -p 8100:8100 --restart=unless-stopped --name skopos \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd)/scripts:/skopos/user/bin/ \
opsani/skopos:edge
Open your browser to http://localhost:8100
Note: replace localhost
with the actual host or IP address where Skopos runs.
Click the Use Our Demo App
option.
Name your demo app skopos-sample
and click Load
.
In the Skopos UI, click on your demo app name to view the model (architecture). The blue components are those that will change during the deploy.
Click Switch to Plan
(button in the upper right corner) to view the generated deployment plan for this particular application. 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).
Click the start button to Deploy the demo app. The initial deploy may take a few minutes since container images will need to be downloaded.
Once deployed, the demo app will be running here:
- Vote: http://localhost:8880/
- Result: http://localhost:8881/
Note: replace localhost
with the actual host or IP address where Skopos runs.
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 localhost:8100 -project skopos-sample -env env.yaml model-v2.yaml
Note: replace localhost
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.
Click the start button to Deploy the update to the demo app. 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.
- Vote: http://localhost:8880/
- Result: http://localhost:8881/
Note: replace localhost
with the actual host or IP address where Skopos runs.
If you want to remove all containers for our sample application, run the following command or use the "Teardown" option in the UI.
~/bin/sks-ctl run -bind localhost:8100 -mode teardown -project skopos-sample -env env.yaml model-v2.yaml
Note: replace localhost
with the actual host or IP address where Skopos runs.
Now that you have deployed your first - and second - application with Skopos, here are a few things you can try next:
Set up continuous deployment with Skopos Auto-Pilot or Jenkins CI/CD
See some of the standard deployment environments Skopos supports
... or just look at the full Skopos Documentation.
You can also reach out to us on Gitter.