/
setenv.sh
executable file
·92 lines (76 loc) · 2.46 KB
/
setenv.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
#!/bin/bash
export COMPOSE_HTTP_TIMEOUT=300
export TIMESTAMP=`date "+%Y-%m-%d" -u`
export DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
export ES_MEMORY="2g"
export ES_MEMORY_LIMIT="4g"
export MONGO_MEMORY_LIMIT="4g"
export WEBITEL_DC="default"
if [ ! -f "$DIR/env/environment" ]; then
echo "$DIR/env/environment not found!"
cp "$DIR/env/environment.example" "$DIR/env/environment"
fi
. $DIR/env/environment
if [ ! -f "$DIR/env/common" ]; then
echo "$DIR/env/common not found!"
cp "$DIR/env/common.example" "$DIR/env/common"
fi
if [ ! -f "$DIR/env/freeswitch" ]; then
echo "$DIR/env/freeswitch not found!"
cp "$DIR/env/freeswitch.example" "$DIR/env/freeswitch"
fi
if [ ! -f "$DIR/env/storage" ]; then
echo "$DIR/env/storage not found!"
cp "$DIR/env/storage.example" "$DIR/env/storage"
fi
if [ ! -f "$DIR/env/cdr" ]; then
echo "$DIR/env/cdr not found!"
cp "$DIR/env/cdr.example" "$DIR/env/cdr"
fi
if [ ! -f "$DIR/env/archive" ]; then
echo "$DIR/env/archive not found!"
cp "$DIR/env/archive.example" "$DIR/env/archive"
fi
if [ ! -f "$DIR/env/drop-sip-uac" ]; then
echo "$DIR/env/drop-sip-uac not found!"
cp "$DIR/env/drop-sip-uac.example" "$DIR/env/drop-sip-uac"
fi
if [ ! -f "$DIR/env/drop-from-ip" ]; then
echo "$DIR/env/drop-from-ip not found!"
cp "$DIR/env/drop-from-ip.example" "$DIR/env/drop-from-ip"
fi
if [ ! -f "$DIR/env/allow-from-ip" ]; then
echo "$DIR/env/allow-from-ip not found!"
cp "$DIR/env/allow-from-ip.example" "$DIR/env/allow-from-ip"
fi
if [ ! -f "${WEBITEL_DIR}/ssl/token.key" ]; then
echo "${WEBITEL_DIR}/ssl/token.key not found!"
mkdir -p "${WEBITEL_DIR}/ssl/"
OPENSSL="$(which openssl)"
if ! type "$OPENSSL" > /dev/null; then
echo "openssl is required"
exit 1;
fi
$OPENSSL genrsa -out "${WEBITEL_DIR}/ssl/token.key" 4096
fi
DC="$(which docker-compose)"
if ! type "$DC" > /dev/null; then
echo "docker-compose version 1.8.0 or greater is required"
exit 1;
fi
if [ ! -d "${WEBITEL_DIR}/esdata6" ]; then
mkdir -p "${WEBITEL_DIR}/esdata6/0"
mkdir "${WEBITEL_DIR}/esdata6/1"
mkdir "${WEBITEL_DIR}/esdata6/backups"
chown -R 1000:1000 "${WEBITEL_DIR}/esdata6"
fi
if [ ! -d "${WEBITEL_DIR}/pgsql/" ]; then
mkdir ${WEBITEL_DIR}/pgsql/
chmod -R 777 ${WEBITEL_DIR}/pgsql/
fi
if [ ! -d "${WEBITEL_DIR}/mongodb/" ]; then
mkdir ${WEBITEL_DIR}/mongodb/
fi
if [ ! -d "${WEBITEL_DIR}/backup/" ]; then
mkdir ${WEBITEL_DIR}/backup/
fi