-
Notifications
You must be signed in to change notification settings - Fork 272
Expand file tree
/
Copy pathsetup
More file actions
executable file
·196 lines (159 loc) · 5.88 KB
/
Copy pathsetup
File metadata and controls
executable file
·196 lines (159 loc) · 5.88 KB
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
set -e
cd "$(dirname "$0")/.."
if ! [ -x "$(command -v curl)" ]; then
echo "Error: curl is not installed, but the setup script relies on it."
echo "on debian based operating systems try following command:"
echo " $ sudo apt-get install curl"
exit 1
fi
# load .env
if [ -f .env ]
then
echo "Error: the configuration file .env already exists."
echo "either edit variables manually in there or remove the file and try this script again"
exit 1
fi
. scripts/functions.sh
ensure_bbbhtml5yml
EXTERNAL_IPv4=$(curl -4 -s https://icanhazip.com)
EXTERNAL_IPv6=$(curl -6 -s -m 10 https://icanhazip.com || true)
greenlight=""
while [[ ! $greenlight =~ ^(y|n)$ ]]; do
read -p "Should greenlight be included? (y/n): " greenlight
done
https_proxy=""
LETSENCRYPT_EMAIL=""
while [[ ! $https_proxy =~ ^(y|n)$ ]]; do
read -p "Should an automatic HTTPS Proxy be included? (y/n): " https_proxy
done
if [ "$https_proxy" == "y" ]
then
while [[ ! $LETSENCRYPT_EMAIL =~ ^.+@.+\..+$ ]]; do
read -p "Please enter an Email adress for the Let's Encrypt notifications: " LETSENCRYPT_EMAIL
done
fi
DOMAIN=""
while [[ -z "$DOMAIN" ]]; do
read -p "Please enter the domain name: " DOMAIN
done
recording=""
echo "Should the recording feature be included?"
echo " IMPORTANT: this is currently a big privacy issues, because it will "
echo " record everything which happens in the conference, even when the button"
echo " suggests, that it does not."
echo " make sure that you always get people's consent, before they join a room!"
echo " https://github.com/bigbluebutton/bigbluebutton/issues/9202"
while [[ ! $recording =~ ^(y|n)$ ]]; do
read -p "Choice (y/n): " recording
done
prometheus_exporter=""
while [[ ! $prometheus_exporter =~ ^(y|n)$ ]]; do
read -p "Should a Prometheus exporter be included? (y/n): " prometheus_exporter
done
if [ "$prometheus_exporter" == "y" ] && [ "$recording" == "y" ]
then
echo "Should Prometheus exporter optimization be enabled?"
echo " This instructs exporter to collect expensive recordings metrics by querying the disk instead of the API."
echo " Enabling this can substantially decrease the scrape time required for the exporter to respond to metrics requests"
prometheus_exporter_optimization=""
while [[ ! $prometheus_exporter_optimization =~ ^(y|n)$ ]]; do
read -p "Choice (y/n): " prometheus_exporter_optimization
done
fi
if [ "$recording" == "y" ]
then
remove_old_recording=""
while [[ ! $remove_old_recording =~ ^(y|n)$ ]]; do
read -p "Should old recordings be removed? (y/n): " remove_old_recording
done
if [ "$remove_old_recording" == "y" ]
then
recording_max_age_days=""
while [[ ! $recording_max_age_days =~ ^[0-9]{1,4}$ ]]; do
read -p "Please enter max age(days) for keeping recordings: " recording_max_age_days
done
fi
fi
ip_correct=""
while [[ ! $ip_correct =~ ^(y|n)$ ]]; do
read -p "Is $EXTERNAL_IPv4 your external IPv4 address? (y/n): " ip_correct
done
if [ ! "$ip_correct" == "y" ]
then
EXTERNAL_IPv4=""
while [[ ! $EXTERNAL_IPv4 =~ ^[1-9][0-9]{0,2}\.[0-9]{0,3}\.[0-9]{0,3}\.[1-9][0-9]{0,2}$ ]]; do
read -p "Please enter correct IPv4 address: " EXTERNAL_IPv4
done
fi
if [ -n "$EXTERNAL_IPv6" ]
then
ip_correct=""
while [[ ! $ip_correct =~ ^(y|n)$ ]]; do
read -p "Is $EXTERNAL_IPv6 your external IPv6 address? (y/n): " ip_correct
done
if [ ! "$ip_correct" == "y" ]
then
EXTERNAL_IPv6=""
while [[ ! $EXTERNAL_IPv6 =~ ^[0-9a-z:]{3,39}$ ]]; do
read -p "Please enter correct IPv6 address: " EXTERNAL_IPv6
done
fi
fi
# write settings
cp sample.env .env
sed -i "s/EXTERNAL_IPv4=.*/EXTERNAL_IPv4=$EXTERNAL_IPv4/" .env
sed -i "s/EXTERNAL_IPv6=.*/EXTERNAL_IPv6=$EXTERNAL_IPv6/" .env
sed -i "s/DOMAIN=.*/DOMAIN=$DOMAIN/" .env
sed -i "s/.*STUN_IP=.*/STUN_IP=$EXTERNAL_IPv4/" .env
if [ ! "$greenlight" == "y" ]
then
sed -i "s/ENABLE_GREENLIGHT.*/#ENABLE_GREENLIGHT=true/" .env
fi
if [ ! "$https_proxy" == "y" ]
then
sed -i "s/ENABLE_HTTPS_PROXY.*/#ENABLE_HTTPS_PROXY=true/" .env
fi
sed -i "s/LETSENCRYPT_EMAIL=.*/LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL/" .env
if [ "$recording" == "y" ]
then
sed -i "s/#ENABLE_RECORDING.*/ENABLE_RECORDING=true/" .env
fi
if [ "$remove_old_recording" == "y" ]
then
sed -i "s/#REMOVE_OLD_RECORDING=.*/REMOVE_OLD_RECORDING=true/" .env
sed -i "s/#RECORDING_MAX_AGE_DAYS=.*/RECORDING_MAX_AGE_DAYS=$recording_max_age_days/" .env
fi
if [ "$prometheus_exporter" == "y" ]
then
sed -i "s/#ENABLE_PROMETHEUS_EXPORTER=.*/ENABLE_PROMETHEUS_EXPORTER=true/" .env
fi
if [ "$prometheus_exporter_optimization" == "y" ]
then
sed -i "s/#ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION=.*/ENABLE_PROMETHEUS_EXPORTER_OPTIMIZATION=true/" .env
fi
# change secrets
RANDOM_1=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
RANDOM_2=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
RANDOM_3=$(head /dev/urandom | tr -dc a-f0-9 | head -c 128)
RANDOM_4=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
RANDOM_5=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
TURN_SECRET=$(head /dev/urandom | tr -dc A-Za-f0-9 | head -c 32)
sed -i "s/SHARED_SECRET=.*/SHARED_SECRET=$RANDOM_1/" .env
sed -i "s/ETHERPAD_API_KEY=.*/ETHERPAD_API_KEY=$RANDOM_2/" .env
sed -i "s/RAILS_SECRET=.*/RAILS_SECRET=$RANDOM_3/" .env
sed -i "s/FSESL_PASSWORD=.*/FSESL_PASSWORD=$RANDOM_4/" .env
sed -i "s/POSTGRESQL_SECRET=.*/POSTGRESQL_SECRET=$RANDOM_5/" .env
sed -i "s/.*TURN_SECRET=.*/TURN_SECRET=$TURN_SECRET/" .env
./scripts/generate-compose
echo "--------------------------------------------------"
echo "configuration file .env got successfully created!"
echo ""
echo "you can look through it for further adjusments"
echo " $ nano .env"
echo ""
echo "make sure to recreate the docker-compose.yml after each change"
echo " $ ./scripts/generate-compose"
echo ""
echo "to start bigbluebutton run"
echo " $ docker compose up -d"