- Notifications
You must be signed in to change notification settings - Fork14k
Example distributed app composed of multiple containers for Docker, Compose, Swarm, and Kubernetes
License
dockersamples/example-voting-app
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple distributed application running across multiple Docker containers.
DownloadDocker Desktop for Mac or Windows.Docker Compose will be automatically installed. On Linux, make sure you have the latest version ofCompose.
This solution uses Python, Node.js, .NET, with Redis for messaging and Postgres for storage.
Run in this directory to build and run the app:
docker compose up
Thevote
app will be running athttp://localhost:8080, and theresults
will be athttp://localhost:8081.
Alternately, if you want to run it on aDocker Swarm, first make sure you have a swarm. If you don't, run:
docker swarm init
Once you have your swarm, in this directory run:
docker stack deploy --compose-file docker-stack.yml vote
The folder k8s-specifications contains the YAML specifications of the Voting App's services.
Run the following command to create the deployments and services. Note it will create these resources in your current namespace (default
if you haven't changed it.)
kubectl create -f k8s-specifications/
Thevote
web app is then available on port 31000 on each host of the cluster, theresult
web app is available on port 31001.
To remove them, run:
kubectl delete -f k8s-specifications/
- A front-end web app inPython which lets you vote between two options
- ARedis which collects new votes
- A.NET worker which consumes votes and stores them in…
- APostgres database backed by a Docker volume
- ANode.js web app which shows the results of the voting in real time
The voting application only accepts one vote per client browser. It does not register additional votes if a vote has already been submitted from a client.
This isn't an example of a properly architected perfectly designed distributed app... it's just a simpleexample of the various types of pieces and languages you might see (queues, persistent data, etc), and how todeal with them in Docker at a basic level.
About
Example distributed app composed of multiple containers for Docker, Compose, Swarm, and Kubernetes
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.