A simple distributed application running across multiple Docker containers.
Download Docker Desktop for Mac or Windows. Docker Compose will be automatically installed. On Linux, make sure you have the latest version of Compose.
The Linux stack uses Python, Node.js, .NET Core (or optionally Java), with Redis for messaging and Postgres for storage.
If you're using Docker Desktop on Windows, you can run the Linux version by switching to Linux containers, or run the Windows containers version.
Run in this directory:
docker-compose up
The app will be running at http://localhost:5000, and the results will be at http://localhost:5001.
Alternately, if you want to run it on a Docker 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
An alternative version of the app uses Windows containers based on Nano Server. This stack runs on .NET Core, using NATS for messaging and TiDB for storage.
You can build from source using:
docker-compose -f docker-compose-windows.yml build
Then run the app using:
docker-compose -f docker-compose-windows.yml up -d
Or in a Windows swarm, run
docker stack deploy -c docker-stack-windows.yml vote
The app will be running at http://localhost:5000, and the results will be at http://localhost:5001.
The folder k8s-specifications contains the yaml specifications of the Voting App's services.
First create the vote namespace
$ kubectl create namespace vote
Run the following command to create the deployments and services objects:
$ kubectl create -f k8s-specifications/
deployment "db" created
service "db" created
deployment "redis" created
service "redis" created
deployment "result" created
service "result" created
deployment "vote" created
service "vote" created
deployment "worker" created
The vote interface is then available on port 31000 on each host of the cluster, the result one is available on port 31001.
The voting application only accepts one vote per client. It does not register 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.
经典示例: Example Voting App 示例投票App GitHub地址:https://github.com/dockersamples/example-voting-app 网络不好的同学,我已经把源码下载,地址:https://download.csdn.net/download/weixin_48447848/77354937 详细讲解地址请看:Docker Compose 练习
描述 (Description) Foundation通过使用由Motion UI库创建的过渡类来提供过渡效果。 例子 (Example) 以下示例演示了在Foundation中使用transitions - <!doctype html> <head> <meta charset = "utf-8" /> <meta http-equiv = "x-ua-compa
企业应用开发示例 对于我们的教程,我们将实施化学设备和加工公司的CRM应用程序。 该公司涉及供应商并提供服务。 我们将在整个教程中编写与此示例相关的小代码片段,以详细了解每个概念。 要执行本教程中的代码,您需要创建两个对象:Customer和Invoice对象。 如果您已经知道如何在Salesforce中创建这些对象,则可以跳过下面给出的步骤。 否则,您可以按照下面的分步指南进行操作。 创建客户对
描述: 提供一个如何使用描述项的例子。 Overview(概述) 提供一个如何使用描述项的例子。跟随此标签的文字将显示为高亮代码。 Examples(例子) 注意,一个doclet中可以同时使用多个@example标签。 例如,描述多个示例: /** * Solves equations of the form a * x = b * @example * // returns 2 * g
An implementation of the @handsontable/vue component with a readOnly toggle switch and the Vuex state manager implemented. Toggle readOnly for the entire table Vuex store dump: Toggle readOnly for the
A simple implementation of the @handsontable/vue component.import Vue from 'vue'; import { HotTable } from '@handsontable/vue'; import Handsontable from 'handsontable'; new Vue({ el: '#example1', data
An implementation of the @handsontable/angular wrapper.// app.component.ts import { Component } from '@angular/core'; import * as Handsontable from 'handsontable'; @Component({ selector: 'app-root', t