ante-erp-cli 1.11.45 → 1.11.49

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ante-erp-cli",
3
- "version": "1.11.45",
3
+ "version": "1.11.49",
4
4
  "description": "Comprehensive CLI tool for managing ANTE ERP self-hosted installations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -3,8 +3,12 @@ import chalk from 'chalk';
3
3
  import ora from 'ora';
4
4
  import { execa } from 'execa';
5
5
  import { readFileSync, writeFileSync, existsSync } from 'fs';
6
- import { join } from 'path';
6
+ import { join, dirname } from 'path';
7
+ import { fileURLToPath } from 'url';
7
8
  import os from 'os';
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = dirname(__filename);
8
12
  import Conf from 'conf';
9
13
  import Table from 'cli-table3';
10
14
  import { backup } from './backup.js';
@@ -522,8 +526,8 @@ async function setupCronJob(schedule) {
522
526
  .split('\n')
523
527
  .filter(line => !line.includes('ante-daily-backup-runner'));
524
528
 
525
- // Add new cron job
526
- const runnerPath = join(process.cwd(), 'cli/src/commands/daily-backup-runner.js');
529
+ // Add new cron job - use the actual module location, not process.cwd()
530
+ const runnerPath = join(__dirname, 'daily-backup-runner.js');
527
531
  const logFile = join(os.homedir(), '.ante-cli-backup.log');
528
532
  const cronLine = `${schedule} /usr/bin/node ${runnerPath} >> ${logFile} 2>&1`;
529
533
 
@@ -6,7 +6,7 @@ import { existsSync, mkdirSync, readdirSync, statSync, readFileSync, createWrite
6
6
  import { execa } from 'execa';
7
7
  import Conf from 'conf';
8
8
  import { getInstallDir } from '../utils/config.js';
9
- import { execInContainer, stopServices, startServices, waitForHealthy } from '../utils/docker.js';
9
+ import { execInContainer, stopServices, startServices, waitForHealthy, runMigrations } from '../utils/docker.js';
10
10
  import { createS3Client, listS3Backups } from '../utils/s3-client.js';
11
11
  import { decryptFields } from '../utils/crypto.js';
12
12
  import { GetObjectCommand } from '@aws-sdk/client-s3';
@@ -368,6 +368,19 @@ export async function restore(backupFile, options = {}) {
368
368
  spinner.text = 'Starting all services...';
369
369
  await startServices(composeFile);
370
370
 
371
+ // Wait for backend to be healthy before running migrations
372
+ spinner.text = 'Waiting for backend service...';
373
+ await waitForHealthy(composeFile, ['backend'], 120);
374
+
375
+ // Run database migrations to sync schema with current code
376
+ spinner.text = 'Running database migrations...';
377
+ const migrationResult = await runMigrations(composeFile);
378
+
379
+ if (!migrationResult.success) {
380
+ spinner.warn(chalk.yellow('Migrations completed with warnings'));
381
+ console.log(chalk.gray(migrationResult.output));
382
+ }
383
+
371
384
  // Cleanup
372
385
  spinner.text = 'Cleaning up...';
373
386
  await execa('rm', ['-rf', tempDir]);
@@ -382,6 +395,7 @@ export async function restore(backupFile, options = {}) {
382
395
 
383
396
  console.log(chalk.white('\n✓ PostgreSQL database restored'));
384
397
  console.log(chalk.white('✓ MongoDB database restored'));
398
+ console.log(chalk.white('✓ Database migrations applied'));
385
399
  console.log(chalk.white('✓ All services started'));
386
400
 
387
401
  console.log(chalk.cyan('\nANTE is now running with restored database data'));
@@ -214,10 +214,8 @@ ${installGate ? `
214
214
  # Security hardening
215
215
  security_opt:
216
216
  - no-new-privileges:true
217
- read_only: true
218
217
  tmpfs:
219
218
  - /tmp:noexec,nosuid,size=100m
220
- - /app/.next/cache:noexec,nosuid,size=200m
221
219
  healthcheck:
222
220
  test: ["CMD", "curl", "-f", "http://localhost:3000"]
223
221
  interval: 30s
@@ -249,10 +247,8 @@ ${installGate ? `
249
247
  # Security hardening
250
248
  security_opt:
251
249
  - no-new-privileges:true
252
- read_only: true
253
250
  tmpfs:
254
251
  - /tmp:noexec,nosuid,size=100m
255
- - /app/.next/cache:noexec,nosuid,size=200m
256
252
  healthcheck:
257
253
  test: ["CMD", "curl", "-f", "http://localhost:9003"]
258
254
  interval: 30s