Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 7f6d98d

Browse files
author
Antony MECHIN
committed
Examples: Style.
Signed-off-by: Antony MECHIN <[email protected]>
1 parent 5db30f0 commit 7f6d98d

File tree

1 file changed

+84
-9
lines changed

1 file changed

+84
-9
lines changed

examples/voting-app/README.md

Lines changed: 84 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,80 @@ Change default replicas, from:
3232
- `<value:1>` to `${result.replicas}`
3333
- `<value:1>` to `${worker.replicas}`
3434

35+
---
36+
37+
[voting-app.dockerapp/docker-compose.yml](voting-app.dockerapp/docker-compose.yml):
38+
```yml
39+
[...]
40+
vote:
41+
image: ${vote.image.name}:${vote.image.tag}
42+
ports:
43+
- ${vote.port}:80
44+
networks:
45+
- frontend
46+
depends_on:
47+
- redis
48+
deploy:
49+
replicas: ${vote.replicas}
50+
update_config:
51+
parallelism: 2
52+
restart_policy:
53+
condition: on-failure
54+
55+
result:
56+
image: ${result.image.name}:${result.image.tag}
57+
ports:
58+
- ${result.port}:80
59+
networks:
60+
- backend
61+
depends_on:
62+
- db
63+
deploy:
64+
replicas: ${result.replicas}
65+
update_config:
66+
parallelism: 2
67+
delay: 10s
68+
restart_policy:
69+
condition: on-failure
70+
71+
worker:
72+
image: ${worker.image.name}:${worker.image.tag}
73+
networks:
74+
- frontend
75+
- backend
76+
deploy:
77+
mode: replicated
78+
replicas: ${worker.replicas}
79+
labels: [APP=VOTING]
80+
restart_policy:
81+
condition: on-failure
82+
delay: 10s
83+
max_attempts: 3
84+
window: 120s
85+
placement:
86+
constraints: [node.role == manager]
87+
88+
visualizer:
89+
image: ${visualizer.image.name}:${visualizer.image.tag}
90+
ports:
91+
- ${visualizer.port}:8080
92+
stop_grace_period: 1m30s
93+
volumes:
94+
- "/var/run/docker.sock:/var/run/docker.sock"
95+
deploy:
96+
placement:
97+
constraints: [node.role == manager]
98+
[...]
99+
```
100+
35101
### Give variables their default value
36102

37103
Open `settings.yml` and add every variables with the default value you want, e.g.:
38104

39-
```
40-
$ cat settings.yml
105+
---
106+
107+
[voting-app.dockerapp/settings.yml](voting-app.dockerapp/settings.yml):
108+
```yml
41109
# Vote.
42110
vote:
43111
image:
@@ -75,8 +143,10 @@ Test your application by running `docker-app render`.
75143

76144
Create `settings/development.yml` and `settings/production.yml` and add your target-specific variables.
77145

78-
```
79-
$ cat settings/development.yml
146+
---
147+
148+
[voting-app.dockerapp/settings/development.yml](voting-app.dockerapp/settings/development.yml):
149+
```yml
80150
# Vote.
81151
vote:
82152
image:
@@ -87,8 +157,10 @@ result:
87157
image:
88158
name: result
89159
```
90-
```
91-
$ cat settings/production.yml
160+
---
161+
162+
[voting-app.dockerapp/settings/production.yml](voting-app.dockerapp/settings/production.yml):
163+
```yml
92164
# Vote.
93165
vote:
94166
port: 80
@@ -104,15 +176,18 @@ result:
104176

105177
Add a Makefile to simplify rendering, deploying and killing your app.
106178

107-
```
108-
$ cat Makefile
179+
---
180+
181+
[voting-app.dockerapp/Makefile](voting-app.dockerapp/Makefile):
182+
```Makefile
109183
# Input.
110-
APP_NAME := voting-app
111184
SETTINGS_DIR ?= settings
185+
APP_NAME := voting-app
112186
113187
# Output.
114188
DEVELOPMENT_DIR := build/development
115189
PRODUCTION_DIR := build/production
190+
PACK := $(APP_NAME).pack
116191
117192
#
118193
# Cleanup.

0 commit comments

Comments
 (0)