mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
Added successfully built docker-compose and cockerFile
This commit is contained in:
@@ -27,9 +27,9 @@ import { ServerInfoModule } from './api-v1/server-info/server-info.module';
|
||||
imports: [ConfigModule],
|
||||
useFactory: async (configService: ConfigService) => ({
|
||||
redis: {
|
||||
host: configService.get('REDIS_HOST'),
|
||||
port: configService.get('REDIS_PORT'),
|
||||
password: configService.get('REDIS_PASSWORD'),
|
||||
host: 'immich_redis',
|
||||
port: 6379,
|
||||
// password: configService.get('REDIS_PASSWORD'),
|
||||
},
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
@@ -44,6 +44,6 @@ import { ServerInfoModule } from './api-v1/server-info/server-info.module';
|
||||
})
|
||||
export class AppModule implements NestModule {
|
||||
configure(consumer: MiddlewareConsumer): void {
|
||||
// consumer.apply(AppLoggerMiddleware).forRoutes('*');
|
||||
consumer.apply(AppLoggerMiddleware).forRoutes('*');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,14 @@ export const immichAppConfig: ConfigModuleOptions = {
|
||||
isGlobal: true,
|
||||
validationSchema: Joi.object({
|
||||
NODE_ENV: Joi.string().required().valid('development', 'production', 'staging').default('development'),
|
||||
DB_HOST: Joi.string().required(),
|
||||
// DB_HOST: Joi.string().required(),
|
||||
DB_USERNAME: Joi.string().required(),
|
||||
DB_PASSWORD: Joi.string().required(),
|
||||
DB_DATABASE: Joi.string().required(),
|
||||
DB_DATABASE_NAME: Joi.string().required(),
|
||||
UPLOAD_LOCATION: Joi.string().required(),
|
||||
JWT_SECRET: Joi.string().required(),
|
||||
REDIS_HOST: Joi.string().required(),
|
||||
REDIS_PORT: Joi.string().required(),
|
||||
REDIS_PASSWORD: Joi.string().required(),
|
||||
// REDIS_HOST: Joi.string().required(),
|
||||
// REDIS_PORT: Joi.string().required(),
|
||||
// REDIS_PASSWORD: Joi.string().required(),
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -9,11 +9,11 @@ if (result.error) {
|
||||
|
||||
export const databaseConfig: TypeOrmModuleOptions = {
|
||||
type: 'postgres',
|
||||
host: process.env.DB_HOST,
|
||||
host: 'immich_postgres',
|
||||
port: 5432,
|
||||
username: process.env.DB_USERNAME,
|
||||
password: process.env.DB_PASSWORD,
|
||||
database: process.env.DB_DATABASE,
|
||||
database: process.env.DB_DATABASE_NAME,
|
||||
entities: [__dirname + '/../**/*.entity.{js,ts}'],
|
||||
synchronize: true,
|
||||
// logging: true,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { AssetService } from '../../api-v1/asset/asset.service';
|
||||
import { AssetEntity } from '../../api-v1/asset/entities/asset.entity';
|
||||
import { ImageOptimizeProcessor } from './image-optimize.processor';
|
||||
import { ImageOptimizeService } from './image-optimize.service';
|
||||
import { MachineLearningProcessor } from './machine-learning.processor';
|
||||
// import { MachineLearningProcessor } from './machine-learning.processor';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -30,7 +30,7 @@ import { MachineLearningProcessor } from './machine-learning.processor';
|
||||
|
||||
TypeOrmModule.forFeature([AssetEntity]),
|
||||
],
|
||||
providers: [ImageOptimizeService, ImageOptimizeProcessor, MachineLearningProcessor],
|
||||
providers: [ImageOptimizeService, ImageOptimizeProcessor],
|
||||
exports: [ImageOptimizeService],
|
||||
})
|
||||
export class ImageOptimizeModule {}
|
||||
|
||||
@@ -8,10 +8,7 @@ import { AuthUserDto } from '../../decorators/auth-user.decorator';
|
||||
|
||||
@Injectable()
|
||||
export class ImageOptimizeService {
|
||||
constructor(
|
||||
@InjectQueue('image') private imageQueue: Queue,
|
||||
@InjectQueue('machine-learning') private machineLearningQueue: Queue,
|
||||
) {}
|
||||
constructor(@InjectQueue('image') private imageQueue: Queue) {}
|
||||
|
||||
public async resizeImage(savedAsset: AssetEntity) {
|
||||
const job = await this.imageQueue.add(
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
import { Process, Processor } from '@nestjs/bull';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Job } from 'bull';
|
||||
import { Repository } from 'typeorm';
|
||||
import { AssetEntity } from '../../api-v1/asset/entities/asset.entity';
|
||||
import sharp from 'sharp';
|
||||
import fs, { existsSync, mkdirSync } from 'fs';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import * as tfnode from '@tensorflow/tfjs-node';
|
||||
import * as cocoSsd from '@tensorflow-models/coco-ssd';
|
||||
// import { Process, Processor } from '@nestjs/bull';
|
||||
// import { InjectRepository } from '@nestjs/typeorm';
|
||||
// import { Job } from 'bull';
|
||||
// import { Repository } from 'typeorm';
|
||||
// import { AssetEntity } from '../../api-v1/asset/entities/asset.entity';
|
||||
// import sharp from 'sharp';
|
||||
// import fs, { existsSync, mkdirSync } from 'fs';
|
||||
// import { ConfigService } from '@nestjs/config';
|
||||
// import * as tfnode from '@tensorflow/tfjs-node';
|
||||
// import * as cocoSsd from '@tensorflow-models/coco-ssd';
|
||||
|
||||
@Processor('machine-learning')
|
||||
export class MachineLearningProcessor {
|
||||
constructor(
|
||||
@InjectRepository(AssetEntity) private assetRepository: Repository<AssetEntity>,
|
||||
private configService: ConfigService,
|
||||
) {}
|
||||
// @Processor('machine-learning')
|
||||
// export class MachineLearningProcessor {
|
||||
// constructor(
|
||||
// @InjectRepository(AssetEntity) private assetRepository: Repository<AssetEntity>,
|
||||
// private configService: ConfigService,
|
||||
// ) {}
|
||||
|
||||
@Process('object-detection')
|
||||
async handleOptimization(job: Job) {
|
||||
try {
|
||||
const { resizePath }: { resizePath: string } = job.data;
|
||||
// @Process('object-detection')
|
||||
// async handleOptimization(job: Job) {
|
||||
// try {
|
||||
// const { resizePath }: { resizePath: string } = job.data;
|
||||
|
||||
const image = fs.readFileSync(resizePath);
|
||||
const decodedImage = tfnode.node.decodeImage(image, 3) as tfnode.Tensor3D;
|
||||
const model = await cocoSsd.load();
|
||||
const predictions = await model.detect(decodedImage);
|
||||
console.log('start predictions ------------------ ');
|
||||
for (var result of predictions) {
|
||||
console.log(`Found ${result.class} with score ${result.score}`);
|
||||
}
|
||||
console.log('end predictions ------------------ ');
|
||||
// const image = fs.readFileSync(resizePath);
|
||||
// const decodedImage = tfnode.node.decodeImage(image, 3) as tfnode.Tensor3D;
|
||||
// const model = await cocoSsd.load();
|
||||
// const predictions = await model.detect(decodedImage);
|
||||
// console.log('start predictions ------------------ ');
|
||||
// for (var result of predictions) {
|
||||
// console.log(`Found ${result.class} with score ${result.score}`);
|
||||
// }
|
||||
// console.log('end predictions ------------------ ');
|
||||
|
||||
return 'ok';
|
||||
} catch (e) {
|
||||
console.log('Error object detection ', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// return 'ok';
|
||||
// } catch (e) {
|
||||
// console.log('Error object detection ', e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user