forked from arenawebrd/AutoInstaladorTypebot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
typebot.sh
351 lines (254 loc) · 8.42 KB
/
typebot.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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
#######################################################
clear
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m _ _ _ \e[0m"
echo -e "\e[32m| | _ | | | | \e[0m"
echo -e "\e[32m| | ____ ___ _| |_ _____ | | _____ __| | ___ ____ \e[0m"
echo -e "\e[32m| || _ \ /___)(_ _)(____ || | (____ | / _ | / _ \ / ___)\e[0m"
echo -e "\e[32m| || | | ||___ | | |_ / ___ || | / ___ |( (_| || |_| || | \e[0m"
echo -e "\e[32m|_||_| |_|(___/ \__)\_____| \_)\_____| \____| \___/ |_| \e[0m"
echo -e "\e[32m \e[0m"
echo -e "\e[32m _______ _ \e[0m"
echo -e "\e[32m(_______) | | _ \e[0m"
echo -e "\e[32m _ _ _ ____ _____ | |__ ___ _| |_ \e[0m"
echo -e "\e[32m | | | | | || _ \ | ___ || _ \ / _ \ (_ _)\e[0m"
echo -e "\e[32m | | | |_| || |_| || ____|| |_) )| |_| | | |_ \e[0m"
echo -e "\e[32m |_| \__ || __/ |_____)|____/ \___/ \__)\e[0m"
echo -e "\e[32m (____/ |_| \e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"
sleep 3
#######################################################
read -p "Link do Builder (ex: typebot.seudominio.com): " builder
echo ""
read -p "Porta do Builder (padrão: 3001): " portabuilder #novo
echo ""
read -p "Link do Viewer (ex: bot.seudominio.com): " viewer
echo ""
read -p "Porta do Viewer (padrão: 3002): " portaviewer #novo
echo ""
read -p "Link do Storage (ex: storage.seudominio.com): " storage
echo ""
read -p "Porta do Storage (padrão: 9000): " portastorage #novo
echo ""
read -p "Seu Email (ex: contato@dominio.com): " email
echo ""
read -p "Senha do seu Email (se for gmail, precisa ser a senha de aplicativo): " senha
echo ""
read -p "SMTP do seu email (ex: smtp.hostinger.com): " smtp
echo ""
read -p "Porta SMTP (ex: 465): " portasmtp #novo
echo ""
read -p "SMTP_SECURE (Se a porta SMTP for 465, digite true, caso contrario,digite false): " SECURE #novo
echo ""
read -p "Chave secreta de 32 caracteres: (ex: c56f3775313440c3edce57529a0f02b4): " key
#######################################################
echo ""
echo ""
echo ""
echo "Atualizando a VPS + Instalando Docker Compose + Nginx + Certbot"
sleep 3
cd
cd
clear
sudo apt update -y
sudo apt upgrade -y
apt install docker-compose -y
sudo apt update
sudo apt install nginx -y
sudo apt update
sudo apt install certbot -y
sudo apt install python3-certbot-nginx -y
sudo apt update
mkdir typebot.io
cd typebot.io
echo ""
echo ""
echo "Atualizado/Instalado com Sucesso"
sleep 3
clear
#######################################################
echo "Criando arquivo docker-compose.yml"
sleep 3
cat > docker-compose.yml << EOL
version: '3.3'
services:
typebot-db:
image: postgres:13
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=typebot
- POSTGRES_PASSWORD=typebot
typebot-builder:
ports:
- $portabuilder:3000
image: baptistearno/typebot-builder:latest
restart: always
depends_on:
- typebot-db
environment:
- DATABASE_URL=postgresql://postgres:typebot@typebot-db:5432/typebot
- NEXTAUTH_URL=https://$builder
- NEXT_PUBLIC_VIEWER_URL=https://$viewer
- ENCRYPTION_SECRET=$key
- ADMIN_EMAIL=$email
- SMTP_SECURE=$SECURE
- SMTP_HOST=$smtp
- SMTP_PORT=$portasmtp
- SMTP_USERNAME=$email
- SMTP_PASSWORD=$senha
- NEXT_PUBLIC_SMTP_FROM='Suporte Typebot' <$email>
- S3_ACCESS_KEY=minio
- S3_SECRET_KEY=minio123
- S3_BUCKET=typebot
- S3_ENDPOINT=$storage
typebot-viewer:
ports:
- $portaviewer:3000
image: baptistearno/typebot-viewer:latest
restart: always
environment:
- DATABASE_URL=postgresql://postgres:typebot@typebot-db:5432/typebot
- NEXT_PUBLIC_VIEWER_URL=https://$viewer
- ENCRYPTION_SECRET=$key
- S3_ACCESS_KEY=minio
- S3_SECRET_KEY=minio123
- S3_BUCKET=typebot
- S3_ENDPOINT=$storage
mail:
image: bytemark/smtp
restart: always
minio:
labels:
virtual.host: '$storage'
virtual.port: '$portastorage'
virtual.tls-email: '$email'
image: minio/minio
command: server /data
ports:
- '$portastorage:$portastorage'
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
volumes:
- s3_data:/data
createbuckets:
image: minio/mc
depends_on:
- minio
entrypoint: >
/bin/sh -c "
sleep 10;
/usr/bin/mc config host add minio http://minio:$portastorage minio minio123;
/usr/bin/mc mb minio/typebot;
/usr/bin/mc anonymous set public minio/typebot/public;
exit 0;
"
volumes:
db_data:
s3_data:
EOL
echo "Criado e configurado com sucesso"
sleep 3
clear
###############################################
echo "Iniciando Conteiner"
sleep 3
docker-compose up -d
echo "Typebot Instaldo... Realizando Proxy Reverso"
sleep 3
clear
###############################################
cd
cat > typebot << EOL
server {
server_name $builder;
location / {
proxy_pass http://127.0.0.1:$portabuilder;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_cache_bypass \$http_upgrade;
}
}
EOL
###############################################
sudo mv typebot /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-available/typebot /etc/nginx/sites-enabled
###############################################
cd
cat > bot << EOL
server {
server_name $viewer;
location / {
proxy_pass http://127.0.0.1:$portaviewer;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_cache_bypass \$http_upgrade;
}
}
EOL
###############################################
sudo mv bot /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-available/bot /etc/nginx/sites-enabled
##################################################
cd
cat > storage << EOL
server {
server_name $storage;
location / {
proxy_pass http://127.0.0.1:$portastorage;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_cache_bypass \$http_upgrade;
}
}
EOL
###############################################
sudo mv storage /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-available/storage /etc/nginx/sites-enabled
###############################################
sudo certbot --nginx --email $email --redirect --agree-tos -d $builder -d $viewer -d $storage
###############################################
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m _ _ _ \e[0m"
echo -e "\e[32m| | _ | | | | \e[0m"
echo -e "\e[32m| | ____ ___ _| |_ _____ | | _____ __| | ___ \e[0m"
echo -e "\e[32m| || _ \ /___)(_ _)(____ || | (____ | / _ | / _ \ \e[0m"
echo -e "\e[32m| || | | ||___ | | |_ / ___ || | / ___ |( (_| || |_| |\e[0m"
echo -e "\e[32m|_||_| |_|(___/ \__)\_____| \_)\_____| \____| \___/ \e[0m"
echo -e "\e[32m \e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32mAcesse o Builder através do link: https://$builder\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32mInscreva-se no meu Canal: https://youtube.com/oriondesign_oficial\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32mSugestões ou duvidas: https://wa.me/+5511973052593\e[0m"
echo -e "\e[32m\e[0m"
echo -e "\e[32m\e[0m"