easy-devops 1.3.6 → 1.4.1

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.
Files changed (78) hide show
  1. package/README.md +1 -0
  2. package/dist/ui/assets/index-Bu7af-Kj.css +1 -0
  3. package/dist/ui/assets/index-gndgYe3K.js +532 -0
  4. package/dist/ui/assets/socket-Bv0wCEgi.js +65 -0
  5. package/dist/ui/index.html +2 -2
  6. package/install.bat +14 -7
  7. package/package.json +2 -2
  8. package/src/cli/index.js +8 -0
  9. package/src/cli/managers/domain-manager.js +37 -6
  10. package/src/cli/managers/nginx-manager.js +14 -5
  11. package/src/cli/managers/node-manager.js +19 -13
  12. package/src/cli/managers/ssl-manager.js +89 -26
  13. package/src/cli/menu.js +8 -2
  14. package/src/cli/menus/cleanup.js +4 -2
  15. package/src/cli/menus/dashboard.js +22 -15
  16. package/src/cli/menus/hub.js +402 -0
  17. package/src/cli/menus/runtime.js +12 -0
  18. package/src/cli/menus/service.js +80 -13
  19. package/src/cli/menus/settings.js +46 -12
  20. package/src/cli/menus/uninstall.js +13 -5
  21. package/src/cli/menus/update.js +24 -14
  22. package/src/cli/ui/page.js +123 -0
  23. package/src/core/cert-operations.js +34 -4
  24. package/src/core/cert-reader.js +67 -22
  25. package/src/core/cert-renewal.js +65 -9
  26. package/src/core/cert-suggest.js +120 -0
  27. package/src/core/cleanup.js +221 -1
  28. package/src/core/cloudflare-ips.js +161 -0
  29. package/src/core/daemon/ipc.js +1 -1
  30. package/src/core/daemon/lock.js +296 -9
  31. package/src/core/daemon/run.js +12 -0
  32. package/src/core/daemon/stateFile.js +128 -0
  33. package/src/core/dashboardProcess.js +134 -6
  34. package/src/core/db.js +26 -1
  35. package/src/core/deploy/apps.js +36 -62
  36. package/src/core/deploy/deployKey.js +331 -0
  37. package/src/core/deploy/domainLink.js +280 -23
  38. package/src/core/deploy/engine.js +382 -63
  39. package/src/core/deploy/ezfile.js +496 -29
  40. package/src/core/deploy/githubApi.js +100 -13
  41. package/src/core/deploy/hubCommands.js +158 -18
  42. package/src/core/deploy/status.js +28 -1
  43. package/src/core/domains-db.js +1 -0
  44. package/src/core/hub/agent.js +238 -32
  45. package/src/core/hub/deployProgress.js +411 -0
  46. package/src/core/hubConnect.js +205 -0
  47. package/src/core/hubPermissions.js +48 -10
  48. package/src/core/jobs/bus.js +1 -1
  49. package/src/core/jobs/owner.js +268 -6
  50. package/src/core/nginx-conf-generator.js +124 -19
  51. package/src/core/notifications/claim.js +26 -3
  52. package/src/core/permissions.js +277 -59
  53. package/src/core/platform.js +73 -2
  54. package/src/core/runner.js +96 -40
  55. package/src/core/service/dataDir.js +34 -9
  56. package/src/core/service/index.js +203 -24
  57. package/src/core/service/runtime.js +40 -3
  58. package/src/core/service/windowsService.js +452 -107
  59. package/src/core/service/winsw.js +44 -3
  60. package/src/core/ssl/preflight.js +548 -0
  61. package/src/core/ssl/progress.js +196 -0
  62. package/src/core/ssl-issuer.js +502 -148
  63. package/src/core/validators.js +24 -0
  64. package/src/dashboard/controllers/authController.js +12 -5
  65. package/src/dashboard/controllers/deploymentsController.js +76 -11
  66. package/src/dashboard/controllers/domainsController.js +35 -1
  67. package/src/dashboard/controllers/hubController.js +4 -3
  68. package/src/dashboard/controllers/settingsController.js +73 -68
  69. package/src/dashboard/controllers/sslController.js +135 -15
  70. package/src/dashboard/public/js/app.js +42 -7
  71. package/src/dashboard/routes/deployments.js +2 -0
  72. package/src/dashboard/routes/domains.js +1 -0
  73. package/src/dashboard/server.js +42 -7
  74. package/src/dashboard/socketManager.js +19 -25
  75. package/src/dashboard/views/partials/settings-panel.ejs +29 -10
  76. package/dist/ui/assets/index-BUpPxWmp.css +0 -1
  77. package/dist/ui/assets/index-DD0JjK0Q.js +0 -475
  78. package/dist/ui/assets/socket-4tfdap-e.js +0 -65
@@ -20,9 +20,52 @@ import { run } from '../../core/shell.js';
20
20
  import { loadConfig } from '../../core/config.js';
21
21
  import { issueCertificate, describeIssuance } from '../../core/ssl-issuer.js';
22
22
  import { renewCertificate, describeRenewal, failureReason } from '../../core/cert-renewal.js';
23
+ import { getCertExpiry } from '../../core/cert-reader.js';
24
+ import { page, pause, BACK } from '../ui/page.js';
23
25
 
24
26
  // ─── Helpers ──────────────────────────────────────────────────────────────────
25
27
 
28
+ const STAGE_LABELS = {
29
+ 'preflight': 'Checking DNS and port 80',
30
+ 'account and order': "Preparing the Let's Encrypt account and order",
31
+ 'challenge ready': 'Making the challenge ready',
32
+ 'waiting for validation': "Waiting for Let's Encrypt validation",
33
+ 'certificate received': "Certificate received from Let's Encrypt",
34
+ 'files written': 'Certificate files written',
35
+ 'nginx config test': 'Testing the nginx configuration',
36
+ 'nginx reload': 'Reloading nginx',
37
+ 'https verified': 'Verifying HTTPS',
38
+ };
39
+
40
+ /** The one-line status text for a progress event. */
41
+ function stageText(event) {
42
+ const base = STAGE_LABELS[event.stage] ?? event.stage;
43
+ if (event.stage === 'waiting for validation' && event.status === 'running') {
44
+ const seconds = Math.max(0, Math.round((event.elapsedMs ?? 0) / 1000));
45
+ return `${base} (${seconds}s)`;
46
+ }
47
+ if (event.status === 'ok' && event.stage === 'https verified') {
48
+ return `${base} — ${event.domain} is serving the new certificate`;
49
+ }
50
+ return base;
51
+ }
52
+
53
+ /** Updates an ora spinner with each stage; never throws. */
54
+ function spinnerProgress(spinner) {
55
+ return (event) => {
56
+ try {
57
+ if (!spinner) return;
58
+ if (event.status === 'failed') {
59
+ spinner.fail(event.detail ? `${stageText(event)}: ${event.detail}` : stageText(event));
60
+ } else if (event.status === 'ok' && event.stage === 'files written') {
61
+ spinner.text = stageText(event);
62
+ } else if (event.status === 'running') {
63
+ spinner.text = stageText(event);
64
+ }
65
+ } catch { /* progress must never break the command */ }
66
+ };
67
+ }
68
+
26
69
  function getSslDir() {
27
70
  const { sslDir } = loadConfig();
28
71
  return sslDir;
@@ -73,18 +116,19 @@ async function listCerts(liveDir) {
73
116
  // Skip hidden directories like .account
74
117
  if (domain.startsWith('.')) continue;
75
118
 
76
- const certPath = path.join(liveDir, domain, 'fullchain.pem');
77
-
78
- let status = 'error';
119
+ let status = 'unreadable';
79
120
  let expiryDate = null;
80
121
  let daysLeft = null;
81
122
 
82
123
  try {
83
- await fs.stat(certPath);
84
- const expiry = await parseCertExpiry(certPath);
85
- if (expiry !== null) {
86
- expiryDate = expiry.expiryDate;
87
- daysLeft = expiry.daysLeft;
124
+ const info = await getCertExpiry(domain, { sslDir: liveDir });
125
+ if (info.state === 'not_issued') {
126
+ status = 'not_issued';
127
+ } else if (info.state === 'unreadable' || info.daysLeft === null) {
128
+ status = 'unreadable';
129
+ } else {
130
+ expiryDate = info.expiry;
131
+ daysLeft = info.daysLeft;
88
132
  if (daysLeft > 30) {
89
133
  status = 'healthy';
90
134
  } else if (daysLeft >= 10) {
@@ -94,7 +138,7 @@ async function listCerts(liveDir) {
94
138
  }
95
139
  }
96
140
  } catch {
97
- status = 'error';
141
+ status = 'unreadable';
98
142
  }
99
143
 
100
144
  certs.push({ domain, status, expiryDate, daysLeft });
@@ -106,8 +150,13 @@ async function listCerts(liveDir) {
106
150
  function renderCertRow(cert) {
107
151
  const domainPadded = cert.domain.padEnd(35);
108
152
 
109
- if (cert.status === 'error') {
110
- console.log(` ${chalk.gray('❌')} ${chalk.gray(domainPadded)} ${chalk.gray('ERROR')}`);
153
+ if (cert.status === 'not_issued') {
154
+ console.log(` ${chalk.gray('○')} ${chalk.gray(domainPadded)} ${chalk.gray('Not issued yet')}`);
155
+ return;
156
+ }
157
+
158
+ if (cert.status === 'unreadable' || cert.status === 'error') {
159
+ console.log(` ${chalk.gray('❌')} ${chalk.gray(domainPadded)} ${chalk.gray('UNREADABLE')}`);
111
160
  return;
112
161
  }
113
162
 
@@ -152,7 +201,7 @@ export async function issueCert(domainName, options = {}) {
152
201
  * than silently replaced by a single-name HTTP-01 certificate.
153
202
  */
154
203
  export async function renewCert(domainName, options = {}) {
155
- return renewCertificate(domainName, { email: options.email ?? null, mode: options.mode ?? null });
204
+ return renewCertificate(domainName, options);
156
205
  }
157
206
 
158
207
  /**
@@ -164,7 +213,13 @@ export async function renewExpiring(certs, options = {}) {
164
213
 
165
214
  const results = [];
166
215
  for (const cert of expiring) {
167
- const result = await renewCert(cert.domain, options);
216
+ const spinner = ora(`Renewing certificate for ${cert.domain}…`).start();
217
+ const result = await renewCert(cert.domain, {
218
+ ...options,
219
+ onEvent: spinnerProgress(spinner),
220
+ });
221
+ if (result.success) spinner.succeed(`Renewed certificate for ${cert.domain}`);
222
+ else if (spinner.isSpinning) spinner.stop();
168
223
  results.push({
169
224
  domain: cert.domain,
170
225
  success: result.success,
@@ -182,13 +237,14 @@ export async function renewExpiring(certs, options = {}) {
182
237
 
183
238
  export async function showSslManager() {
184
239
  while (true) {
240
+ page(['SSL']);
241
+
185
242
  const liveDir = getLiveDir();
186
243
 
187
244
  const spinner = ora('Loading certificates…').start();
188
245
  const certs = await listCerts(liveDir);
189
246
  spinner.stop();
190
247
 
191
- console.log(chalk.bold('\n SSL Manager'));
192
248
  console.log(chalk.gray(' ' + '─'.repeat(40)));
193
249
 
194
250
  if (certs.length === 0) {
@@ -205,7 +261,7 @@ export async function showSslManager() {
205
261
  'Renew a certificate',
206
262
  'Renew all expiring (< 30 days)',
207
263
  new inquirer.Separator(),
208
- '← Back',
264
+ BACK,
209
265
  ];
210
266
 
211
267
  let choice;
@@ -223,6 +279,7 @@ export async function showSslManager() {
223
279
 
224
280
  switch (choice) {
225
281
  case 'Create new certificate': {
282
+ page(['SSL', 'Issue']);
226
283
  const config = loadConfig();
227
284
 
228
285
  // Prompt for email if not configured
@@ -297,6 +354,9 @@ export async function showSslManager() {
297
354
  validationMethod: 'dns',
298
355
  email: acmeEmail,
299
356
  onDnsChallenge,
357
+ onEvent: (event) => {
358
+ if (event.status === 'running') console.log(chalk.gray(` ${stageText(event)}…`));
359
+ },
300
360
  });
301
361
  } else {
302
362
  const spinner = ora(`Creating certificate for ${domainInput.trim()}…`).start();
@@ -304,8 +364,10 @@ export async function showSslManager() {
304
364
  www: wwwInput,
305
365
  validationMethod: 'http',
306
366
  email: acmeEmail,
367
+ onEvent: spinnerProgress(spinner),
307
368
  });
308
- spinner.stop();
369
+ if (result.success) spinner.succeed(`Certificate created for ${domainInput.trim()}`);
370
+ else if (spinner.isSpinning) spinner.stop();
309
371
  }
310
372
 
311
373
  if (result.success) {
@@ -331,6 +393,7 @@ export async function showSslManager() {
331
393
  }
332
394
 
333
395
  case 'Renew a certificate': {
396
+ page(['SSL', 'Renew']);
334
397
  if (certs.length === 0) {
335
398
  console.log(chalk.gray('\n No certificates found to renew\n'));
336
399
  break;
@@ -351,8 +414,12 @@ export async function showSslManager() {
351
414
 
352
415
  const config = loadConfig();
353
416
  const spinner = ora(`Renewing certificate for ${selectedDomain}…`).start();
354
- const result = await renewCert(selectedDomain, { email: config.acmeEmail });
355
- spinner.stop();
417
+ const result = await renewCert(selectedDomain, {
418
+ email: config.acmeEmail,
419
+ onEvent: spinnerProgress(spinner),
420
+ });
421
+ if (result.success) spinner.succeed(`Renewed certificate for ${selectedDomain}`);
422
+ else if (spinner.isSpinning) spinner.stop();
356
423
 
357
424
  if (result.success) {
358
425
  console.log(chalk.green('\n ✓ Renewed successfully'));
@@ -373,6 +440,7 @@ export async function showSslManager() {
373
440
  }
374
441
 
375
442
  case 'Renew all expiring (< 30 days)': {
443
+ page(['SSL', 'Renew all']);
376
444
  const config = loadConfig();
377
445
  const results = await renewExpiring(certs, { email: config.acmeEmail });
378
446
  if (results.length === 0) {
@@ -393,17 +461,12 @@ export async function showSslManager() {
393
461
  break;
394
462
  }
395
463
 
396
- case '← Back':
464
+ case BACK:
397
465
  return;
398
466
  }
399
467
 
400
- if (choice !== '← Back') {
401
- try {
402
- await inquirer.prompt([{ type: 'input', name: '_', message: 'Press Enter to continue...' }]);
403
- } catch (err) {
404
- if (err.name === 'ExitPromptError') return;
405
- throw err;
406
- }
468
+ if (choice !== BACK) {
469
+ await pause();
407
470
  }
408
471
  }
409
472
  }
package/src/cli/menu.js CHANGED
@@ -15,11 +15,13 @@ import ora from 'ora';
15
15
  import inquirer from 'inquirer';
16
16
  import { runDetection, showSystemStatus, formatStatusLine } from '../core/detector.js';
17
17
  import { getDataDir, isDevDataDir } from '../core/platform.js';
18
+ import { page, EXIT } from './ui/page.js';
18
19
 
19
20
  import nodejsMenu from './menus/nodejs.js';
20
21
  import nginxMenu from './menus/nginx.js';
21
22
  import sslMenu from './menus/ssl.js';
22
23
  import domainsMenu from './menus/domains.js';
24
+ import hubMenu from './menus/hub.js';
23
25
  import dashboardMenu from './menus/dashboard.js';
24
26
  import settingsMenu from './menus/settings.js';
25
27
  import updateMenu from './menus/update.js';
@@ -93,10 +95,11 @@ async function showMainMenu() {
93
95
  '🌐 Nginx Manager',
94
96
  '🔒 SSL Manager',
95
97
  '🔗 Domain Manager',
98
+ '🔌 Hub',
96
99
  '🎛️ Open Dashboard',
97
100
  '⚙️ Settings',
98
101
  '🔄 Check for Updates',
99
- '✖ Exit',
102
+ EXIT,
100
103
  ],
101
104
  }]);
102
105
  return answers.choice;
@@ -108,15 +111,18 @@ async function dispatch(choice) {
108
111
  case '🌐 Nginx Manager': await nginxMenu(); break;
109
112
  case '🔒 SSL Manager': await sslMenu(); break;
110
113
  case '🔗 Domain Manager': await domainsMenu(); break;
114
+ case '🔌 Hub': await hubMenu(); break;
111
115
  case '🎛️ Open Dashboard': await dashboardMenu(); break;
112
116
  case '⚙️ Settings': await settingsMenu(); break;
113
117
  case '🔄 Check for Updates': await updateMenu(); break;
114
- case '✖ Exit': process.exit(0);
118
+ case EXIT: process.exit(0);
115
119
  }
116
120
  }
117
121
 
118
122
  async function main() {
119
123
  while (true) {
124
+ page(['Main Menu']);
125
+
120
126
  const spinner = ora('Checking system…').start();
121
127
  await runDetectionIfStale();
122
128
  spinner.stop();
@@ -16,6 +16,7 @@ import inquirer from 'inquirer';
16
16
  import ora from 'ora';
17
17
 
18
18
  import * as cleanup from '../../core/cleanup.js';
19
+ import { page } from '../ui/page.js';
19
20
 
20
21
  /** How each group is introduced, and whether it is safe to preselect. */
21
22
  const GROUP_INFO = {
@@ -73,8 +74,9 @@ export async function cleanupCommand({ days, yes = false } = {}) {
73
74
  spinner.stop();
74
75
  }
75
76
 
76
- console.log();
77
- console.log(' ' + chalk.bold('Cleanup'));
77
+ // A command, not a menu screen: the breadcrumb is printed, the screen is
78
+ // never cleared and nothing waits for Enter, so `ezz cleanup` stays pipeable.
79
+ page(['Cleanup'], { clear: false });
78
80
  console.log(' ' + chalk.gray('-'.repeat(58)));
79
81
  console.log(' ' + chalk.gray(`data directory: ${report.dataDir}`));
80
82
  console.log(' ' + chalk.gray(`logs older than ${report.days} days count as reclaimable (--days N)`));
@@ -8,6 +8,7 @@ import {
8
8
  stopDashboard,
9
9
  } from '../../core/dashboardProcess.js';
10
10
  import { run } from '../../core/shell.js';
11
+ import { page, pause, BACK } from '../ui/page.js';
11
12
 
12
13
  // ─── Browser ──────────────────────────────────────────────────────────────────
13
14
 
@@ -23,16 +24,18 @@ function showUsageInfo() {
23
24
  console.log(chalk.gray(' ─'.repeat(40)));
24
25
  console.log(' 1. Start the dashboard from this menu');
25
26
  console.log(' 2. Open it in your browser (or visit the URL shown)');
26
- console.log(' 3. Log in with the admin password from config');
27
+ console.log(' 3. On first start, set a password — the dashboard prints a');
28
+ console.log(' one-time setup code in this terminal (or the service log).');
29
+ console.log(chalk.gray(' Bound to loopback, you may choose no-password mode instead.'));
27
30
  console.log(' 4. Use the dashboard to:');
28
31
  console.log(chalk.gray(' • Manage domains → create nginx configs'));
29
32
  console.log(chalk.gray(' • View SSL certificates'));
30
33
  console.log(chalk.gray(' • Control nginx (start/stop/reload)'));
31
34
  console.log(chalk.gray(' • Edit nginx configuration files'));
32
35
  console.log();
33
- console.log(chalk.yellow(' Default login:'));
34
- console.log(chalk.gray(' Username: admin'));
35
- console.log(chalk.gray(' Password: (check your config or set one)'));
36
+ console.log(chalk.yellow(' Setup code:'));
37
+ console.log(chalk.gray(' Printed at startup. Lost or expired? Re-issue it with:'));
38
+ console.log(chalk.gray(' ezz dashboard setup-code'));
36
39
  console.log();
37
40
  }
38
41
 
@@ -107,6 +110,8 @@ export async function dashboardCommand(action) {
107
110
 
108
111
  export default async function dashboardMenu() {
109
112
  while (true) {
113
+ page(['Dashboard']);
114
+
110
115
  const spinner = ora('Checking dashboard status...').start();
111
116
  const status = await getDashboardStatus();
112
117
 
@@ -123,7 +128,6 @@ export default async function dashboardMenu() {
123
128
 
124
129
  const url = `http://localhost:${status.port}`;
125
130
 
126
- console.log(chalk.bold('\n Dashboard'));
127
131
  console.log(chalk.gray(' ' + '─'.repeat(40)));
128
132
 
129
133
  if (status.running) {
@@ -144,8 +148,8 @@ export default async function dashboardMenu() {
144
148
  console.log();
145
149
 
146
150
  const choices = status.running
147
- ? ['Open in browser', 'Stop dashboard', 'How to use', new inquirer.Separator(), '← Back']
148
- : ['Start dashboard', 'How to use', new inquirer.Separator(), '← Back'];
151
+ ? ['Open in browser', 'Stop dashboard', 'How to use', new inquirer.Separator(), BACK]
152
+ : ['Start dashboard', 'How to use', new inquirer.Separator(), BACK];
149
153
 
150
154
  let choice;
151
155
  try {
@@ -162,6 +166,7 @@ export default async function dashboardMenu() {
162
166
 
163
167
  switch (choice) {
164
168
  case 'Start dashboard': {
169
+ page(['Dashboard', 'Start']);
165
170
  const portToUse = await findFreePort(status.configPort);
166
171
 
167
172
  if (portToUse !== status.configPort) {
@@ -180,6 +185,7 @@ export default async function dashboardMenu() {
180
185
  }
181
186
 
182
187
  case 'Stop dashboard': {
188
+ page(['Dashboard', 'Stop']);
183
189
  const sp = ora('Stopping dashboard...').start();
184
190
  await stopDashboard(status.pid);
185
191
  sp.succeed('Dashboard stopped');
@@ -187,21 +193,22 @@ export default async function dashboardMenu() {
187
193
  }
188
194
 
189
195
  case 'Open in browser':
196
+ page(['Dashboard', 'Open']);
190
197
  openBrowser(url);
191
198
  console.log(chalk.gray(`\n Opening ${url} ...\n`));
192
199
  break;
193
200
 
194
- case '← Back':
201
+ case 'How to use':
202
+ page(['Dashboard', 'How to use']);
203
+ showUsageInfo();
204
+ break;
205
+
206
+ case BACK:
195
207
  return;
196
208
  }
197
209
 
198
- if (choice !== '← Back') {
199
- try {
200
- await inquirer.prompt([{ type: 'input', name: '_', message: 'Press Enter to continue...' }]);
201
- } catch (err) {
202
- if (err.name === 'ExitPromptError') return;
203
- throw err;
204
- }
210
+ if (choice !== BACK) {
211
+ await pause();
205
212
  }
206
213
  }
207
214
  }