#Docker Pets as a Service
written for
chrch/paas:1.1
PaaS is a simple application that's useful for testing out features of Docker Datacenter.
If you are interested in a guide on how to demo PaaS on the Universal Control Plane then check out this tutorial.
If you are interested in contributing to Docker PaaS please check out the Release Notes & Roadmap..
PaaS is comprised of two images:
chrch/paas
is a front-end Python Flask container that serves up random images of housepets, depending on the given configurationconsul
is a back-end KV store that stores the number of visits that theweb
services recieve. It's configured to bootstrap itself with 3 replicas so that we have fault tolerant persistence.
###Running PaaS as a Single Container, Stateless App
$ docker run -it -p 5000:5000 chrch/paas
###Running PaaS on Docker for Mac/Windows in Development Docker Swarm can easily be set up to run applications on a single developer laptop. The full app can be brought up to run in the same way it would run in production. We use a compose v3 file to deploy a fully fault tolerant frontend and backend, along with the configurations, secrets, and networks required for the application to run.
This is the full architecture that is deployed when using pets-dev-compose.yml.
$ git clone https://github.com/mark-church/docker-paas
~/docker-paas$ docker -v
Docker version 1.13.1-rc1, build 2527cfc
~/docker-paas$ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
fd3ovikiq7tzmdr70zukbsgbs * moby Ready Active Leader
~/docker-paas$ docker stack deploy -c pets-dev-compose.yml pets
###PaaS configuration parameters
The web
container has several configuration parameters as environment variables:
DB
: Tellsweb
where to finddb
. Service name or<ip>:<port>
.DEBUG
: Putsweb
containers in to debug mode. When mounting a volume for code, they will restart automatically when they detect a change in the code. Defaults to off, set toTrue
to turn on.ADMIN_PASSWORD_FILE
: Turns secrets on. If set, will password protect the Admin Console ofweb
. Set to the full location of the Swarm secret (/run/secrets/< X >
)
####Exposed Services
- Client Web Access - (dev port
5000
, prod URLpets.dckr.org
)/
shows the selected Pet/vote
displays the vote selection/health
displays the application health of the given container/kill
toggles the health off for one of the web servers
- Admin Console - (dev port
7000
, prod URLadmin.pets.dckr.org
)/
displays voting results, redirects to/login
if secrets are configured/login
requests login password
- Consul Backend - (dev port
8500
, prod ephemeral port)/ui
displays Consul server UI
####Voting Option Configuration
OPTION_A
: Defaults to 'Cats'. Pictures located in/docker-paas/web/static/option_a
OPTION_B
: Defaults to 'Dogs'. Pictures located in/docker-paas/web/static/option_b
OPTION_C
: Defaults to 'Whales'. Pictures located in/docker-paas/web/static/option_c
###Running PaaS on Docker UCP in Production This full length tutorial will show you how to deploy and demo DDC with the PaaS app.
Production apps have entirely different requirements when it comes to security, deployment, and also security. Fortunately, deployment on Swarm & UCP is very much the same from development to production. Some minor additions to our compose file add in capabilities for secrets and also for L7 load balancing.
This is the full architecture that is deployed when using pets-prod-compose.yml.
$ echo "mysecret" | docker secret create admin_password_v1 -
$ docker stack deploy -c pets-prod-compose.yml pets