Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Example distributed app composed of multiple containers for Docker, Compose, Swarm, and Kubernetes

License

NotificationsYou must be signed in to change notification settings

dockersamples/example-voting-app

Repository files navigation

A simple distributed application running across multiple Docker containers.

Getting started

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

Run the app in Kubernetes

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/

Architecture

Architecture diagram

  • 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

Notes

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

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors34


[8]ページ先頭

©2009-2025 Movatter.jp