1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-28 09:33:27 +02:00

refactor!: port env (#9559)

refactor: port env
This commit is contained in:
Jason Rasmussen 2024-05-17 12:59:05 -04:00 committed by GitHub
parent c03981ac1d
commit d61418886f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 20 deletions

View File

@ -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

View File

@ -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();
}
});

View File

@ -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

View File

@ -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),

View File

@ -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<NestExpressApplication>(ApiModule, { bufferLogs: true });
const logger = await app.resolve(ILoggerRepository);

View File

@ -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) {