-
Notifications
You must be signed in to change notification settings - Fork 6
/
stack-saleor.yml
264 lines (251 loc) · 8.93 KB
/
stack-saleor.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
version: '3.7'
x-default-opts:
&default-opts
logging:
options:
max-size: "1m"
volumes:
saleor-redis:
networks:
saleor-backend-tier:
driver: overlay
traefik-public:
external: true
configs:
redis_config:
file: ./redis.conf
services:
api:
<<: *default-opts
build:
context: ./saleor
dockerfile: ./Dockerfile
args:
STATIC_URL: '/static/'
image: docker_hub_name/api_image_name
networks:
- saleor-backend-tier
- traefik-public
depends_on:
- redis
volumes:
- /app/saleor/static/assets
- /app/templates/templated_email/compiled
environment:
ALLOWED_CLIENT_HOSTS: example.com
# Images hosted on AWS or DigitalOcean
AWS_MEDIA_BUCKET_NAME: media-bucket-name
AWS_STORAGE_BUCKET_NAME: static-bucket-name
AWS_QUERYSTRING_AUTH: "True"
AWS_S3_REGION_NAME: bucket-region(e.g. sfo3)
AWS_S3_ENDPOINT_URL: https://sfo3.digitaloceanspaces.com
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
CACHE_URL: redis://redis:6379/0
# Format: redis://:password@redis:6379/1
# Password in redis.conf (make sure to change it in redis.conf, here and worker in service)
CELERY_BROKER_URL: redis://:kljfsdfiouFOIDSUF789s8dfSDFjksd@redis:6379/1
DATABASE_URL: postgresql://${DO_DB_USER}:${DO_DB_PASSWORD}@host:port/dbname/sslmode=require
DEFAULT_FROM_EMAIL: noreply@example.com
EMAIL_URL: smtp://${GMAIL_USERNAME}:${GMAIL_PASSWORD}@smtp.gmail.com:465/?ssl=True
SECRET_KEY: ${SECRET_KEY}
SENTRY_DSN:
command: python manage.py runserver 0.0.0.0:8000
deploy:
replicas: 3
mode: replicated
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 5
window: 60s
update_config:
parallelism: 1
delay: 10s
order: stop-first
# optionally add resource limits
# https://docs.docker.com/compose/compose-file/#resources
labels:
traefik.enable: "true"
traefik.docker.network: traefik-public
traefik.constraint-label: traefik-public
traefik.http.routers.api-http.rule: Host(`example.com`) && PathPrefix(`/api`)
traefik.http.routers.api-http.entrypoints: http
traefik.http.routers.api-http.middlewares: https-redirect
traefik.http.routers.api-https.rule: Host(`example.com`) && PathPrefix(`/api`)
traefik.http.routers.api-https.entrypoints: https
traefik.http.routers.api-https.tls: "true"
traefik.http.routers.api-https.tls.certresolver: le
traefik.http.services.api.loadbalancer.server.port: 8000
traefik.http.middlewares.stripprefix-api.stripprefix.prefixes: /api
# Security Headers
traefik.http.middlewares.api-headers.headers.framedeny: "true"
traefik.http.middlewares.api-headers.headers.sslredirect: "true"
traefik.http.middlewares.api-headers.headers.forceSTSHeader: "true"
traefik.http.routers.api-https.middlewares: api-headers,stripprefix-api@docker
storefront:
<<: *default-opts
build:
context: ./saleor-storefront
dockerfile: ./Dockerfile
image: docker_hub_name/storefront_image_name
environment:
API_URI: "https://example.com/api/graphql/"
networks:
- traefik-public
volumes:
- /app/node_modules/
deploy:
replicas: 3
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 5
window: 60s
update_config:
parallelism: 1
delay: 10s
order: stop-first
# optionally add resource limits
# https://docs.docker.com/compose/compose-file/#resources
labels:
traefik.enable: "true"
traefik.docker.network: traefik-public
traefik.constraint-label: traefik-public
traefik.http.routers.storefront-http.rule: Host(`example.com`)
traefik.http.routers.storefront-http.entrypoints: http
traefik.http.routers.storefront-http.middlewares: https-redirect
traefik.http.routers.storefront-https.rule: Host(`example.com`)
traefik.http.routers.storefront-https.entrypoints: https
traefik.http.routers.storefront-https.tls: "true"
traefik.http.routers.storefront-https.tls.certresolver: le
traefik.http.services.storefront.loadbalancer.server.port: 3000
# Security Headers
traefik.http.middlewares.storefront-headers.headers.framedeny: "true"
traefik.http.middlewares.storefront-headers.headers.sslredirect: "true"
traefik.http.middlewares.storefront-headers.headers.forceSTSHeader: "true"
traefik.http.routers.storefront-https.middlewares: storefront-headers,admin-auth
dashboard:
<<: *default-opts
build:
context: ./saleor-dashboard
dockerfile: ./Dockerfile
image: docker_hub_name/dashboard_image_name
environment:
API_URI: "https://example.com/api/graphql/"
APP_MOUNT_URI: "/dashboard/"
STATIC_URL: "/dashboard/"
volumes:
- /app/node_modules/
networks:
- traefik-public
deploy:
replicas: 3
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 5
window: 60s
update_config:
parallelism: 1
delay: 10s
order: stop-first
# optionally add resource limits
# https://docs.docker.com/compose/compose-file/#resources
labels:
traefik.enable: "true"
traefik.docker.network: traefik-public
traefik.constraint-label: traefik-public
traefik.http.routers.dashboard-http.rule: Host(`example.com`) && PathPrefix(`/dashboard`)
traefik.http.routers.dashboard-http.entrypoints: http
traefik.http.routers.dashboard-http.middlewares: https-redirect
traefik.http.routers.dashboard-https.rule: Host(`example.com`) && PathPrefix(`/dashboard`)
traefik.http.routers.dashboard-https.entrypoints: https
traefik.http.routers.dashboard-https.tls: "true"
traefik.http.routers.dashboard-https.tls.certresolver: le
traefik.http.services.dashboard.loadbalancer.server.port: 9000
traefik.http.middlewares.stripprefix-dashboard.stripprefix.prefixes: /dashboard
# Security Headers
traefik.http.middlewares.dashboard-headers.headers.framedeny: "true"
traefik.http.middlewares.dashboard-headers.headers.sslredirect: "true"
traefik.http.middlewares.dashboard-headers.headers.forceSTSHeader: "true"
traefik.http.routers.dashboard-https.middlewares: dashboard-headers,admin-auth,stripprefix-dashboard@docker
redis:
<<: *default-opts
image: redis:6.0-alpine
ports:
- target: 6379
published: 6379
protocol: tcp
mode: ingress
networks:
- saleor-backend-tier
volumes:
# TODO: redis data is available at /data so this setup does NOT save redis info. Link or fix permission issue.
- type: bind
source: /gluster/volume1/saleor-redis
target: /home/docker/data
configs:
- source: redis_config
target: /usr/local/etc/redis/redis.conf
healthcheck:
test: ["CMD-SHELL", "redis-cli PING || exit 1"]
interval: 60s
timeout: 10s
retries: 5
command: "redis-server /usr/local/etc/redis/redis.conf"
deploy:
placement:
constraints:
- node.role == manager
replicas: 3
update_config:
parallelism: 1
delay: 10s
order: stop-first
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 5
window: 60s
# optionally add resource limits
# https://docs.docker.com/compose/compose-file/#resources
worker:
<<: *default-opts
build:
context: ./saleor
dockerfile: ./Dockerfile
args:
STATIC_URL: '/static/'
image: docker_hub_name/api_image_name
command: celery -A saleor worker --app=saleor.celeryconf:app --loglevel=info
networks:
- saleor-backend-tier
depends_on:
- redis
volumes:
- /app/templates/templated_email/compiled
environment:
ALLOWED_CLIENT_HOSTS: example.com
DATABASE_URL: postgresql://${DO_DB_USER}:${DO_DB_PASSWORD}@host:port/dbname/sslmode=require
EMAIL_URL: smtp://${GMAIL_USERNAME}:${GMAIL_PASSWORD}@smtp.gmail.com:465/?ssl=True
DEFAULT_FROM_EMAIL: noreply@example.com
CACHE_URL: redis://redis:6379/0
# Format: redis://:password@redis:6379/1
# Password in redis.conf
CELERY_BROKER_URL: redis://:kljfsdfiouFOIDSUF789s8dfSDFjksd@redis:6379/1
SECRET_KEY: ${SECRET_KEY}
JWT_VERIFY_EXPIRATION: "True"
deploy:
replicas: 3
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 5
window: 60s
update_config:
parallelism: 1
delay: 10s
order: stop-first
# optionally add resource limits
# https://docs.docker.com/compose/compose-file/#resources