-
Notifications
You must be signed in to change notification settings - Fork 4
/
entrypoint.sh
executable file
·44 lines (34 loc) · 1.75 KB
/
entrypoint.sh
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
#!/usr/bin/env /bin/bash
set -eu
OMEROWEBHOST=${OMEROWEBHOST:-web}
OMERO_MS_THUMBNAIL_BACKEND_HOST=${OMERO_MS_THUMBNAIL_BACKEND_HOST:-}
OMERO_MS_IMAGE_REGION_BACKEND_HOST=${OMERO_MS_IMAGE_REGION_BACKEND_HOST:-}
sed -i -re "s/(server )[a-zA-Z0-9][a-zA-Z0-9.-]*[a-zA-Z0-9](:4080 fail_timeout=0;)/\1$OMEROWEBHOST\2/" /etc/nginx/conf.d/omero-web.conf
sed -i -re 's/warn/debug/' /etc/nginx/nginx.conf
if [ -n "$OMERO_MS_THUMBNAIL_BACKEND_HOST" ]; then
sed -i -re "s/(server )[a-zA-Z0-9][a-zA-Z0-9.-]*[a-zA-Z0-9](:8080 fail_timeout=0 max_fails=0;)/\1$OMERO_MS_THUMBNAIL_BACKEND_HOST\2/" /etc/nginx/ms-thumbnails_upstream.conf
grep -v 'include /etc/nginx/ms-thumbnails_upstream.conf;' /etc/nginx/conf.d/omero-web.conf \
&& sed -i '
/upstream omeroweb {/ i\
include /etc/nginx/ms-thumbnails_upstream.conf;
' /etc/nginx/conf.d/omero-web.conf
grep -v 'include /etc/nginx/ms-thumbnails_locations.conf;' /etc/nginx/conf.d/omero-web.conf \
&& sed -i '
/location \/ {/ i\
include /etc/nginx/ms-thumbnails_locations.conf;
' /etc/nginx/conf.d/omero-web.conf
fi
if [ -n "$OMERO_MS_IMAGE_REGION_BACKEND_HOST" ]; then
sed -i -re "s/(server )[a-zA-Z0-9][a-zA-Z0-9.-]*[a-zA-Z0-9](:8080 fail_timeout=0 max_fails=0;)/\1$OMERO_MS_IMAGE_REGION_BACKEND_HOST\2/" /etc/nginx/ms-image-region_upstream.conf
grep -v 'include /etc/nginx/ms-image-region_upstream.conf;' /etc/nginx/conf.d/omero-web.conf \
&& sed -i '
/upstream omeroweb {/ i\
include /etc/nginx/ms-image-region_upstream.conf;
' /etc/nginx/conf.d/omero-web.conf
grep -v 'include /etc/nginx/ms-image-region_locations.conf;' /etc/nginx/conf.d/omero-web.conf \
&& sed -i '
/location \/ {/ i\
include /etc/nginx/ms-image-region_locations.conf;
' /etc/nginx/conf.d/omero-web.conf
fi
nginx -g 'daemon off;'