High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
feat(server/machine-learning): Configurable port (#1386)
Skyler Mäntysaari9d337bf4dc7e
diff --git a/machine-learning/src/main.ts b/machine-learning/src/main.tsindex 5199e4b719..dbe0e393b1 100644--- a/machine-learning/src/main.ts+++ b/machine-learning/src/main.ts@@ -5,7 +5,9 @@ import { Logger } from '@nestjs/common';async function bootstrap() {const app = await NestFactory.create(AppModule);- await app.listen(3003, () => {+ const port = Number(process.env.MACHINE_LEARNING_PORT) || 3003;++ await app.listen(port, () => {if (process.env.NODE_ENV == 'development') {Logger.log('Running Immich Machine Learning in DEVELOPMENT environment',diff --git a/server/apps/immich/src/main.ts b/server/apps/immich/src/main.tsindex 79eed0854d..d1d3ed1d0b 100644--- a/server/apps/immich/src/main.ts+++ b/server/apps/immich/src/main.ts@@ -27,6 +27,8 @@ async function bootstrap() {app.enableCors();}+ const serverPort = Number(process.env.SERVER_PORT) || 3001;+const redisIoAdapter = new RedisIoAdapter(app);await redisIoAdapter.connectToRedis();app.useWebSocketAdapter(redisIoAdapter);@@ -59,7 +61,7 @@ async function bootstrap() {customSiteTitle: 'Immich API Documentation',});- await app.listen(3001, () => {+ await app.listen(serverPort, () => {if (process.env.NODE_ENV == 'development') {// Generate API Documentation only in development modeconst outputPath = path.resolve(process.cwd(), 'immich-openapi-specs.json');@@ -67,7 +69,9 @@ async function bootstrap() {}const envName = (process.env.NODE_ENV || 'development').toUpperCase();- logger.log(`Running Immich Server in ${envName} environment - version ${SERVER_VERSION}`);+ logger.log(+ `Running Immich Server in ${envName} environment - version ${SERVER_VERSION} - Listening on port: ${serverPort}`,+ );});logger.warn(`Machine learning is ${MACHINE_LEARNING_ENABLED ? 'enabled' : 'disabled'}`);diff --git a/server/apps/microservices/src/main.ts b/server/apps/microservices/src/main.tsindex c512e5c0e7..f8292ce791 100644--- a/server/apps/microservices/src/main.ts+++ b/server/apps/microservices/src/main.ts@@ -12,13 +12,17 @@ async function bootstrap() {logger: getLogLevels(),});+ const listeningPort = Number(process.env.MACHINE_LEARNING_PORT) || 3002;+const redisIoAdapter = new RedisIoAdapter(app);await redisIoAdapter.connectToRedis();app.useWebSocketAdapter(redisIoAdapter);- await app.listen(3002, () => {+ await app.listen(listeningPort, () => {const envName = (process.env.NODE_ENV || 'development').toUpperCase();- logger.log(`Running Immich Microservices in ${envName} environment - version ${SERVER_VERSION}`);+ logger.log(+ `Running Immich Microservices in ${envName} environment - version ${SERVER_VERSION} - Listening on port: ${listeningPort}`,+ );});}bootstrap();diff --git a/server/libs/common/src/config/app.config.ts b/server/libs/common/src/config/app.config.tsindex 7f2ab30459..71a47b0b18 100644--- a/server/libs/common/src/config/app.config.ts+++ b/server/libs/common/src/config/app.config.ts@@ -35,5 +35,8 @@ export const immichAppConfig: ConfigModuleOptions = {DISABLE_REVERSE_GEOCODING: Joi.boolean().optional().valid(true, false).default(false),REVERSE_GEOCODING_PRECISION: Joi.number().optional().valid(0, 1, 2, 3).default(3),LOG_LEVEL: Joi.string().optional().valid('simple', 'verbose', 'debug', 'log', 'warn', 'error').default('log'),+ MACHINE_LEARNING_PORT: Joi.number().optional(),+ MICROSERVICES_PORT: Joi.number().optional(),+ SERVER_PORT: Joi.number().optional(),}),};