d3a5240528
- Add AppSnapshot entity with type (pre_deploy/manual), status tracking, and file paths - Add SnapshotsService with create, capture, rollback, prune (max 10), and download logic - Add SnapshotsController with REST endpoints for CRUD, rollback, and file downloads - Add K8s methods: exportDatabaseDump, archiveWpContent, restoreWpContent - Auto-create pre-deploy snapshots before each deployment for rollback safety - Support downloading current live state (source, wp-content, database) without snapshots - Add snapshot management UI in app detail page with create, rollback, download, delete - Wire circular dependencies with forwardRef between Deployments and Snapshots modules
68 lines
2.2 KiB
TypeScript
68 lines
2.2 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
import { BullModule } from '@nestjs/bull';
|
|
import { AuthModule } from './auth/auth.module';
|
|
import { UsersModule } from './users/users.module';
|
|
import { ApplicationsModule } from './applications/applications.module';
|
|
import { DeploymentsModule } from './deployments/deployments.module';
|
|
import { ClustersModule } from './clusters/clusters.module';
|
|
import { KubernetesModule } from './kubernetes/kubernetes.module';
|
|
import { BuildModule } from './build/build.module';
|
|
import { TicketsModule } from './tickets/tickets.module';
|
|
import { BillingModule } from './billing/billing.module';
|
|
import { SnapshotsModule } from './snapshots/snapshots.module';
|
|
import configuration from './config/configuration';
|
|
|
|
@Module({
|
|
imports: [
|
|
// Configuration
|
|
ConfigModule.forRoot({
|
|
isGlobal: true,
|
|
load: [configuration],
|
|
}),
|
|
|
|
// Database
|
|
TypeOrmModule.forRootAsync({
|
|
imports: [ConfigModule],
|
|
useFactory: (configService: ConfigService) => ({
|
|
type: 'postgres',
|
|
host: configService.get('database.host'),
|
|
port: configService.get('database.port'),
|
|
username: configService.get('database.username'),
|
|
password: configService.get('database.password'),
|
|
database: configService.get('database.name'),
|
|
entities: [__dirname + '/**/*.entity{.ts,.js}'],
|
|
synchronize: configService.get('nodeEnv') === 'development',
|
|
logging: configService.get('nodeEnv') === 'development' ? ['error', 'warn'] : false,
|
|
}),
|
|
inject: [ConfigService],
|
|
}),
|
|
|
|
// Redis / Bull Queue
|
|
BullModule.forRootAsync({
|
|
imports: [ConfigModule],
|
|
useFactory: (configService: ConfigService) => ({
|
|
redis: {
|
|
host: configService.get('redis.host'),
|
|
port: configService.get('redis.port'),
|
|
},
|
|
}),
|
|
inject: [ConfigService],
|
|
}),
|
|
|
|
// Feature modules
|
|
AuthModule,
|
|
UsersModule,
|
|
ApplicationsModule,
|
|
DeploymentsModule,
|
|
ClustersModule,
|
|
KubernetesModule,
|
|
BuildModule,
|
|
TicketsModule,
|
|
BillingModule,
|
|
SnapshotsModule,
|
|
],
|
|
})
|
|
export class AppModule {}
|