You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple distributed application running across multiple Docker containers.
5
4
6
-
Getting started
7
-
---------------
5
+
## Getting started
8
6
9
-
Download [Docker Desktop](https://www.docker.com/products/docker-desktop) for Mac or Windows. [Docker Compose](https://docs.docker.com/compose) will be automatically installed. On Linux, make sure you have the latest version of [Compose](https://docs.docker.com/compose/install/).
7
+
Download [Docker Desktop](https://www.docker.com/products/docker-desktop) for Mac or Windows. [Docker Compose](https://docs.docker.com/compose) will be automatically installed. On Linux, make sure you have the latest version of [Compose](https://docs.docker.com/compose/install/).
10
8
9
+
This solution uses Python, Node.js, .NET, with Redis for messaging and Postgres for storage.
11
10
12
-
## Linux Containers
11
+
Run in this directory to build and run the app:
13
12
14
-
The Linux stack uses Python, Node.js, .NET Core, with Redis for messaging and Postgres for storage.
15
-
16
-
> If you're using [Docker Desktop on Windows](https://store.docker.com/editions/community/docker-ce-desktop-windows), you can run the Linux version by [switching to Linux containers](https://docs.docker.com/docker-for-windows/#switch-between-windows-and-linux-containers), or run the Windows containers version.
17
-
18
-
Run in this directory:
19
-
```
13
+
```shell
20
14
docker compose up
21
15
```
22
-
The app will be running at [http://localhost:5000](http://localhost:5000), and the results will be at [http://localhost:5001](http://localhost:5001).
16
+
17
+
The `vote` app will be running at [http://localhost:5000](http://localhost:5000), and the `results` will be at [http://localhost:5001](http://localhost:5001).
23
18
24
19
Alternately, if you want to run it on a [Docker Swarm](https://docs.docker.com/engine/swarm/), first make sure you have a swarm. If you don't, run:
The folder k8s-specifications contains the yaml specifications of the Voting App's services.
33
+
The folder k8s-specifications contains the YAML specifications of the Voting App's services.
38
34
39
-
First create the vote namespace
40
-
41
-
```
42
-
$ kubectl create namespace vote
43
-
```
35
+
Run the following command to create the deployments and services objects in the vote namespace:
44
36
45
-
Run the following command to create the deployments and services objects:
46
-
```
47
-
$ kubectl create -f k8s-specifications/
37
+
```shell
38
+
kubectl create -f k8s-specifications/
39
+
vote "vote" created
40
+
deployment "db" created
48
41
deployment "db" created
49
42
service "db" created
50
43
deployment "redis" created
@@ -58,23 +51,20 @@ deployment "worker" created
58
51
59
52
The vote interface is then available on port 31000 on each host of the cluster, the result one is available on port 31001.
60
53
61
-
Architecture
62
-
-----
54
+
## Architecture
63
55
64
56

65
57
66
-
* A front-end web app in [Python](/vote) or [ASP.NET Core](/vote/dotnet) which lets you vote between two options
67
-
* A [Redis](https://hub.docker.com/_/redis/) or [NATS](https://hub.docker.com/_/nats/) queue which collects new votes
68
-
* A [.NET Core](/worker/) worker which consumes votes and stores them in…
69
-
* A [Postgres](https://hub.docker.com/_/postgres/) or [TiDB](https://hub.docker.com/r/dockersamples/tidb/tags/) database backed by a Docker volume
70
-
* A [Node.js](/result) or [ASP.NET Core SignalR](/result/dotnet) webapp which shows the results of the voting in real time
71
-
58
+
* A front-end web app in [Python](/vote) which lets you vote between two options
59
+
* A [Redis](https://hub.docker.com/_/redis/) which collects new votes
60
+
* A [.NET](/worker/) worker which consumes votes and stores them in…
61
+
* A [Postgres](https://hub.docker.com/_/postgres/) database backed by a Docker volume
62
+
* A [Node.js](/result) web app which shows the results of the voting in real time
72
63
73
-
Notes
74
-
-----
64
+
## Notes
75
65
76
-
The voting application only accepts one vote per client. It does not register votes if a vote has already been submitted from a client.
66
+
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.
77
67
78
-
This isn't an example of a properly architected perfectly designed distributed app... it's just a simple
79
-
example of the various types of pieces and languages you might see (queues, persistent data, etc), and how to
80
-
deal with them in Docker at a basic level.
68
+
This isn't an example of a properly architected perfectly designed distributed app... it's just a simple
69
+
example of the various types of pieces and languages you might see (queues, persistent data, etc), and how to
0 commit comments