-
Notifications
You must be signed in to change notification settings - Fork 1
/
stack-dev.yml
163 lines (135 loc) · 4.31 KB
/
stack-dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
version: '3.8'
services:
# Webpack Dev Server
dev:
image: nonfiction/webpack:v1
command: webpack-dev-server --hide-modules --hot
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]
labels:
traefik.enable: "true"
traefik.docker.network: "proxy"
<% ROUTER="$(bin/get app)" -%>
<% SERVICE="$(bin/get app)" %>
<% CSP="$(bin/get app)-csp" %>
traefik.http.routers.<%= $ROUTER -%>.entrypoints: "websecure"
traefik.http.routers.<%= $ROUTER -%>.rule: "Host(`<%= $(bin/get host) %>`)"
traefik.http.routers.<%= $ROUTER -%>.tls.certresolver: "resolver-dns"
traefik.http.routers.<%= $ROUTER -%>.tls.domains[0].main: "<%= $(bin/get swarm) %>"
traefik.http.routers.<%= $ROUTER -%>.tls.domains[0].sans: "*.<%= $(bin/get swarm) %>"
traefik.http.routers.<%= $ROUTER -%>.middlewares: "<%= $CSP %>@docker"
traefik.http.services.<%= $SERVICE -%>.loadbalancer.server.port: "443"
traefik.http.services.<%= $SERVICE -%>.loadbalancer.server.scheme: "https"
traefik.http.middlewares.<%= $CSP -%>.headers.customResponseHeaders.Content-Security-Policy: "frame-ancestors 'self'"
environment:
# used by webpack.config.js
UPSTREAM: "https://<%= $(bin/get app) %>_srv"
volumes:
- <%= $(pwd) %>/webpack.config.js:/srv/webpack.config.js
- <%= $(pwd) %>/node_modules:/srv/node_modules
- <%= $(pwd) %>/package.json:/srv/package.json
- <%= $(pwd) %>/package-lock.json:/srv/package-lock.json
- <%= $(pwd) %>/app:/srv/app
- <%= $(pwd) %>/config:/srv/config
- <%= $(pwd) %>/web:/srv/web
networks:
- backend
- proxy
# Wordpress
srv:
image: <%= $(bin/get image --tag) %>
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]
update_config:
order: start-first
failure_action: rollback
parallelism: 1
delay: 5s
rollback_config:
order: start-first
failure_action: pause
parallelism: 1
environment:
WP_ENV: "development"
HOST: "<%= $(bin/get host) %>"
DB_HOST: "db:3306"
DB_NAME: "<%= $(bin/get db_name) %>"
DB_USER: "<%= $(bin/get db_user) %>"
DB_PASSWORD: "<%= $(bin/get db_password) %>"
SMTP_HOST: "<%= $(bin/get SMTP_HOST) %>"
SMTP_PORT: "<%= $(bin/get SMTP_PORT) %>"
SMTP_USER: "<%= $(bin/get SMTP_USER) %>"
SMTP_PASSWORD: "<%= $(bin/get SMTP_PASSWORD) %>"
volumes:
- <%= $(bin/get uploads) %>:/srv/web/content/uploads
- cache:/srv/web/content/cache
- settings:/srv/web/content/settings
- <%= $(bin/get dump) %>:/srv/dump.sql
- <%= $(pwd) %>/app:/srv/app
- <%= $(pwd) %>/config:/srv/config
- <%= $(pwd) %>/src:/srv/src
- <%= $(pwd) %>/theme:/srv/theme
- <%= $(pwd) %>/vendor:/srv/vendor
- <%= $(pwd) %>/web:/srv/web
- <%= $(pwd) %>/web/content/advanced-cache.php:/srv/web/content/advanced-cache.php:ro
- <%= $(pwd) %>/web/content/object-cache.php:/srv/web/content/object-cache.php:ro
- <%= $(pwd) %>/web/content/db.php:/srv/web/content/db.php:ro
networks:
- backend
- db
# Cron
cron:
image: nonfiction/wordpress-cron:v3
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]
environment:
HOST: "<%= $(bin/get host) %>"
HOST_USER: "<%= $(bin/get host_user) %>"
HOST_PASSWORD: "<%= $(bin/get host_password) %>"
DB_HOST: "db"
DB_PORT: "3306"
DB_USER: "<%= $(bin/get db_user) %>"
DB_PASSWORD: "<%= $(bin/get db_password) %>"
DB_NAME: "<%= $(bin/get db_name) %>"
volumes:
- <%= $(bin/get dump) %>:/cron/dump.sql
networks:
- proxy
- db
# Object Cache
redis:
image: redis:alpine
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]
command: >
redis-server
--databases 1
--maxmemory 50mb
--maxmemory-policy allkeys-lru
networks:
- backend
networks:
backend:
proxy:
name: proxy
driver: overlay
external: true
db:
name: db
driver: overlay
external: true
volumes:
cache:
settings: