-
Notifications
You must be signed in to change notification settings - Fork 1
/
entrypoint.sh
executable file
·62 lines (52 loc) · 2.23 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
# Copyright 2018 The OpenSDS Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
OPENSDS_GELATO_URL=${OPENSDS_GELATO_URL:-http://127.0.0.1:8089}
OPENSDS_S3_URL=${OPENSDS_S3_URL:-http://127.0.0.1:8090}
OPENSDS_AUTH_URL=${OPENSDS_AUTH_URL:-http://127.0.0.1/identity}
OPENSDS_GELATO_API_VERSION=${OPENSDS_GELATO_API_VERSION:-v1}
OPENSDS_S3_API_VERSION=${OPENSDS_S3_API_VERSION:-s3}
OPENSDS_AUTH_API_VERSION=${OPENSDS_AUTH_API_VERSION:-v3}
LISTEN_PORT=${LISTEN_PORT:-9003}
cat > /etc/nginx/conf.d/default.conf <<EOF
server {
listen ${LISTEN_PORT} default_server;
listen [::]:${LISTEN_PORT} default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location /${OPENSDS_AUTH_API_VERSION}/ {
proxy_pass ${OPENSDS_AUTH_URL}/${OPENSDS_AUTH_API_VERSION}/;
}
location /${OPENSDS_GELATO_API_VERSION}/ {
proxy_pass ${OPENSDS_GELATO_URL}/${OPENSDS_GELATO_API_VERSION}/;
client_max_body_size 10240m;
}
location /${OPENSDS_S3_API_VERSION}/ {
proxy_pass ${OPENSDS_S3_URL}/;
client_max_body_size 10240m;
}
}
EOF
# print some log to stdin
echo "Service Start Time $(date)"
echo "Configuration /etc/nginx/conf.d/default.conf"
cat /etc/nginx/conf.d/default.conf
echo "Starting application..."
echo "OPENSDS_S3_HOST = ${OPENSDS_S3_HOST}"
echo "OPENSDS_S3_PORT = ${OPENSDS_S3_PORT}"
echo "STORAGE_SERVICE_PLAN_ENABLED = ${STORAGE_SERVICE_PLAN_ENABLED}"
echo "{\"hostIP\": \"$OPENSDS_S3_HOST\",\"hostPort\": \"$OPENSDS_S3_PORT\",\"servicePlansEnabled\": \"$STORAGE_SERVICE_PLAN_ENABLED\"}" >/var/www/html/assets/data/runtime.json
# start nginx service
/usr/sbin/nginx -g "daemon off;"