forge-deploy-cli
Version:
Professional CLI for local deployments with automatic subdomain routing, SSL certificates, and infrastructure management
122 lines • 3.89 kB
TypeScript
import { Framework } from '../types';
export interface LocalDeployment {
id: string;
projectName: string;
subdomain: string;
framework: Framework;
projectPath: string;
port: number;
pid?: number;
status: 'running' | 'stopped' | 'failed' | 'paused';
url: string;
startedAt?: Date;
lastAccessed?: Date;
storageLimit: number;
resources?: {
cpu: number;
memory: number;
diskUsed: number;
diskUsagePercent: number;
};
}
export declare class LocalDeploymentManager {
private static readonly DEPLOYMENTS_FILE;
private static readonly MIN_PORT;
private static readonly MAX_PORT;
private static readonly BASE_DOMAIN;
private static readonly NGINX_CONFIG_DIR;
private static readonly PM2_ECOSYSTEM_FILE;
/**
* Deploy a project locally
*/
static deployLocally(deploymentData: {
id: string;
projectName: string;
subdomain: string;
framework: Framework;
projectPath: string;
buildOutputDir?: string;
publicIP?: string;
}): Promise<LocalDeployment>;
/**
* Start an application using PM2 for better process management
*/
private static startApplication;
static stopDeployment(deploymentId: string): Promise<void>;
static listDeployments(): Promise<LocalDeployment[]>;
static getDeployment(deploymentId: string): Promise<LocalDeployment | null>;
static saveDeployment(deployment: LocalDeployment): Promise<void>;
private static findAvailablePort;
private static isPortAvailable;
static ensureServeInstalled(): Promise<void>;
static cleanup(): Promise<void>;
static getDeploymentStatus(deploymentId: string): Promise<LocalDeployment | null>;
private static ensurePM2Installed;
private static setupNginxConfig;
private static generateNginxConfig;
/**
* Test nginx configuration
*/
private static testNginxConfig;
/**
* Reload nginx configuration
*/
private static reloadNginx;
/**
* Install and configure nginx
*/
static setupNginx(): Promise<void>;
/**
* Ensure main nginx configuration includes forge sites
*/
private static ensureMainNginxConfig;
/**
* Setup SSL certificate for a deployment using per-subdomain certificate
* Returns true if SSL was successfully configured, false if skipped
*/
static setupSSLForDeployment(deploymentId: string, subdomain: string, publicIP: string): Promise<boolean>;
/**
* Request SSL certificate for a specific subdomain using Let's Encrypt
*/
private static requestSubdomainCertificate;
private static updateCloudflareRecord;
static calculateResourceUsage(deployment: LocalDeployment): Promise<{
cpu: number;
memory: number;
diskUsed: number;
diskUsagePercent: number;
}>;
/**
* Get directory size in bytes
*/
private static getDirectorySize;
/**
* Update deployment with real-time resource usage
*/
static updateDeploymentResources(deploymentId: string): Promise<void>;
/**
* Get process data from PM2 for accurate resource monitoring
*/
private static getPM2ProcessData;
/**
* Fallback process monitoring for non-PM2 processes
*/
private static getFallbackProcessData;
/**
* Get real deployment data for API usage
*/
static getDeploymentWithResources(deploymentId: string): Promise<LocalDeployment | null>;
/**
* Check if a file exists in the project directory
*/
private static hasFile;
/**
* Get interpreter for PM2 process
*/
private static getInterpreter;
/**
* Get environment variables for different frameworks
*/
private static getEnvironmentVariables;
}
//# sourceMappingURL=localDeployment.d.ts.map