diff --git a/docs/docs/install/environment-variables.md b/docs/docs/install/environment-variables.md index d4b5664fbc4f6..4c163ac226187 100644 --- a/docs/docs/install/environment-variables.md +++ b/docs/docs/install/environment-variables.md @@ -59,13 +59,10 @@ It only need to be set if the Immich deployment method is changing. ## Ports -| Variable | Description | Default | Services | -| :---------------------- | :-------------------- | :-------: | :-------------------- | -| `HOST` | Host | `0.0.0.0` | server, microservices | -| `SERVER_PORT` | Server Port | `3001` | server | -| `MICROSERVICES_PORT` | Microservices Port | `3002` | microservices | -| `MACHINE_LEARNING_HOST` | Machine Learning Host | `0.0.0.0` | machine learning | -| `MACHINE_LEARNING_PORT` | Machine Learning Port | `3003` | machine learning | +| Variable | Description | Default | +| :------------ | :------------- | :------------------------------------: | +| `IMMICH_HOST` | Listening host | `0.0.0.0` | +| `IMMICH_PORT` | Listening port | 3001 (server), 3003 (machine learning) | ## Database diff --git a/e2e/src/setup.ts b/e2e/src/setup.ts index e9395ddd35864..3ae87417a2f94 100644 --- a/e2e/src/setup.ts +++ b/e2e/src/setup.ts @@ -17,7 +17,7 @@ const setup = async () => { child.stdout.on('data', (data) => { const input = data.toString(); console.log(input); - if (input.includes('Immich Microservices is listening')) { + if (input.includes('Immich Microservices is running')) { _resolve(); } }); diff --git a/machine-learning/start.sh b/machine-learning/start.sh index 7a5cb919a6e36..9d0a505c0c56c 100755 --- a/machine-learning/start.sh +++ b/machine-learning/start.sh @@ -2,20 +2,20 @@ lib_path="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2" # mimalloc seems to increase memory usage dramatically with openvino, need to investigate -if ! [ "$DEVICE" = "openvino" ]; then +if ! [ "$DEVICE" = "openvino" ]; then export LD_PRELOAD="$lib_path" export LD_BIND_NOW=1 fi -: "${MACHINE_LEARNING_HOST:=[::]}" -: "${MACHINE_LEARNING_PORT:=3003}" +: "${IMMICH_HOST:=[::]}" +: "${IMMICH_PORT:=3003}" : "${MACHINE_LEARNING_WORKERS:=1}" : "${MACHINE_LEARNING_WORKER_TIMEOUT:=120}" gunicorn app.main:app \ -k app.config.CustomUvicornWorker \ + -b "$IMMICH_HOST":"$IMMICH_PORT" \ -w "$MACHINE_LEARNING_WORKERS" \ - -b "$MACHINE_LEARNING_HOST":"$MACHINE_LEARNING_PORT" \ -t "$MACHINE_LEARNING_WORKER_TIMEOUT" \ --log-config-json log_conf.json \ --graceful-timeout 0 diff --git a/server/src/config.ts b/server/src/config.ts index 1f4ed9f0eb85f..3e3a42c760201 100644 --- a/server/src/config.ts +++ b/server/src/config.ts @@ -372,8 +372,7 @@ export const immichAppConfig: ConfigModuleOptions = { DB_VECTOR_EXTENSION: Joi.string().optional().valid('pgvector', 'pgvecto.rs').default('pgvecto.rs'), DB_SKIP_MIGRATIONS: Joi.boolean().optional().default(false), - MACHINE_LEARNING_PORT: Joi.number().optional(), - MICROSERVICES_PORT: Joi.number().optional(), + IMMICH_PORT: Joi.number().optional(), IMMICH_METRICS_PORT: Joi.number().optional(), IMMICH_METRICS: Joi.boolean().optional().default(false), diff --git a/server/src/workers/api.ts b/server/src/workers/api.ts index 2423eac072586..ec4563a8852d7 100644 --- a/server/src/workers/api.ts +++ b/server/src/workers/api.ts @@ -18,7 +18,7 @@ const host = process.env.HOST; async function bootstrap() { otelSDK.start(); - const port = Number(process.env.SERVER_PORT) || 3001; + const port = Number(process.env.IMMICH_PORT) || 3001; const app = await NestFactory.create(ApiModule, { bufferLogs: true }); const logger = await app.resolve(ILoggerRepository); diff --git a/server/src/workers/microservices.ts b/server/src/workers/microservices.ts index 2400e62fc8988..de198d2e27a80 100644 --- a/server/src/workers/microservices.ts +++ b/server/src/workers/microservices.ts @@ -6,12 +6,9 @@ import { ILoggerRepository } from 'src/interfaces/logger.interface'; import { WebSocketAdapter } from 'src/middleware/websocket.adapter'; import { otelSDK } from 'src/utils/instrumentation'; -const host = process.env.HOST; - export async function bootstrap() { otelSDK.start(); - const port = Number(process.env.MICROSERVICES_PORT) || 3002; const app = await NestFactory.create(MicroservicesModule, { bufferLogs: true }); const logger = await app.resolve(ILoggerRepository); logger.setAppName('ImmichMicroservices'); @@ -19,9 +16,9 @@ export async function bootstrap() { app.useLogger(logger); app.useWebSocketAdapter(new WebSocketAdapter(app)); - await (host ? app.listen(port, host) : app.listen(port)); + await app.listen(0); - logger.log(`Immich Microservices is listening on ${await app.getUrl()} [v${serverVersion}] [${envName}] `); + logger.log(`Immich Microservices is running [v${serverVersion}] [${envName}] `); } if (!isMainThread) {