-
Notifications
You must be signed in to change notification settings - Fork 18
/
docker-entrypoint.sh
executable file
·157 lines (150 loc) · 4.76 KB
/
docker-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
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
#!/usr/bin/env bash
set -e
if [[ -n ${LOG_LEVEL} ]]; then
sed 's/\(^.\+"level":\s*"\).\+\(".*$\)/\1'$LOG_LEVEL'\2/g' -i /etc/$COMPANY_NAME/documentserver/log4js/production.json
fi
if [[ -n ${LOG_TYPE} ]]; then
sed 's/\("type"\:\) "pattern"/\1 "'$LOG_TYPE'"/' -i /etc/$COMPANY_NAME/documentserver/log4js/production.json
fi
if [[ -n ${LOG_PATTERN} ]]; then
sed "s/\(\"pattern\"\:\).*/\1 \"$LOG_PATTERN\"/" -i /etc/$COMPANY_NAME/documentserver/log4js/production.json
fi
ACTIVEMQ_TRANSPORT=""
case $AMQP_PROTO in
amqps | amqp+ssl)
ACTIVEMQ_TRANSPORT="tls"
;;
*)
ACTIVEMQ_TRANSPORT="tcp"
;;
esac
if [[ -n "$REDIS_CLUSTER_NODES" ]]; then
declare -a REDIS_CLUSTER_NODES_ALL=($REDIS_CLUSTER_NODES)
REDIS_CLUSTER_NODES_ARRAY=()
for node in "${REDIS_CLUSTER_NODES_ALL[@]}"; do
REDIS_CLUSTER_NODES_ARRAY+=('{ "url": "redis://'$node'" }')
done
OLD_IFS="$IFS"
IFS=","
NODES=$(echo "${REDIS_CLUSTER_NODES_ARRAY[*]}")
IFS="$OLD_IFS"
REDIS_CLUSTER='"rootNodes": [ '$NODES' ], "defaults": { "username": "'${REDIS_SERVER_USER:-default}'", "password": "'$REDIS_SERVER_PWD'" }'
else
REDIS_CLUSTER=''
fi
export NODE_CONFIG='{
"statsd": {
"useMetrics": '${METRICS_ENABLED:-false}',
"host": "'${METRICS_HOST:-localhost}'",
"port": '${METRICS_PORT:-8125}',
"prefix": "'${METRICS_PREFIX:-ds.}'"
},
"services": {
"CoAuthoring": {
"sql": {
"type": "'${DB_TYPE:-postgres}'",
"dbHost": "'${DB_HOST:-localhost}'",
"dbPort": '${DB_PORT:-5432}',
"dbUser": "'${DB_USER:=onlyoffice}'",
"dbName": "'${DB_NAME:-${DB_USER}}'",
"dbPass": "'${DB_PWD:-onlyoffice}'"
},
"redis": {
"name": "'${REDIS_CONNECTOR_NAME:-redis}'",
"host": "'${REDIS_SERVER_HOST:-${REDIST_SERVER_HOST:-localhost}}'",
"port": '${REDIS_SERVER_PORT:-${REDIST_SERVER_PORT:-6379}}',
"options": {
"user": "'${REDIS_SERVER_USER:-default}'",
"password": "'${REDIS_SERVER_PWD}'",
"db": "'${REDIS_SERVER_DB_NUM:-0}'"
},
"optionsCluster": { '${REDIS_CLUSTER}' },
"iooptions": {
"sentinels": [
{
"host": "'${REDIS_SERVER_HOST:-localhost}'",
"port": '${REDIS_SERVER_PORT:-6379}'
}
],
"name": "'${REDIS_SENTINEL_GROUP_NAME:-mymaster}'",
"sentinelPassword": "'${REDIS_SENTINEL_PWD}'",
"username": "'${REDIS_SERVER_USER:-default}'",
"password": "'${REDIS_SERVER_PWD}'",
"db": "'${REDIS_SERVER_DB_NUM:-0}'"
}
},
"token": {
"enable": {
"browser": '${JWT_ENABLED:=true}',
"request": {
"inbox": '${JWT_ENABLED_INBOX:-${JWT_ENABLED}}',
"outbox": '${JWT_ENABLED_OUTBOX:-${JWT_ENABLED}}'
}
},
"inbox": {
"header": "'${JWT_HEADER_INBOX:-${JWT_HEADER:=Authorization}}'",
"inBody": '${JWT_IN_BODY:=false}'
},
"outbox": {
"header": "'${JWT_HEADER_OUTBOX:-${JWT_HEADER}}'",
"inBody": '${JWT_IN_BODY}'
}
},
"secret": {
"inbox": {
"string": "'${JWT_SECRET_INBOX:-${JWT_SECRET:=secret}}'"
},
"outbox": {
"string": "'${JWT_SECRET_OUTBOX:-${JWT_SECRET}}'"
},
"session": {
"string": "'${JWT_SECRET}'"
}
},
"request-filtering-agent" : {
"allowPrivateIPAddress": '${ALLOW_PRIVATE_IP_ADDRESS:-false}',
"allowMetaIPAddress": '${ALLOW_META_IP_ADDRESS:-false}',
"allowIPAddressList": '${ALLOW_IP_ADDRESS_LIST:-[]}',
"denyIPAddressList": '${DENY_IP_ADDRESS_LIST:-[]}'
}
}
},
"queue": {
"type": "'${AMQP_TYPE:=rabbitmq}'"
},
"activemq": {
"connectOptions": {
"port": "'${AMQP_PORT:=5672}'",
"host": "'${AMQP_HOST:=localhost}'",
"username": "'${AMQP_USER:=guest}'",
"password": "'${AMQP_PWD:=guest}'",
"transport": "'${ACTIVEMQ_TRANSPORT}'"
}
},
"rabbitmq": {
"url": "'${AMQP_URI:-${AMQP_PROTO:-amqp}://${AMQP_USER}:${AMQP_PWD}@${AMQP_HOST}:${AMQP_PORT}${AMQP_VHOST:-/}}'"
},
"wopi": {
"enable": '${WOPI_ENABLED:-false}'
},
"FileConverter": {
"converter": {
"maxprocesscount": 0.001
}
},
"storage": {
"fs": {
"folderPath": "/var/lib/'${COMPANY_NAME}'/documentserver/App_Data/cache/files/'${STORAGE_SUBDIRECTORY_NAME:-latest}'",
"secretString": "'${SECURE_LINK_SECRET:-verysecretstring}'"
},
"storageFolderName": "files/'${STORAGE_SUBDIRECTORY_NAME:-latest}'"
},
"persistentStorage": {
"fs": {
"folderPath": "/var/lib/'${COMPANY_NAME}'/documentserver/App_Data/cache/files",
"secretString": "'${SECURE_LINK_SECRET:-verysecretstring}'"
},
"storageFolderName": "files"
}
}'
exec "$@"