ante-erp-cli 1.6.5 ā 1.6.6
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/package.json +1 -1
- package/src/commands/install.js +17 -1
- package/src/commands/set-domain.js +56 -7
package/package.json
CHANGED
package/src/commands/install.js
CHANGED
|
@@ -10,7 +10,7 @@ import { fileURLToPath } from 'url';
|
|
|
10
10
|
import { runSystemChecks, checkAndInstallDocker } from '../utils/validation.js';
|
|
11
11
|
import { generateCredentials } from '../utils/password.js';
|
|
12
12
|
import { saveInstallConfig, detectInstallation } from '../utils/config.js';
|
|
13
|
-
import { pullImages, startServices, waitForServiceHealthy } from '../utils/docker.js';
|
|
13
|
+
import { pullImages, startServices, waitForServiceHealthy, runMigrations } from '../utils/docker.js';
|
|
14
14
|
import { generateDockerCompose } from '../templates/docker-compose.yml.js';
|
|
15
15
|
import { generateEnv } from '../templates/env.js';
|
|
16
16
|
import { detectPublicIPWithFeedback, buildURL, isValidIPv4, isValidDomain } from '../utils/network.js';
|
|
@@ -573,6 +573,22 @@ Support: support@ante.ph
|
|
|
573
573
|
console.log(chalk.yellow(' ā Seeding skipped (optional)'));
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
title: 'Running database migrations',
|
|
579
|
+
task: async (ctx, task) => {
|
|
580
|
+
const composeFile = join(config.installDir, 'docker-compose.yml');
|
|
581
|
+
const result = await runMigrations(composeFile);
|
|
582
|
+
|
|
583
|
+
if (!result.success) {
|
|
584
|
+
throw new Error(`Migration failed:\n${result.output}`);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// Show migration output if there were migrations run
|
|
588
|
+
if (result.output && result.output.trim()) {
|
|
589
|
+
task.output = result.output;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
576
592
|
}
|
|
577
593
|
], {
|
|
578
594
|
rendererOptions: {
|
|
@@ -3,10 +3,10 @@ import inquirer from 'inquirer';
|
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
import { readFileSync, writeFileSync } from 'fs';
|
|
5
5
|
import { join } from 'path';
|
|
6
|
-
import { execa } from 'execa';
|
|
7
6
|
import { getInstallDir } from '../utils/config.js';
|
|
8
7
|
import { detectPublicIPWithFeedback, buildURL, isValidIPv4 } from '../utils/network.js';
|
|
9
8
|
import { configureNginx, requiresNginx } from '../utils/nginx.js';
|
|
9
|
+
import { pullImages, stopServices, startServices, waitForServiceHealthy } from '../utils/docker.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Validate URL format
|
|
@@ -258,15 +258,64 @@ export async function setDomain(options) {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
// Restart containers to apply new environment variables
|
|
261
|
-
console.log(chalk.gray('\nš Restarting
|
|
261
|
+
console.log(chalk.gray('\nš Restarting services with updated configuration...\n'));
|
|
262
262
|
|
|
263
263
|
try {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
264
|
+
// Step 1: Pull latest images to ensure fresh connections.json
|
|
265
|
+
console.log(chalk.gray('š„ Pulling latest images...'));
|
|
266
|
+
await pullImages(composeFile);
|
|
267
|
+
console.log(chalk.green('ā Images updated\n'));
|
|
268
|
+
|
|
269
|
+
// Step 2: Stop services gracefully (preserves volumes)
|
|
270
|
+
console.log(chalk.gray('š Stopping services...'));
|
|
271
|
+
await stopServices(composeFile);
|
|
272
|
+
console.log(chalk.green('ā Services stopped\n'));
|
|
273
|
+
|
|
274
|
+
// Step 3: Start services with fresh configuration
|
|
275
|
+
console.log(chalk.gray('š Starting services...'));
|
|
276
|
+
await startServices(composeFile);
|
|
277
|
+
console.log(chalk.green('ā Services started\n'));
|
|
278
|
+
|
|
279
|
+
// Step 4: Wait for backend to be healthy
|
|
280
|
+
console.log(chalk.gray('ā³ Waiting for backend to be healthy (up to 120 seconds)...'));
|
|
281
|
+
const backendHealthy = await waitForServiceHealthy(composeFile, 'backend', 120);
|
|
282
|
+
|
|
283
|
+
if (!backendHealthy) {
|
|
284
|
+
console.log(chalk.yellow('ā Backend did not become healthy within 120 seconds'));
|
|
285
|
+
console.log(chalk.gray(' Check logs with: ante logs backend'));
|
|
286
|
+
console.log(chalk.gray(' Check status with: ante status\n'));
|
|
287
|
+
} else {
|
|
288
|
+
console.log(chalk.green('ā Backend is healthy\n'));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Step 5: Wait for frontend to be ready
|
|
292
|
+
console.log(chalk.gray('ā³ Waiting for frontend to be ready (up to 60 seconds)...'));
|
|
293
|
+
const frontendHealthy = await waitForServiceHealthy(composeFile, 'frontend', 60);
|
|
294
|
+
|
|
295
|
+
if (!frontendHealthy) {
|
|
296
|
+
console.log(chalk.yellow('ā Frontend did not become healthy within 60 seconds'));
|
|
297
|
+
console.log(chalk.gray(' Check logs with: ante logs frontend'));
|
|
298
|
+
console.log(chalk.gray(' Check status with: ante status\n'));
|
|
299
|
+
} else {
|
|
300
|
+
console.log(chalk.green('ā Frontend is ready\n'));
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (backendHealthy && frontendHealthy) {
|
|
304
|
+
console.log(chalk.green('ā All services restarted successfully and are healthy'));
|
|
305
|
+
} else {
|
|
306
|
+
console.log(chalk.yellow('ā Some services may not be fully ready'));
|
|
307
|
+
console.log(chalk.gray(' Services are running but health checks did not pass within timeout'));
|
|
308
|
+
console.log(chalk.gray(' They may still be initializing - check logs for details'));
|
|
309
|
+
}
|
|
310
|
+
|
|
267
311
|
} catch (error) {
|
|
268
|
-
console.log(chalk.
|
|
269
|
-
console.log(chalk.
|
|
312
|
+
console.log(chalk.red('\nā Failed to restart services:'), error.message);
|
|
313
|
+
console.log(chalk.yellow('\nā Troubleshooting steps:'));
|
|
314
|
+
console.log(chalk.gray(' 1. Check service status: ante status'));
|
|
315
|
+
console.log(chalk.gray(' 2. View logs: ante logs'));
|
|
316
|
+
console.log(chalk.gray(' 3. Try manual restart: cd ~/ante-installation && docker compose down && docker compose up -d'));
|
|
317
|
+
console.log(chalk.gray(' 4. Check Docker is running: docker ps\n'));
|
|
318
|
+
throw error;
|
|
270
319
|
}
|
|
271
320
|
|
|
272
321
|
// Show summary
|