Giter Club home page Giter Club logo

dockervotingapp's Introduction

Goal: create networks, volumes, and services for a web-based "cats vs. dogs" voting app.

  • All images are on Docker Hub, so you should use editor to craft your commands locally, then paste them into swarm shell

  • a backend and frontend overlay network are needed. Nothing different about them other then that backend will help protect database from the voting web app. (similar to how a VLAN setup might be in traditional architecture)

  • The database server should use a named volume for preserving data. Use the new --mount format to do this: --mount type=volume,source=db-data,target=/var/lib/postgresql/data

Services (names below should be service names)

  • vote

    • dockersamples/examplevotingapp_vote:before
    • web front end for users to vote dog/cat
    • ideally published on TCP 80. Container listens on 80
    • on frontend network
    • 2+ replicas of this container

    docker service create --name vote -p 80:80 --network frontend --replicas 2 dockersamples/examplevotingapp_vote:before

  • redis

    • redis:3.2
    • key/value storage for incoming votes
    • no public ports
    • on frontend network
    • 1 replica NOTE VIDEO SAYS TWO BUT ONLY ONE NEEDED

    docker service create --name redis -p 80:80 --network frontend --replica 1 redis:3.2

  • worker

    • dockersamples/examplevotingapp_worker
    • backend processor of redis and storing results in postgres
    • no public ports
    • on frontend and backend networks
    • 1 replica

    docker service create --name worker --network frontend --network backend --replicas 1 dockersamples/examplevotingapp_worker

  • db

    • postgres:9.4
    • one named volume needed, pointing to /var/lib/postgresql/data
    • on backend network
    • 1 replica

    docker service create --name db --network backend --mount type=volume,source=db-data,target=/var/lib/postgresql/data postgres:9.4

  • result

    • dockersamples/examplevotingapp_result:before
    • web app that shows results
    • runs on high port since just for admins (lets imagine)
    • so run on a high port of your choosing (I choose 5001), container listens on 80
    • on backend network
    • 1 replica docker service create --name result --network backend --replica 1 -p 5003:80 dockersamples/examplevotingapp_result:before

dockervotingapp's People

Contributors

hiten1928 avatar

Watchers

James Cloos 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.