atendeticket 2.1.12 → 2.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/TODO.md +23 -0
- package/appInstaller.js +1 -299
- package/instalador_antigo/LICENSE +5 -0
- package/instalador_antigo/Multizap.zip +0 -0
- package/instalador_antigo/README.md +10 -0
- package/instalador_antigo/config +3 -0
- package/instalador_antigo/instalar_nova_instancia +75 -0
- package/instalador_antigo/instalar_primaria +220 -0
- package/instalador_antigo/lib/_backend.sh +453 -0
- package/instalador_antigo/lib/_frontend.sh +342 -0
- package/instalador_antigo/lib/_inquiry.sh +247 -0
- package/instalador_antigo/lib/_system.sh +676 -0
- package/instalador_antigo/lib/manifest.sh +6 -0
- package/instalador_antigo/utils/_banner.sh +45 -0
- package/instalador_antigo/utils/manifest.sh +3 -0
- package/instalador_antigo/variables/_app.sh +15 -0
- package/instalador_antigo/variables/_background.sh +6 -0
- package/instalador_antigo/variables/_fonts.sh +16 -0
- package/instalador_antigo/variables/_general.sh +5 -0
- package/instalador_antigo/variables/manifest.sh +6 -0
- package/installers/backend/createDatabase.js +31 -3
- package/installers/system/certbotSetup.js +16 -0
- package/installers/system/copyProjectFiles.js +20 -0
- package/installers/system/createUser.js +12 -6
- package/installers/system/index.js +12 -2
- package/package.json +1 -1
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# functions for setting up app frontend
|
|
4
|
+
|
|
5
|
+
#######################################
|
|
6
|
+
# installed node packages
|
|
7
|
+
# Arguments:
|
|
8
|
+
# None
|
|
9
|
+
#######################################
|
|
10
|
+
frontend_node_dependencies() {
|
|
11
|
+
print_banner
|
|
12
|
+
printf "${WHITE} 💻 Instalando dependências do frontend...${GRAY_LIGHT}"
|
|
13
|
+
printf "\n\n"
|
|
14
|
+
|
|
15
|
+
sleep 2
|
|
16
|
+
|
|
17
|
+
sudo su - deploy <<EOF
|
|
18
|
+
cd /home/deploy/${instancia_add}/frontend
|
|
19
|
+
|
|
20
|
+
# Limpa cache e node_modules para instalação limpa
|
|
21
|
+
rm -rf node_modules package-lock.json npm-debug.log*
|
|
22
|
+
npm cache clean --force
|
|
23
|
+
|
|
24
|
+
# Instala react-scripts primeiro (versão compatível)
|
|
25
|
+
echo "📦 Instalando React Scripts..."
|
|
26
|
+
npm install react-scripts@5 --save --force
|
|
27
|
+
|
|
28
|
+
# Verifica se usa CRACO e instala se necessário
|
|
29
|
+
if [ -f "craco.config.js" ]; then
|
|
30
|
+
echo "🔧 Detectado CRACO, instalando dependências..."
|
|
31
|
+
npm install @craco/craco --save --force
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# Instala todas as dependências
|
|
35
|
+
echo "📦 Instalando todas as dependências..."
|
|
36
|
+
npm install --force --legacy-peer-deps
|
|
37
|
+
|
|
38
|
+
# Verificação final de dependências críticas
|
|
39
|
+
if [ ! -d "node_modules/react" ]; then
|
|
40
|
+
echo "⚠️ React não instalado, tentando instalação alternativa..."
|
|
41
|
+
npm install react react-dom --save --force
|
|
42
|
+
fi
|
|
43
|
+
EOF
|
|
44
|
+
|
|
45
|
+
sleep 2
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#######################################
|
|
49
|
+
# compiles frontend code
|
|
50
|
+
# Arguments:
|
|
51
|
+
# None
|
|
52
|
+
#######################################
|
|
53
|
+
frontend_node_build() {
|
|
54
|
+
print_banner
|
|
55
|
+
printf "${WHITE} 💻 Compilando o código do frontend...${GRAY_LIGHT}"
|
|
56
|
+
printf "\n\n"
|
|
57
|
+
|
|
58
|
+
sleep 2
|
|
59
|
+
|
|
60
|
+
sudo su - deploy <<EOF
|
|
61
|
+
cd /home/deploy/${instancia_add}/frontend
|
|
62
|
+
|
|
63
|
+
# Verifica se o projeto usa CRACO ou React Scripts padrão
|
|
64
|
+
if [ -f "craco.config.js" ]; then
|
|
65
|
+
echo "🔧 Compilando com CRACO..."
|
|
66
|
+
npx craco build || {
|
|
67
|
+
echo "⚠️ Build com CRACO falhou, tentando com react-scripts..."
|
|
68
|
+
npm run build
|
|
69
|
+
}
|
|
70
|
+
else
|
|
71
|
+
echo "⚛️ Compilando com React Scripts padrão..."
|
|
72
|
+
npm run build || {
|
|
73
|
+
echo "⚠️ Build padrão falhou, tentando alternativas..."
|
|
74
|
+
# Tenta com variáveis de ambiente para build
|
|
75
|
+
CI=false npm run build
|
|
76
|
+
}
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# Verifica se o build foi bem-sucedido
|
|
80
|
+
if [ -d "build" ] && [ -f "build/index.html" ]; then
|
|
81
|
+
echo "✅ Build frontend realizado com sucesso!"
|
|
82
|
+
else
|
|
83
|
+
echo "❌ Falha no build frontend. Verifique os logs acima."
|
|
84
|
+
exit 1
|
|
85
|
+
fi
|
|
86
|
+
EOF
|
|
87
|
+
|
|
88
|
+
sleep 2
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
#######################################
|
|
92
|
+
# updates frontend code
|
|
93
|
+
# Arguments:
|
|
94
|
+
# None
|
|
95
|
+
#######################################
|
|
96
|
+
frontend_update() {
|
|
97
|
+
print_banner
|
|
98
|
+
printf "${WHITE} 💻 Atualizando o frontend...${GRAY_LIGHT}"
|
|
99
|
+
printf "\n\n"
|
|
100
|
+
|
|
101
|
+
sleep 2
|
|
102
|
+
|
|
103
|
+
sudo su - deploy <<EOF
|
|
104
|
+
cd /home/deploy/${empresa_atualizar}
|
|
105
|
+
pm2 stop ${empresa_atualizar}-frontend
|
|
106
|
+
|
|
107
|
+
# Atualiza o código (git pull ou outro método)
|
|
108
|
+
if [ -d ".git" ]; then
|
|
109
|
+
git pull
|
|
110
|
+
else
|
|
111
|
+
echo "⚠️ Não é um repositório git, pulando atualização de código..."
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
cd /home/deploy/${empresa_atualizar}/frontend
|
|
115
|
+
|
|
116
|
+
# Limpeza para instalação limpa
|
|
117
|
+
rm -rf node_modules package-lock.json build
|
|
118
|
+
|
|
119
|
+
# Reinstala dependências
|
|
120
|
+
npm install react-scripts@5 --save --force
|
|
121
|
+
|
|
122
|
+
# Verifica CRACO
|
|
123
|
+
if [ -f "craco.config.js" ]; then
|
|
124
|
+
npm install @craco/craco --save --force
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
npm install --force --legacy-peer-deps
|
|
128
|
+
|
|
129
|
+
# Rebuild
|
|
130
|
+
if [ -f "craco.config.js" ]; then
|
|
131
|
+
npx craco build
|
|
132
|
+
else
|
|
133
|
+
npm run build
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
# Reinicia o frontend
|
|
137
|
+
pm2 start ${empresa_atualizar}-frontend
|
|
138
|
+
pm2 save
|
|
139
|
+
EOF
|
|
140
|
+
|
|
141
|
+
sleep 2
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
#######################################
|
|
145
|
+
# sets frontend environment variables
|
|
146
|
+
# Arguments:
|
|
147
|
+
# None
|
|
148
|
+
#######################################
|
|
149
|
+
frontend_set_env() {
|
|
150
|
+
print_banner
|
|
151
|
+
printf "${WHITE} 💻 Configurando variáveis de ambiente (frontend)...${GRAY_LIGHT}"
|
|
152
|
+
printf "\n\n"
|
|
153
|
+
|
|
154
|
+
sleep 2
|
|
155
|
+
|
|
156
|
+
# ensure idempotency
|
|
157
|
+
backend_url=$(echo "${backend_url/https:\/\/}")
|
|
158
|
+
backend_url=${backend_url%%/*}
|
|
159
|
+
backend_url=https://$backend_url
|
|
160
|
+
|
|
161
|
+
sudo su - deploy << EOF
|
|
162
|
+
cat <<[-]EOF > /home/deploy/${instancia_add}/frontend/.env
|
|
163
|
+
REACT_APP_BACKEND_URL=${backend_url}
|
|
164
|
+
REACT_APP_HOURS_CLOSE_TICKETS_AUTO=24
|
|
165
|
+
|
|
166
|
+
REACT_APP_BACKEND_PROTOCOL=https
|
|
167
|
+
REACT_APP_BACKEND_HOST=URL_BACKEND
|
|
168
|
+
REACT_APP_BACKEND_PORT=443
|
|
169
|
+
REACT_APP_LOCALE=pt-br
|
|
170
|
+
REACT_APP_TIMEZONE=America/Sao_Paulo
|
|
171
|
+
REACT_APP_NUMBER_SUPPORT=55XXXXXXXXXXX
|
|
172
|
+
|
|
173
|
+
CERTIFICADOS=false
|
|
174
|
+
HTTPS=false
|
|
175
|
+
SSL_CRT_FILE=F:\\bkpidx\\workflow\\backend\\certs\\localhost.pem
|
|
176
|
+
SSL_KEY_FILE=F:\\bkpidx\\workflow\\backend\\certs\\localhost-key.pem
|
|
177
|
+
|
|
178
|
+
REACT_APP_FACEBOOK_APP_ID=2813216208828642
|
|
179
|
+
REACT_APP_REQUIRE_BUSINESS_MANAGEMENT=TRUE
|
|
180
|
+
|
|
181
|
+
# Variáveis para build
|
|
182
|
+
GENERATE_SOURCEMAP=false
|
|
183
|
+
DISABLE_ESLINT_PLUGIN=false
|
|
184
|
+
[-]EOF
|
|
185
|
+
EOF
|
|
186
|
+
|
|
187
|
+
sleep 2
|
|
188
|
+
|
|
189
|
+
sudo su - deploy << EOF
|
|
190
|
+
cat <<[-]EOF > /home/deploy/${instancia_add}/frontend/server.js
|
|
191
|
+
//simple express server to run frontend production build;
|
|
192
|
+
const express = require("express");
|
|
193
|
+
const path = require("path");
|
|
194
|
+
const app = express();
|
|
195
|
+
app.use(express.static(path.join(__dirname, "build")));
|
|
196
|
+
app.get("/*", function (req, res) {
|
|
197
|
+
res.sendFile(path.join(__dirname, "build", "index.html"));
|
|
198
|
+
});
|
|
199
|
+
app.listen(${frontend_port});
|
|
200
|
+
|
|
201
|
+
[-]EOF
|
|
202
|
+
EOF
|
|
203
|
+
|
|
204
|
+
sleep 2
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
#######################################
|
|
208
|
+
# starts pm2 for frontend
|
|
209
|
+
# Arguments:
|
|
210
|
+
# None
|
|
211
|
+
#######################################
|
|
212
|
+
frontend_start_pm2() {
|
|
213
|
+
print_banner
|
|
214
|
+
printf "${WHITE} 💻 Iniciando pm2 (frontend)...${GRAY_LIGHT}"
|
|
215
|
+
printf "\n\n"
|
|
216
|
+
|
|
217
|
+
sleep 2
|
|
218
|
+
|
|
219
|
+
sudo su - deploy <<EOF
|
|
220
|
+
cd /home/deploy/${instancia_add}/frontend
|
|
221
|
+
|
|
222
|
+
# Para o processo se já estiver rodando
|
|
223
|
+
pm2 stop ${instancia_add}-frontend 2>/dev/null || true
|
|
224
|
+
pm2 delete ${instancia_add}-frontend 2>/dev/null || true
|
|
225
|
+
|
|
226
|
+
# Inicia o frontend
|
|
227
|
+
pm2 start server.js --name ${instancia_add}-frontend
|
|
228
|
+
pm2 save
|
|
229
|
+
|
|
230
|
+
# Verifica se iniciou corretamente
|
|
231
|
+
if pm2 list | grep -q "${instancia_add}-frontend"; then
|
|
232
|
+
echo "✅ Frontend PM2 iniciado com sucesso"
|
|
233
|
+
else
|
|
234
|
+
echo "❌ Falha ao iniciar frontend no PM2"
|
|
235
|
+
exit 1
|
|
236
|
+
fi
|
|
237
|
+
EOF
|
|
238
|
+
|
|
239
|
+
sleep 2
|
|
240
|
+
|
|
241
|
+
# Configura startup do PM2 apenas uma vez
|
|
242
|
+
if ! grep -q "pm2 startup" /etc/rc.local 2>/dev/null; then
|
|
243
|
+
sudo su - root <<EOF
|
|
244
|
+
pm2 startup systemd -u deploy --hp /home/deploy
|
|
245
|
+
sudo env PATH=\$PATH:/usr/bin pm2 startup systemd -u deploy --hp /home/deploy
|
|
246
|
+
EOF
|
|
247
|
+
fi
|
|
248
|
+
|
|
249
|
+
sleep 2
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
#######################################
|
|
253
|
+
# sets up nginx for frontend
|
|
254
|
+
# Arguments:
|
|
255
|
+
# None
|
|
256
|
+
#######################################
|
|
257
|
+
frontend_nginx_setup() {
|
|
258
|
+
print_banner
|
|
259
|
+
printf "${WHITE} 💻 Configurando nginx (frontend)...${GRAY_LIGHT}"
|
|
260
|
+
printf "\n\n"
|
|
261
|
+
|
|
262
|
+
sleep 2
|
|
263
|
+
|
|
264
|
+
frontend_hostname=$(echo "${frontend_url/https:\/\/}")
|
|
265
|
+
|
|
266
|
+
sudo su - root << EOF
|
|
267
|
+
# Remove configuração existente se houver
|
|
268
|
+
rm -f /etc/nginx/sites-enabled/${instancia_add}-frontend
|
|
269
|
+
rm -f /etc/nginx/sites-available/${instancia_add}-frontend
|
|
270
|
+
|
|
271
|
+
cat > /etc/nginx/sites-available/${instancia_add}-frontend << 'END'
|
|
272
|
+
server {
|
|
273
|
+
server_name $frontend_hostname;
|
|
274
|
+
|
|
275
|
+
location / {
|
|
276
|
+
proxy_pass http://127.0.0.1:${frontend_port};
|
|
277
|
+
proxy_http_version 1.1;
|
|
278
|
+
proxy_set_header Upgrade \$http_upgrade;
|
|
279
|
+
proxy_set_header Connection 'upgrade';
|
|
280
|
+
proxy_set_header Host \$host;
|
|
281
|
+
proxy_set_header X-Real-IP \$remote_addr;
|
|
282
|
+
proxy_set_header X-Forwarded-Proto \$scheme;
|
|
283
|
+
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
|
284
|
+
proxy_cache_bypass \$http_upgrade;
|
|
285
|
+
proxy_read_timeout 3600;
|
|
286
|
+
proxy_connect_timeout 3600;
|
|
287
|
+
proxy_send_timeout 3600;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
END
|
|
291
|
+
|
|
292
|
+
# Cria link simbólico se não existir
|
|
293
|
+
if [ ! -f "/etc/nginx/sites-enabled/${instancia_add}-frontend" ]; then
|
|
294
|
+
ln -s /etc/nginx/sites-available/${instancia_add}-frontend /etc/nginx/sites-enabled
|
|
295
|
+
fi
|
|
296
|
+
EOF
|
|
297
|
+
|
|
298
|
+
sleep 2
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
#######################################
|
|
302
|
+
# verifies frontend installation
|
|
303
|
+
# Arguments:
|
|
304
|
+
# None
|
|
305
|
+
#######################################
|
|
306
|
+
frontend_verify_installation() {
|
|
307
|
+
print_banner
|
|
308
|
+
printf "${WHITE} 💻 Verificando instalação do frontend...${GRAY_LIGHT}"
|
|
309
|
+
printf "\n\n"
|
|
310
|
+
|
|
311
|
+
sleep 2
|
|
312
|
+
|
|
313
|
+
sudo su - deploy <<EOF
|
|
314
|
+
cd /home/deploy/${instancia_add}/frontend
|
|
315
|
+
|
|
316
|
+
echo "🔍 Verificando se build existe..."
|
|
317
|
+
if [ -d "build" ] && [ -f "build/index.html" ]; then
|
|
318
|
+
echo "✅ Build frontend: OK"
|
|
319
|
+
else
|
|
320
|
+
echo "❌ Build frontend: FALHA"
|
|
321
|
+
exit 1
|
|
322
|
+
fi
|
|
323
|
+
|
|
324
|
+
echo "🔍 Verificando se PM2 está rodando..."
|
|
325
|
+
if pm2 list | grep -q "${instancia_add}-frontend"; then
|
|
326
|
+
echo "✅ PM2 frontend: OK"
|
|
327
|
+
else
|
|
328
|
+
echo "❌ PM2 frontend: FALHA"
|
|
329
|
+
exit 1
|
|
330
|
+
fi
|
|
331
|
+
|
|
332
|
+
echo "🔍 Testando resposta na porta ${frontend_port}..."
|
|
333
|
+
if curl -f http://localhost:${frontend_port} >/dev/null 2>&1; then
|
|
334
|
+
echo "✅ Servidor frontend: OK"
|
|
335
|
+
else
|
|
336
|
+
echo "❌ Servidor frontend: FALHA"
|
|
337
|
+
exit 1
|
|
338
|
+
fi
|
|
339
|
+
EOF
|
|
340
|
+
|
|
341
|
+
sleep 2
|
|
342
|
+
}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
get_mysql_root_password() {
|
|
4
|
+
|
|
5
|
+
print_banner
|
|
6
|
+
printf "${WHITE} 💻 Insira senha para o usuario Deploy e Banco de Dados (Não utilizar caracteres especiais):${GRAY_LIGHT}"
|
|
7
|
+
printf "\n\n"
|
|
8
|
+
read -p "> " mysql_root_password
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get_instancia_add() {
|
|
12
|
+
|
|
13
|
+
print_banner
|
|
14
|
+
printf "${WHITE} 💻 Informe um nome para a Instância/Empresa que será instalada (Não utilizar espaços ou caracteres especiais; utilizar letras minusculas):${GRAY_LIGHT}"
|
|
15
|
+
printf "\n\n"
|
|
16
|
+
read -p "> " instancia_add
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get_max_whats() {
|
|
20
|
+
|
|
21
|
+
print_banner
|
|
22
|
+
printf "${WHITE} 💻 Informe a Qtde de Conexões/Whats que a ${instancia_add} poderá cadastrar:${GRAY_LIGHT}"
|
|
23
|
+
printf "\n\n"
|
|
24
|
+
read -p "> " max_whats
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get_max_user() {
|
|
28
|
+
|
|
29
|
+
print_banner
|
|
30
|
+
printf "${WHITE} 💻 Informe a Qtde de Usuarios/Atendentes que a ${instancia_add} poderá cadastrar:${GRAY_LIGHT}"
|
|
31
|
+
printf "\n\n"
|
|
32
|
+
read -p "> " max_user
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get_frontend_url() {
|
|
36
|
+
|
|
37
|
+
print_banner
|
|
38
|
+
printf "${WHITE} 💻 Digite o domínio do FRONTEND/PAINEL para a ${instancia_add}:${GRAY_LIGHT}"
|
|
39
|
+
printf "\n\n"
|
|
40
|
+
read -p "> " frontend_url
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get_backend_url() {
|
|
44
|
+
|
|
45
|
+
print_banner
|
|
46
|
+
printf "${WHITE} 💻 Digite o domínio do BACKEND/API para a ${instancia_add}:${GRAY_LIGHT}"
|
|
47
|
+
printf "\n\n"
|
|
48
|
+
read -p "> " backend_url
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get_frontend_port() {
|
|
52
|
+
|
|
53
|
+
print_banner
|
|
54
|
+
printf "${WHITE} 💻 Digite a porta do FRONTEND para a ${instancia_add}; Ex: 3000 A 3999 ${GRAY_LIGHT}"
|
|
55
|
+
printf "\n\n"
|
|
56
|
+
read -p "> " frontend_port
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get_backend_port() {
|
|
60
|
+
|
|
61
|
+
print_banner
|
|
62
|
+
printf "${WHITE} 💻 Digite a porta do BACKEND para esta instancia; Ex: 4000 A 4999 ${GRAY_LIGHT}"
|
|
63
|
+
printf "\n\n"
|
|
64
|
+
read -p "> " backend_port
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get_redis_port() {
|
|
68
|
+
|
|
69
|
+
print_banner
|
|
70
|
+
printf "${WHITE} 💻 Digite a porta do REDIS/AGENDAMENTO MSG para a ${instancia_add}; Ex: 5000 A 5999 ${GRAY_LIGHT}"
|
|
71
|
+
printf "\n\n"
|
|
72
|
+
read -p "> " redis_port
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get_deploy_email() {
|
|
76
|
+
|
|
77
|
+
print_banner
|
|
78
|
+
printf "${WHITE} 💻 Digite o e-mail para SSL/Certbot (Obrigatório para HTTPS):${GRAY_LIGHT}"
|
|
79
|
+
printf "\n\n"
|
|
80
|
+
read -p "> " deploy_email
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get_empresa_delete() {
|
|
84
|
+
|
|
85
|
+
print_banner
|
|
86
|
+
printf "${WHITE} 💻 Digite o nome da Instância/Empresa que será Deletada (Digite o mesmo nome de quando instalou):${GRAY_LIGHT}"
|
|
87
|
+
printf "\n\n"
|
|
88
|
+
read -p "> " empresa_delete
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
get_empresa_atualizar() {
|
|
92
|
+
|
|
93
|
+
print_banner
|
|
94
|
+
printf "${WHITE} 💻 Digite o nome da Instância/Empresa que deseja Atualizar (Digite o mesmo nome de quando instalou):${GRAY_LIGHT}"
|
|
95
|
+
printf "\n\n"
|
|
96
|
+
read -p "> " empresa_atualizar
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
get_empresa_bloquear() {
|
|
100
|
+
|
|
101
|
+
print_banner
|
|
102
|
+
printf "${WHITE} 💻 Digite o nome da Instância/Empresa que deseja Bloquear (Digite o mesmo nome de quando instalou):${GRAY_LIGHT}"
|
|
103
|
+
printf "\n\n"
|
|
104
|
+
read -p "> " empresa_bloquear
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
get_empresa_desbloquear() {
|
|
108
|
+
|
|
109
|
+
print_banner
|
|
110
|
+
printf "${WHITE} 💻 Digite o nome da Instância/Empresa que deseja Desbloquear (Digite o mesmo nome de quando instalou):${GRAY_LIGHT}"
|
|
111
|
+
printf "\n\n"
|
|
112
|
+
read -p "> " empresa_desbloquear
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
get_empresa_dominio() {
|
|
116
|
+
|
|
117
|
+
print_banner
|
|
118
|
+
printf "${WHITE} 💻 Digite o nome da Instância/Empresa que deseja Alterar os Dominios (Atenção para alterar os dominios precisa digitar os 2, mesmo que vá alterar apenas 1):${GRAY_LIGHT}"
|
|
119
|
+
printf "\n\n"
|
|
120
|
+
read -p "> " empresa_dominio
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
get_alter_frontend_url() {
|
|
124
|
+
|
|
125
|
+
print_banner
|
|
126
|
+
printf "${WHITE} 💻 Digite o NOVO domínio do FRONTEND/PAINEL para a ${empresa_dominio}:${GRAY_LIGHT}"
|
|
127
|
+
printf "\n\n"
|
|
128
|
+
read -p "> " alter_frontend_url
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
get_alter_backend_url() {
|
|
132
|
+
|
|
133
|
+
print_banner
|
|
134
|
+
printf "${WHITE} 💻 Digite o NOVO domínio do BACKEND/API para a ${empresa_dominio}:${GRAY_LIGHT}"
|
|
135
|
+
printf "\n\n"
|
|
136
|
+
read -p "> " alter_backend_url
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
get_alter_frontend_port() {
|
|
140
|
+
|
|
141
|
+
print_banner
|
|
142
|
+
printf "${WHITE} 💻 Digite a porta do FRONTEND da Instância/Empresa ${empresa_dominio}; A porta deve ser a mesma informada durante a instalação ${GRAY_LIGHT}"
|
|
143
|
+
printf "\n\n"
|
|
144
|
+
read -p "> " alter_frontend_port
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
get_alter_backend_port() {
|
|
148
|
+
|
|
149
|
+
print_banner
|
|
150
|
+
printf "${WHITE} 💻 Digite a porta do BACKEND da Instância/Empresa ${empresa_dominio}; A porta deve ser a mesma informada durante a instalação ${GRAY_LIGHT}"
|
|
151
|
+
printf "\n\n"
|
|
152
|
+
read -p "> " alter_backend_port
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
get_urls() {
|
|
156
|
+
get_mysql_root_password
|
|
157
|
+
get_instancia_add
|
|
158
|
+
get_max_whats
|
|
159
|
+
get_max_user
|
|
160
|
+
get_frontend_url
|
|
161
|
+
get_backend_url
|
|
162
|
+
get_frontend_port
|
|
163
|
+
get_backend_port
|
|
164
|
+
get_redis_port
|
|
165
|
+
get_deploy_email
|
|
166
|
+
|
|
167
|
+
# Configurações automáticas do Redis
|
|
168
|
+
redis_host="localhost"
|
|
169
|
+
redis_password="${mysql_root_password}"
|
|
170
|
+
|
|
171
|
+
printf "\n${GREEN} ✅ Redis configurado automaticamente:${GRAY_LIGHT}"
|
|
172
|
+
printf "\n${GREEN} Host: localhost | Senha: mesma do banco${GRAY_LIGHT}\n"
|
|
173
|
+
sleep 2
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
software_update() {
|
|
177
|
+
get_empresa_atualizar
|
|
178
|
+
frontend_update
|
|
179
|
+
backend_update
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
software_delete() {
|
|
183
|
+
get_empresa_delete
|
|
184
|
+
deletar_tudo
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
software_bloquear() {
|
|
188
|
+
get_empresa_bloquear
|
|
189
|
+
configurar_bloqueio
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
software_desbloquear() {
|
|
193
|
+
get_empresa_desbloquear
|
|
194
|
+
configurar_desbloqueio
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
software_dominio() {
|
|
198
|
+
get_empresa_dominio
|
|
199
|
+
get_alter_frontend_url
|
|
200
|
+
get_alter_backend_url
|
|
201
|
+
get_alter_frontend_port
|
|
202
|
+
get_alter_backend_port
|
|
203
|
+
configurar_dominio
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
inquiry_options() {
|
|
207
|
+
|
|
208
|
+
print_banner
|
|
209
|
+
printf "${WHITE} 💻 Bem vindo(a) ao Gerenciador Multizap, selecione abaixo a proxima ação!${GRAY_LIGHT}"
|
|
210
|
+
printf "\n\n"
|
|
211
|
+
printf " [0] Instalar Multizap\n"
|
|
212
|
+
printf " [1] Atualizar Multizap\n"
|
|
213
|
+
printf " [2] Deletar Multizap\n"
|
|
214
|
+
printf " [3] Bloquear Multizap\n"
|
|
215
|
+
printf " [4] Desbloquear Multizap\n"
|
|
216
|
+
printf " [5] Alter. dominio Multizap\n"
|
|
217
|
+
printf "\n"
|
|
218
|
+
read -p "> " option
|
|
219
|
+
|
|
220
|
+
case "${option}" in
|
|
221
|
+
0) get_urls ;;
|
|
222
|
+
|
|
223
|
+
1)
|
|
224
|
+
software_update
|
|
225
|
+
exit
|
|
226
|
+
;;
|
|
227
|
+
|
|
228
|
+
2)
|
|
229
|
+
software_delete
|
|
230
|
+
exit
|
|
231
|
+
;;
|
|
232
|
+
3)
|
|
233
|
+
software_bloquear
|
|
234
|
+
exit
|
|
235
|
+
;;
|
|
236
|
+
4)
|
|
237
|
+
software_desbloquear
|
|
238
|
+
exit
|
|
239
|
+
;;
|
|
240
|
+
5)
|
|
241
|
+
software_dominio
|
|
242
|
+
exit
|
|
243
|
+
;;
|
|
244
|
+
|
|
245
|
+
*) exit ;;
|
|
246
|
+
esac
|
|
247
|
+
}
|