feat(deployment) Allow overriding service host and ports with env variables (#930)

* Add proxy changes

* Add web changes

* Add microservices changes

* Add examples

* Add header comment to nginx config

* Use URLs instead of host and port
This commit is contained in:
Ian 2022-11-09 03:11:32 -08:00 committed by GitHub
parent 66640ebfeb
commit f6aba0f9ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 65 additions and 14 deletions

View file

@ -9,6 +9,8 @@ import axios from 'axios';
import { Job } from 'bull';
import { Repository } from 'typeorm';
const immich_machine_learning_url = process.env.IMMICH_MACHINE_LEARNING_URL || 'http://immich-machine-learning:3003';
@Processor(QueueNameEnum.MACHINE_LEARNING)
export class MachineLearningProcessor {
constructor(
@ -20,9 +22,12 @@ export class MachineLearningProcessor {
async tagImage(job: Job<IMachineLearningJob>) {
const { asset } = job.data;
const res = await axios.post('http://immich-machine-learning:3003/image-classifier/tag-image', {
thumbnailPath: asset.resizePath,
});
const res = await axios.post(
immich_machine_learning_url + '/image-classifier/tag-image',
{
thumbnailPath: asset.resizePath,
},
);
if (res.status == 201 && res.data.length > 0) {
const smartInfo = new SmartInfoEntity();
@ -40,9 +45,12 @@ export class MachineLearningProcessor {
try {
const { asset }: { asset: AssetEntity } = job.data;
const res = await axios.post('http://immich-machine-learning:3003/object-detection/detect-object', {
thumbnailPath: asset.resizePath,
});
const res = await axios.post(
immich_machine_learning_url + '/object-detection/detect-object',
{
thumbnailPath: asset.resizePath,
},
);
if (res.status == 201 && res.data.length > 0) {
const smartInfo = new SmartInfoEntity();