-
Notifications
You must be signed in to change notification settings - Fork 1
/
stack-image-processing.yml
152 lines (146 loc) · 4.01 KB
/
stack-image-processing.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
# docker stack deploy -c stack-image-processing.yml images --prune
# jakub.hajek@cometari.com
version: "3.7"
networks:
proxy-main:
external: true
services:
thumbor:
image: apsl/thumbor
environment:
- SECURITY_KEY=strong-secret-key
- ALLOW_UNSAFE_URL=False
healthcheck:
test: wget --quiet --tries=1 --spider http://localhost:8000/healthcheck || exit 1
interval: 45s
timeout: 5s
retries: 2
start_period: 10s
networks:
- proxy-main
deploy:
placement:
preferences:
- spread: node.id
mode: replicated
replicas: 1
update_config:
failure_action: rollback
parallelism: 1
delay: 30s
restart_policy:
condition: on-failure
delay: 30s
max_attempts: 10
resources:
limits:
memory: 256M
reservations:
memory: 512M
# nginx upload image via webdav and GET original URL
ul:
image: nginx:1.17
healthcheck:
test: wget --quiet --tries=1 --spider http://localhost:80/ || exit 1
interval: 30s
timeout: 5s
retries: 2
start_period: 5s
configs:
- source: nginx-config-upload
target: /etc/nginx/nginx.conf
networks:
- proxy-main
volumes:
- "images_rw:/images"
deploy:
placement:
preferences:
- spread: node.id
mode: replicated
replicas: 2
update_config:
failure_action: rollback
parallelism: 1
delay: 30s
restart_policy:
condition: on-failure
delay: 30s
max_attempts: 10
resources:
limits:
memory: 256M
reservations:
memory: 512M
labels:
- "traefik.enable=true"
- "traefik.http.routers.o4static.rule=Host(`orig.replace-me.pl`)" # Replace with your own domain
- "traefik.http.routers.o4static.tls.certresolver=le"
- "traefik.http.routers.o4static.entrypoints=websecure"
- "traefik.http.services.o4static.loadbalancer.server.port=80"
- "traefik.http.services.o4static.loadbalancer.passhostheader=true"
# nginx get image and scale with thumbor
dl:
image: nginx:1.17
healthcheck:
test: wget --quiet --tries=1 --spider http://localhost:80/ || exit 1
interval: 30s
timeout: 5s
retries: 2
start_period: 5s
networks:
- proxy-main
configs:
- source: nginx-config-download
target: /etc/nginx/nginx.conf
volumes:
- "images_ro:/images"
deploy:
placement:
preferences:
- spread: node.id
constraints:
- node.labels.processing-images==true
mode: replicated
replicas: 2
update_config:
failure_action: rollback
parallelism: 1
delay: 30s
restart_policy:
condition: on-failure
delay: 30s
max_attempts: 10
resources:
limits:
memory: 256M
reservations:
memory: 512M
labels:
- "traefik.enable=true"
- "traefik.http.routers.img4static.rule=Host(`get.replace-me.pl`)" # Replace with your own domain
- "traefik.http.routers.img4static.tls.certresolver=le"
- "traefik.http.routers.img4static.entrypoints=websecure"
- "traefik.http.services.img4static.loadbalancer.server.port=80"
- "traefik.http.services.img4static.loadbalancer.passhostheader=true"
configs:
nginx-config-upload:
name: nginx-config-upload-${NGINX-CFG-UL:-1}
file: ./image-processing/nginx-config-upload.conf
nginx-config-download:
name: nginx-config-download-${NGINX-CFG-DL:-1}
file: ./image-processing/nginx-config-dl.conf
# If you are going to use NFS than update the details accordingly or use local volumes instead of that.
volumes:
images_ro:
driver: local
driver_opts:
type: nfs
o: addr=10.16.104.4,ro
device: :/zpool-1/images
images_rw:
driver: local
driver_opts:
type: nfs
o: addr=10.16.104.4,rw
device: :/zpool-1/images