atendeticket 2.1.5 → 2.1.8
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 +15 -0
- package/actions/delete.js +21 -1
- package/appInstaller.js +1 -1
- package/installers/system/installNode.js +6 -4
- package/package.json +2 -2
- package/prompts/installPrompts.js +92 -2
package/TODO.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# TODO List for Installer Script
|
|
2
|
+
|
|
3
|
+
## Completed Tasks
|
|
4
|
+
- [x] Update installPrompts.js to ask 10 specific questions in order
|
|
5
|
+
- [x] Update installNode.js to install Node.js 20.x from nodesource
|
|
6
|
+
- [x] Update installCertbot.js to install via snap
|
|
7
|
+
- [x] Fix deploy_email variable in appInstaller.js
|
|
8
|
+
- [x] Update setupSSL.js to accept email parameter and run for both domains
|
|
9
|
+
- [x] Implement delete.js action according to task commands
|
|
10
|
+
- [x] Implement changeDomain.js action according to task commands
|
|
11
|
+
|
|
12
|
+
## Pending Tasks
|
|
13
|
+
- [ ] Verify all other installers match the task requirements
|
|
14
|
+
- [ ] Test the complete installation flow
|
|
15
|
+
- [ ] Add proper prompting for instancia name in delete and changeDomain actions
|
package/actions/delete.js
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
|
+
const { runCommand } = require('../core/exec');
|
|
1
2
|
const { info, success } = require('../core/logger');
|
|
2
3
|
|
|
3
4
|
async function deleteAction() {
|
|
4
5
|
info('Executando ação de delete...');
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
// Assuming we need to prompt for instancia name, but for now using a placeholder
|
|
8
|
+
// In a real implementation, you'd prompt for the instancia name
|
|
9
|
+
const instancia = 'example'; // This should be prompted or passed as parameter
|
|
10
|
+
|
|
11
|
+
// Remove Redis container
|
|
12
|
+
await runCommand('docker', ['rm', '-f', `redis-${instancia}`]);
|
|
13
|
+
|
|
14
|
+
// Remove nginx sites
|
|
15
|
+
await runCommand('sudo', ['rm', '-f', `/etc/nginx/sites-enabled/${instancia}`]);
|
|
16
|
+
await runCommand('sudo', ['rm', '-f', `/etc/nginx/sites-available/${instancia}`]);
|
|
17
|
+
|
|
18
|
+
// Remove instance directory
|
|
19
|
+
await runCommand('sudo', ['rm', '-rf', `/home/deploy/${instancia}`]);
|
|
20
|
+
|
|
21
|
+
// Delete PM2 processes
|
|
22
|
+
await runCommand('pm2', ['delete', `${instancia}-backend`, `${instancia}-frontend`]);
|
|
23
|
+
await runCommand('pm2', ['save']);
|
|
24
|
+
|
|
25
|
+
success('Instância deletada com sucesso!');
|
|
6
26
|
}
|
|
7
27
|
|
|
8
28
|
module.exports = { delete: deleteAction };
|
package/appInstaller.js
CHANGED
|
@@ -116,7 +116,7 @@ async function runInstaller() {
|
|
|
116
116
|
// SSL
|
|
117
117
|
const backend_domain = answers.backendUrl.replace(/^https?:\/\//, '');
|
|
118
118
|
const frontend_domain = answers.frontendUrl.replace(/^https?:\/\//, '');
|
|
119
|
-
await setupSSL(backend_domain, frontend_domain, answers.
|
|
119
|
+
await setupSSL(backend_domain, frontend_domain, answers.deploy_email);
|
|
120
120
|
|
|
121
121
|
success('Instalação completa do Multizap!');
|
|
122
122
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const { runCommand } = require('../../core/exec');
|
|
2
|
-
const { info } = require('../../core/logger');
|
|
2
|
+
const { info, success } = require('../../core/logger');
|
|
3
3
|
|
|
4
4
|
async function installNode() {
|
|
5
|
-
info('Instalando Node.js...');
|
|
6
|
-
await runCommand('
|
|
7
|
-
await runCommand('sudo', ['apt', 'install', '-y', 'nodejs'
|
|
5
|
+
info('Instalando Node.js + NPM + NPX...');
|
|
6
|
+
await runCommand('curl', ['-fsSL', 'https://deb.nodesource.com/setup_20.x', '|', 'bash', '-']);
|
|
7
|
+
await runCommand('sudo', ['apt', 'install', '-y', 'nodejs']);
|
|
8
|
+
await runCommand('sudo', ['npm', 'install', '-g', 'npm@latest']);
|
|
9
|
+
success('Node.js + NPM + NPX instalados!');
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
module.exports = { installNode };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atendeticket",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"description": "Instalador CLI para AtendeTicket",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "node index.js",
|
|
8
|
-
"
|
|
8
|
+
"atualizar": "npm version patch && npm publish --access public"
|
|
9
9
|
},
|
|
10
10
|
"bin": {
|
|
11
11
|
"atendeticket": "./index.js"
|
|
@@ -2,8 +2,98 @@ const inquirer = require("inquirer");
|
|
|
2
2
|
|
|
3
3
|
async function installPrompts() {
|
|
4
4
|
const answers = await inquirer.prompt([
|
|
5
|
-
{
|
|
6
|
-
|
|
5
|
+
{
|
|
6
|
+
type: 'password',
|
|
7
|
+
name: 'mysql_root_password',
|
|
8
|
+
message: '1. Senha do usuário deploy + banco de dados:',
|
|
9
|
+
mask: '*'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
type: 'input',
|
|
13
|
+
name: 'instancia_add',
|
|
14
|
+
message: '2. Nome da instância/empresa (minúsculo, sem espaço, sem caracteres especiais):',
|
|
15
|
+
validate: (input) => {
|
|
16
|
+
if (!input) return 'Este campo é obrigatório';
|
|
17
|
+
if (!/^[a-z0-9]+$/.test(input)) return 'Apenas letras minúsculas e números, sem espaços ou caracteres especiais';
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'number',
|
|
23
|
+
name: 'max_whats',
|
|
24
|
+
message: '3. Limite de conexões Whats:',
|
|
25
|
+
validate: (input) => {
|
|
26
|
+
if (input <= 0) return 'Deve ser um número positivo';
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'number',
|
|
32
|
+
name: 'max_user',
|
|
33
|
+
message: '4. Limite de usuários:',
|
|
34
|
+
validate: (input) => {
|
|
35
|
+
if (input <= 0) return 'Deve ser um número positivo';
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'input',
|
|
41
|
+
name: 'frontend_url',
|
|
42
|
+
message: '5. Domínio do FRONTEND (ex: painel.suaempresa.com):',
|
|
43
|
+
validate: (input) => {
|
|
44
|
+
if (!input) return 'Este campo é obrigatório';
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: 'input',
|
|
50
|
+
name: 'backend_url',
|
|
51
|
+
message: '6. Domínio do BACKEND (ex: api.suaempresa.com):',
|
|
52
|
+
validate: (input) => {
|
|
53
|
+
if (!input) return 'Este campo é obrigatório';
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'number',
|
|
59
|
+
name: 'frontend_port',
|
|
60
|
+
message: '7. Porta do FRONTEND (ex: 3000):',
|
|
61
|
+
default: 3000,
|
|
62
|
+
validate: (input) => {
|
|
63
|
+
if (input <= 0 || input > 65535) return 'Porta inválida (1-65535)';
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'number',
|
|
69
|
+
name: 'backend_port',
|
|
70
|
+
message: '8. Porta do BACKEND (ex: 4000):',
|
|
71
|
+
default: 4000,
|
|
72
|
+
validate: (input) => {
|
|
73
|
+
if (input <= 0 || input > 65535) return 'Porta inválida (1-65535)';
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: 'number',
|
|
79
|
+
name: 'redis_port',
|
|
80
|
+
message: '9. Porta do REDIS (ex: 5000):',
|
|
81
|
+
default: 5000,
|
|
82
|
+
validate: (input) => {
|
|
83
|
+
if (input <= 0 || input > 65535) return 'Porta inválida (1-65535)';
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'input',
|
|
89
|
+
name: 'deploy_email',
|
|
90
|
+
message: '10. Email para o SSL (Certbot):',
|
|
91
|
+
validate: (input) => {
|
|
92
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
93
|
+
if (!emailRegex.test(input)) return 'Email inválido';
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
7
97
|
]);
|
|
8
98
|
return answers;
|
|
9
99
|
}
|