feat: Implement platform service providers for MinIO and MongoDB

- Added base interface and abstract class for platform service providers.
- Created MinIOProvider class for S3-compatible storage with deployment, provisioning, and deprovisioning functionalities.
- Implemented MongoDBProvider class for MongoDB service with similar capabilities.
- Introduced error handling utilities for better error management.
- Developed TokensComponent for managing registry tokens in the UI, including creation, deletion, and display of tokens.
This commit is contained in:
2025-11-25 04:20:19 +00:00
parent 9aa6906ca5
commit 8ebd677478
28 changed files with 3462 additions and 490 deletions

View File

@@ -18,10 +18,11 @@ export interface IService {
// Onebox Registry fields
useOneboxRegistry?: boolean;
registryRepository?: string;
registryToken?: string;
registryImageTag?: string;
autoUpdateOnPush?: boolean;
imageDigest?: string;
// Platform service requirements
platformRequirements?: IPlatformRequirements;
}
// Registry types
@@ -33,6 +34,96 @@ export interface IRegistry {
createdAt: number;
}
// Registry token types
export interface IRegistryToken {
id?: number;
name: string;
tokenHash: string;
type: 'global' | 'ci';
scope: 'all' | string[]; // 'all' or array of service names
expiresAt: number | null;
createdAt: number;
lastUsedAt: number | null;
createdBy: string;
}
export interface ICreateRegistryTokenRequest {
name: string;
type: 'global' | 'ci';
scope: 'all' | string[];
expiresIn: '30d' | '90d' | '365d' | 'never';
}
export interface IRegistryTokenView {
id: number;
name: string;
type: 'global' | 'ci';
scope: 'all' | string[];
scopeDisplay: string;
expiresAt: number | null;
createdAt: number;
lastUsedAt: number | null;
createdBy: string;
isExpired: boolean;
}
export interface ITokenCreatedResponse {
token: IRegistryTokenView;
plainToken: string; // Only shown once at creation
}
// Platform service types
export type TPlatformServiceType = 'mongodb' | 'minio' | 'redis' | 'postgresql' | 'rabbitmq';
export type TPlatformResourceType = 'database' | 'bucket' | 'cache' | 'queue';
export type TPlatformServiceStatus = 'stopped' | 'starting' | 'running' | 'stopping' | 'failed';
export interface IPlatformService {
id?: number;
name: string;
type: TPlatformServiceType;
status: TPlatformServiceStatus;
containerId?: string;
config: IPlatformServiceConfig;
adminCredentialsEncrypted?: string;
createdAt: number;
updatedAt: number;
}
export interface IPlatformServiceConfig {
image: string;
port: number;
volumes?: string[];
command?: string;
environment?: Record<string, string>;
}
export interface IPlatformResource {
id?: number;
platformServiceId: number;
serviceId: number;
resourceType: TPlatformResourceType;
resourceName: string;
credentialsEncrypted: string;
createdAt: number;
}
export interface IPlatformRequirements {
mongodb?: boolean;
s3?: boolean;
}
export interface IProvisionedResource {
type: TPlatformResourceType;
name: string;
credentials: Record<string, string>;
envVars: Record<string, string>;
}
export interface IEnvVarMapping {
envVar: string;
credentialPath: string;
}
// Nginx configuration types
export interface INginxConfig {
id?: number;
@@ -193,6 +284,9 @@ export interface IServiceDeployOptions {
useOneboxRegistry?: boolean;
registryImageTag?: string;
autoUpdateOnPush?: boolean;
// Platform service requirements
enableMongoDB?: boolean;
enableS3?: boolean;
}
// HTTP API request/response types