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

Commit 59cd8f2

Browse files
author
Antony MECHIN
committed
examples: Update WordPress.
Signed-off-by: Antony MECHIN <antony.mechin@docker.com>
1 parent ea98797 commit 59cd8f2

1 file changed

Lines changed: 73 additions & 55 deletions

File tree

examples/wordpress/README.md

Lines changed: 73 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -10,86 +10,96 @@ services:
1010
deploy:
1111
mode: replicated
1212
replicas: 1
13+
endpoint_mode: dnsrr
1314
environment:
1415
MYSQL_DATABASE: wordpressdata
1516
MYSQL_PASSWORD: wordpress
1617
MYSQL_ROOT_PASSWORD: axx[<^cz3d.fPb
1718
MYSQL_USER: wordpress
18-
image: mysql:8
19+
image: mysql:5.6
20+
networks:
21+
overlay: null
1922
volumes:
2023
- type: volume
2124
source: db_data
2225
target: /var/lib/mysql
2326
wordpress:
27+
depends_on:
28+
- mysql
2429
deploy:
25-
mode: global
26-
replicas: 0
30+
mode: replicated
31+
replicas: 1
32+
endpoint_mode: vip
2733
environment:
2834
WORDPRESS_DB_HOST: mysql
2935
WORDPRESS_DB_NAME: wordpressdata
3036
WORDPRESS_DB_PASSWORD: wordpress
3137
WORDPRESS_DB_USER: wordpress
3238
WORDPRESS_DEBUG: "true"
3339
image: wordpress
34-
networks: {}
40+
networks:
41+
overlay: null
42+
ports:
43+
- mode: ingress
44+
target: 80
45+
published: 8080
46+
protocol: tcp
47+
networks:
48+
overlay: {}
3549
volumes:
3650
db_data:
3751
name: db_data
38-
secrets: {}
39-
configs: {}
4052
```
4153
4254
**Merge with override Compose file**. This example replaces cleartext DB passwords to use secrets instead.
4355
4456
```yaml
45-
# docker-app render wordpress -c with-secrets.yml
57+
# docker-app render wordpress --settings-files with-secrets.yml
4658
version: "3.6"
4759
services:
4860
mysql:
4961
deploy:
5062
mode: replicated
5163
replicas: 1
64+
endpoint_mode: dnsrr
5265
environment:
5366
MYSQL_DATABASE: wordpressdata
54-
MYSQL_PASSWORD: ""
55-
MYSQL_PASSWORD_FILE: /run/secrets/wordpress_app_userpass
56-
MYSQL_ROOT_PASSWORD: ""
57-
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/wordpress_app_rootpass
67+
MYSQL_PASSWORD: wordpress
68+
MYSQL_ROOT_PASSWORD: axx[<^cz3d.fPb
5869
MYSQL_USER: wordpress
59-
image: mysql:8
60-
secrets:
61-
- source: mysql_rootpass
62-
- source: mysql_userpass
70+
image: mysql:5.6
71+
networks:
72+
overlay: null
6373
volumes:
6474
- type: volume
6575
source: db_data
6676
target: /var/lib/mysql
6777
wordpress:
78+
depends_on:
79+
- mysql
6880
deploy:
69-
mode: global
70-
replicas: 0
81+
mode: replicated
82+
replicas: 1
83+
endpoint_mode: vip
7184
environment:
7285
WORDPRESS_DB_HOST: mysql
7386
WORDPRESS_DB_NAME: wordpressdata
74-
WORDPRESS_DB_PASSWORD: ""
75-
WORDPRESS_DB_PASSWORD_FILE: /run/secrets/sumple_app_userpass
87+
WORDPRESS_DB_PASSWORD: wordpress
7688
WORDPRESS_DB_USER: wordpress
7789
WORDPRESS_DEBUG: "true"
7890
image: wordpress
79-
secrets:
80-
- source: mysql_userpass
81-
networks: {}
91+
networks:
92+
overlay: null
93+
ports:
94+
- mode: ingress
95+
target: 80
96+
published: 8080
97+
protocol: tcp
98+
networks:
99+
overlay: {}
82100
volumes:
83101
db_data:
84102
name: db_data
85-
secrets:
86-
mysql_rootpass:
87-
name: wordpress_app_rootpass
88-
external: true
89-
mysql_userpass:
90-
name: wordpress_app_userpass
91-
external: true
92-
configs: {}
93103
```
94104
95105
**Override default settings**. This example sets `debug` to false.
@@ -139,40 +149,48 @@ services:
139149
wordpress 0.1.0
140150
Maintained by: sakuya.izayoi <sizayoi@sdmansion.jp>
141151
142-
143-
144-
Setting Default
145-
------- -------
146-
mysql.user.password wordpress
147-
mysql.rootpass axx[<^cz3d.fPb
148-
mysql.database wordpressdata
149-
mysql.user.name wordpress
150-
volumes.db_data.name db_data
151-
debug true
152-
mysql.image.version 8
153-
wordpress.scale.mode global
154-
wordpress.scale.replicas 0
152+
Setting Default
153+
------- -------
154+
debug true
155+
mysql.database wordpressdata
156+
mysql.image.version 5.6
157+
mysql.rootpass axx[<^cz3d.fPb
158+
mysql.scale.endpoint_mode dnsrr
159+
mysql.scale.mode replicated
160+
mysql.scale.replicas 1
161+
mysql.user.name wordpress
162+
mysql.user.password wordpress
163+
volumes.db_data.name db_data
164+
wordpress.port 8080
165+
wordpress.scale.endpoint_mode vip
166+
wordpress.scale.mode replicated
167+
wordpress.scale.replicas 1
155168
```
156169

157170
### Generate helm package
158171

159172
`docker-app helm wordpress` will output a Helm package in the `./wordpress.helm` folder. `--compose-file` (or `-c`), `--set` (or `-e`) and `--settings-files` (or `-s`) flags apply the same way they do for the `render` subcommand.
160173

161174
```
162-
$ docker-app helm wordpress --compose-file with-secrets.yml --settings-files prod-settings.yml --set mysql.user.name=mollydock
163-
$ tree wordpress.helm
164-
wordpress.helm/
175+
$ docker-app helm wordpress --settings-files with-secrets.yml --settings-files prod-settings.yml --set mysql.user.name=mollydock
176+
$ tree wordpress.chart
177+
wordpress.chart
165178
├── Chart.yaml
166-
└── templates
167-
└── stack.yaml
179+
├── templates
180+
│   └── stack.yaml
181+
└── values.yaml
168182

169-
1 directory, 2 files
183+
1 directory, 3 files
170184
$ cat wordpress.helm/templates/stack.yaml
171-
typemeta:
172-
kind: stacks.compose.docker.com
173-
apiversion: v1beta2
174-
objectmeta:
185+
apiversion: v1beta2
186+
kind: stacks.compose.docker.com
187+
metadata:
188+
annotations: {}
175189
[...]
190+
spec:
191+
services:
192+
- deploy:
193+
[...]
176194
```
177195
178196
### Generate distributable app package
@@ -181,8 +199,8 @@ objectmeta:
181199
182200
```
183201
$ docker-app save wordpress
184-
$ docker images wordpress.dockerapp
185-
REPOSITORY TAG IMAGE ID CREATED SIZE
202+
$ docker-app ls
203+
REPOSITORY TAG IMAGE ID CREATED SIZE
186204
wordpress.dockerapp latest 61f8cafb7762 4 minutes ago 1.2kB
187205
```
188206

0 commit comments

Comments
 (0)