feat: database management — custom credentials, dump upload/restore
Backend: - Add dbUsername/dbPassword columns to Application entity - Add optional DB credential fields to CreateApplicationDto - Auto-generate dbPassword (crypto.randomBytes) and default dbUsername='appuser' when databaseType != 'none' on app creation - Store both username and password in K8s DB secret (was password-only) - Read DB_USER/POSTGRES_USER/MYSQL_USER from secretKeyRef instead of hardcoded - New restoreDatabaseDump() in KubernetesService: creates K8s Job with psql/mysql client to restore uploaded SQL dump, waits for completion, returns logs - New POST /applications/:id/db-upload endpoint with 500MB file limit Frontend: - Add dbUsername/dbPassword to Application and CreateApplicationDto types - Deploy page: show username/password fields when database is selected, with generate-random-password button and show/hide toggle - App detail page: new Database section with connection info (host, port, db name, username, password with copy-to-clipboard), SQL dump upload area with drag-and-drop, and restore output logs display Security: - Database remains ClusterIP only (no external exposure) - Credentials stored in K8s Secrets (base64-encoded) - Dump file uploaded as temporary K8s Secret, auto-cleaned after restore
This commit is contained in:
@@ -15,6 +15,8 @@ export interface Application {
|
||||
description?: string;
|
||||
runtime: 'nodejs' | 'laravel';
|
||||
databaseType: 'mysql' | 'postgresql' | 'none';
|
||||
dbUsername?: string;
|
||||
dbPassword?: string;
|
||||
gitUrl?: string;
|
||||
gitToken?: string;
|
||||
gitBranch?: string;
|
||||
@@ -87,6 +89,8 @@ export interface CreateApplicationDto {
|
||||
description?: string;
|
||||
runtime: 'nodejs' | 'laravel';
|
||||
databaseType: 'mysql' | 'postgresql' | 'none';
|
||||
dbUsername?: string;
|
||||
dbPassword?: string;
|
||||
gitUrl?: string;
|
||||
gitToken?: string;
|
||||
gitBranch?: string;
|
||||
|
||||
Reference in New Issue
Block a user