- Complete Deno-based architecture following nupst/spark patterns - SQLite database with full schema - Docker container management - Service orchestration (Docker + Nginx + DNS + SSL) - Registry authentication - Nginx reverse proxy configuration - Cloudflare DNS integration - Let's Encrypt SSL automation - Background daemon with metrics collection - HTTP API server - Comprehensive CLI - Cross-platform compilation setup - NPM distribution wrapper - Shell installer script Core features: - Deploy containers with single command - Automatic domain configuration - Automatic SSL certificates - Multi-registry support - Metrics and logging - Systemd integration Ready for Angular UI implementation and testing.
166 lines
3.0 KiB
TypeScript
166 lines
3.0 KiB
TypeScript
/**
|
|
* Type definitions for Onebox
|
|
*/
|
|
|
|
// Service types
|
|
export interface IService {
|
|
id?: number;
|
|
name: string;
|
|
image: string;
|
|
registry?: string;
|
|
envVars: Record<string, string>;
|
|
port: number;
|
|
domain?: string;
|
|
containerID?: string;
|
|
status: 'stopped' | 'starting' | 'running' | 'stopping' | 'failed';
|
|
createdAt: number;
|
|
updatedAt: number;
|
|
}
|
|
|
|
// Registry types
|
|
export interface IRegistry {
|
|
id?: number;
|
|
url: string;
|
|
username: string;
|
|
passwordEncrypted: string;
|
|
createdAt: number;
|
|
}
|
|
|
|
// Nginx configuration types
|
|
export interface INginxConfig {
|
|
id?: number;
|
|
serviceId: number;
|
|
domain: string;
|
|
port: number;
|
|
sslEnabled: boolean;
|
|
configTemplate: string;
|
|
createdAt: number;
|
|
updatedAt: number;
|
|
}
|
|
|
|
// SSL certificate types
|
|
export interface ISslCertificate {
|
|
id?: number;
|
|
domain: string;
|
|
certPath: string;
|
|
keyPath: string;
|
|
fullChainPath: string;
|
|
expiryDate: number;
|
|
issuer: string;
|
|
createdAt: number;
|
|
updatedAt: number;
|
|
}
|
|
|
|
// DNS record types
|
|
export interface IDnsRecord {
|
|
id?: number;
|
|
domain: string;
|
|
type: 'A' | 'AAAA' | 'CNAME';
|
|
value: string;
|
|
cloudflareID?: string;
|
|
createdAt: number;
|
|
updatedAt: number;
|
|
}
|
|
|
|
// Metrics types
|
|
export interface IMetric {
|
|
id?: number;
|
|
serviceId: number;
|
|
timestamp: number;
|
|
cpuPercent: number;
|
|
memoryUsed: number;
|
|
memoryLimit: number;
|
|
networkRxBytes: number;
|
|
networkTxBytes: number;
|
|
}
|
|
|
|
// Log entry types
|
|
export interface ILogEntry {
|
|
id?: number;
|
|
serviceId: number;
|
|
timestamp: number;
|
|
message: string;
|
|
level: 'info' | 'warn' | 'error' | 'debug';
|
|
source: 'stdout' | 'stderr';
|
|
}
|
|
|
|
// User types
|
|
export interface IUser {
|
|
id?: number;
|
|
username: string;
|
|
passwordHash: string;
|
|
role: 'admin' | 'user';
|
|
createdAt: number;
|
|
updatedAt: number;
|
|
}
|
|
|
|
// Settings types
|
|
export interface ISetting {
|
|
key: string;
|
|
value: string;
|
|
updatedAt: number;
|
|
}
|
|
|
|
// Application settings
|
|
export interface IAppSettings {
|
|
serverIP?: string;
|
|
cloudflareAPIKey?: string;
|
|
cloudflareEmail?: string;
|
|
cloudflareZoneID?: string;
|
|
acmeEmail?: string;
|
|
nginxConfigDir?: string;
|
|
dataDir?: string;
|
|
httpPort?: number;
|
|
metricsInterval?: number;
|
|
logRetentionDays?: number;
|
|
}
|
|
|
|
// Container stats from Docker
|
|
export interface IContainerStats {
|
|
cpuPercent: number;
|
|
memoryUsed: number;
|
|
memoryLimit: number;
|
|
memoryPercent: number;
|
|
networkRx: number;
|
|
networkTx: number;
|
|
}
|
|
|
|
// Service deployment options
|
|
export interface IServiceDeployOptions {
|
|
name: string;
|
|
image: string;
|
|
registry?: string;
|
|
envVars?: Record<string, string>;
|
|
port: number;
|
|
domain?: string;
|
|
autoSSL?: boolean;
|
|
autoDNS?: boolean;
|
|
}
|
|
|
|
// HTTP API request/response types
|
|
export interface IApiResponse<T = unknown> {
|
|
success: boolean;
|
|
data?: T;
|
|
error?: string;
|
|
message?: string;
|
|
}
|
|
|
|
export interface ILoginRequest {
|
|
username: string;
|
|
password: string;
|
|
}
|
|
|
|
export interface ILoginResponse {
|
|
token: string;
|
|
user: {
|
|
username: string;
|
|
role: string;
|
|
};
|
|
}
|
|
|
|
// CLI command types
|
|
export interface ICliArgs {
|
|
_: string[];
|
|
[key: string]: unknown;
|
|
}
|