2022-08-23 16:34:21 +02:00
|
|
|
import { immichAppConfig } from '@app/common/config';
|
2022-06-11 23:12:06 +02:00
|
|
|
import { DatabaseModule } from '@app/database';
|
|
|
|
import { AssetEntity } from '@app/database/entities/asset.entity';
|
|
|
|
import { ExifEntity } from '@app/database/entities/exif.entity';
|
|
|
|
import { SmartInfoEntity } from '@app/database/entities/smart-info.entity';
|
|
|
|
import { UserEntity } from '@app/database/entities/user.entity';
|
2022-07-03 04:06:36 +02:00
|
|
|
import {
|
|
|
|
assetUploadedQueueName,
|
2022-09-02 15:32:21 +02:00
|
|
|
generateChecksumQueueName,
|
2022-07-03 04:06:36 +02:00
|
|
|
metadataExtractionQueueName,
|
|
|
|
thumbnailGeneratorQueueName,
|
|
|
|
videoConversionQueueName,
|
|
|
|
} from '@app/job/constants/queue-name.constant';
|
2022-08-23 16:34:21 +02:00
|
|
|
import { BullModule } from '@nestjs/bull';
|
|
|
|
import { Module } from '@nestjs/common';
|
|
|
|
import { ConfigModule } from '@nestjs/config';
|
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
|
|
import { CommunicationModule } from '../../immich/src/api-v1/communication/communication.module';
|
|
|
|
import { MicroservicesService } from './microservices.service';
|
|
|
|
import { AssetUploadedProcessor } from './processors/asset-uploaded.processor';
|
2022-09-02 15:32:21 +02:00
|
|
|
import { GenerateChecksumProcessor } from './processors/generate-checksum.processor';
|
2022-08-23 16:34:21 +02:00
|
|
|
import { MetadataExtractionProcessor } from './processors/metadata-extraction.processor';
|
|
|
|
import { ThumbnailGeneratorProcessor } from './processors/thumbnail.processor';
|
|
|
|
import { VideoTranscodeProcessor } from './processors/video-transcode.processor';
|
2022-06-11 23:12:06 +02:00
|
|
|
|
|
|
|
@Module({
|
|
|
|
imports: [
|
2022-08-23 16:34:21 +02:00
|
|
|
ConfigModule.forRoot(immichAppConfig),
|
2022-06-11 23:12:06 +02:00
|
|
|
DatabaseModule,
|
|
|
|
TypeOrmModule.forFeature([UserEntity, ExifEntity, AssetEntity, SmartInfoEntity]),
|
|
|
|
BullModule.forRootAsync({
|
|
|
|
useFactory: async () => ({
|
2022-08-18 15:24:07 +02:00
|
|
|
prefix: 'immich_bull',
|
2022-06-11 23:12:06 +02:00
|
|
|
redis: {
|
|
|
|
host: process.env.REDIS_HOSTNAME || 'immich_redis',
|
2022-07-13 05:21:11 +02:00
|
|
|
port: parseInt(process.env.REDIS_PORT || '6379'),
|
|
|
|
db: parseInt(process.env.REDIS_DBINDEX || '0'),
|
|
|
|
password: process.env.REDIS_PASSWORD || undefined,
|
|
|
|
path: process.env.REDIS_SOCKET || undefined,
|
2022-06-11 23:12:06 +02:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
BullModule.registerQueue({
|
2022-07-03 04:06:36 +02:00
|
|
|
name: thumbnailGeneratorQueueName,
|
2022-06-11 23:12:06 +02:00
|
|
|
defaultJobOptions: {
|
|
|
|
attempts: 3,
|
|
|
|
removeOnComplete: true,
|
|
|
|
removeOnFail: false,
|
|
|
|
},
|
2022-09-02 15:32:21 +02:00
|
|
|
}, {
|
2022-07-03 04:06:36 +02:00
|
|
|
name: assetUploadedQueueName,
|
2022-06-11 23:12:06 +02:00
|
|
|
defaultJobOptions: {
|
|
|
|
attempts: 3,
|
|
|
|
removeOnComplete: true,
|
|
|
|
removeOnFail: false,
|
|
|
|
},
|
2022-09-02 15:32:21 +02:00
|
|
|
}, {
|
2022-07-03 04:06:36 +02:00
|
|
|
name: metadataExtractionQueueName,
|
2022-06-11 23:12:06 +02:00
|
|
|
defaultJobOptions: {
|
|
|
|
attempts: 3,
|
|
|
|
removeOnComplete: true,
|
|
|
|
removeOnFail: false,
|
|
|
|
},
|
2022-09-02 15:32:21 +02:00
|
|
|
}, {
|
2022-07-03 04:06:36 +02:00
|
|
|
name: videoConversionQueueName,
|
2022-06-11 23:12:06 +02:00
|
|
|
defaultJobOptions: {
|
|
|
|
attempts: 3,
|
|
|
|
removeOnComplete: true,
|
|
|
|
removeOnFail: false,
|
|
|
|
},
|
2022-09-02 15:32:21 +02:00
|
|
|
}, {
|
|
|
|
name: generateChecksumQueueName,
|
|
|
|
defaultJobOptions: {
|
|
|
|
attempts: 3,
|
|
|
|
removeOnComplete: true,
|
|
|
|
removeOnFail: false,
|
|
|
|
},
|
2022-06-11 23:12:06 +02:00
|
|
|
}),
|
2022-06-19 15:16:35 +02:00
|
|
|
CommunicationModule,
|
2022-06-11 23:12:06 +02:00
|
|
|
],
|
|
|
|
controllers: [],
|
|
|
|
providers: [
|
|
|
|
MicroservicesService,
|
|
|
|
AssetUploadedProcessor,
|
|
|
|
ThumbnailGeneratorProcessor,
|
|
|
|
MetadataExtractionProcessor,
|
|
|
|
VideoTranscodeProcessor,
|
2022-09-02 15:32:21 +02:00
|
|
|
GenerateChecksumProcessor,
|
2022-06-11 23:12:06 +02:00
|
|
|
],
|
|
|
|
exports: [],
|
|
|
|
})
|
|
|
|
export class MicroservicesModule {}
|