mirror of
https://github.com/immich-app/immich.git
synced 2025-01-28 06:32:44 +01:00
feat(server): server host binding (#8800)
* Allow setting the host address for the server & microservices Default to listen on all interfaces as per the current behavior. * (Docs) format: fix lint
This commit is contained in:
parent
7ce1662b05
commit
ed74213c63
2 changed files with 11 additions and 8 deletions
|
@ -48,12 +48,13 @@ These environment variables are used by the `docker-compose.yml` file and do **N
|
||||||
|
|
||||||
## Ports
|
## Ports
|
||||||
|
|
||||||
| Variable | Description | Default | Services |
|
| Variable | Description | Default | Services |
|
||||||
| :---------------------- | :-------------------- | :-------: | :--------------- |
|
| :---------------------- | :-------------------- | :-------: | :-------------------- |
|
||||||
| `SERVER_PORT` | Server Port | `3001` | server |
|
| `HOST` | Host | `0.0.0.0` | server, microservices |
|
||||||
| `MICROSERVICES_PORT` | Microservices Port | `3002` | microservices |
|
| `SERVER_PORT` | Server Port | `3001` | server |
|
||||||
| `MACHINE_LEARNING_HOST` | Machine Learning Host | `0.0.0.0` | machine learning |
|
| `MICROSERVICES_PORT` | Microservices Port | `3002` | microservices |
|
||||||
| `MACHINE_LEARNING_PORT` | Machine Learning Port | `3003` | machine learning |
|
| `MACHINE_LEARNING_HOST` | Machine Learning Host | `0.0.0.0` | machine learning |
|
||||||
|
| `MACHINE_LEARNING_PORT` | Machine Learning Port | `3003` | machine learning |
|
||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { useSwagger } from 'src/utils/misc';
|
||||||
|
|
||||||
async function bootstrapMicroservices() {
|
async function bootstrapMicroservices() {
|
||||||
const logger = new ImmichLogger('ImmichMicroservice');
|
const logger = new ImmichLogger('ImmichMicroservice');
|
||||||
|
const host = String(process.env.HOST || '0.0.0.0');
|
||||||
const port = Number(process.env.MICROSERVICES_PORT) || 3002;
|
const port = Number(process.env.MICROSERVICES_PORT) || 3002;
|
||||||
|
|
||||||
otelSDK.start();
|
otelSDK.start();
|
||||||
|
@ -23,13 +24,14 @@ async function bootstrapMicroservices() {
|
||||||
app.useLogger(app.get(ImmichLogger));
|
app.useLogger(app.get(ImmichLogger));
|
||||||
app.useWebSocketAdapter(new WebSocketAdapter(app));
|
app.useWebSocketAdapter(new WebSocketAdapter(app));
|
||||||
|
|
||||||
await app.listen(port);
|
await app.listen(port, host);
|
||||||
|
|
||||||
logger.log(`Immich Microservices is listening on ${await app.getUrl()} [v${serverVersion}] [${envName}] `);
|
logger.log(`Immich Microservices is listening on ${await app.getUrl()} [v${serverVersion}] [${envName}] `);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function bootstrapApi() {
|
async function bootstrapApi() {
|
||||||
const logger = new ImmichLogger('ImmichServer');
|
const logger = new ImmichLogger('ImmichServer');
|
||||||
|
const host = String(process.env.HOST || '0.0.0.0');
|
||||||
const port = Number(process.env.SERVER_PORT) || 3001;
|
const port = Number(process.env.SERVER_PORT) || 3001;
|
||||||
|
|
||||||
otelSDK.start();
|
otelSDK.start();
|
||||||
|
@ -65,7 +67,7 @@ async function bootstrapApi() {
|
||||||
}
|
}
|
||||||
app.use(app.get(ApiService).ssr(excludePaths));
|
app.use(app.get(ApiService).ssr(excludePaths));
|
||||||
|
|
||||||
const server = await app.listen(port);
|
const server = await app.listen(port, host);
|
||||||
server.requestTimeout = 30 * 60 * 1000;
|
server.requestTimeout = 30 * 60 * 1000;
|
||||||
|
|
||||||
logger.log(`Immich Server is listening on ${await app.getUrl()} [v${serverVersion}] [${envName}] `);
|
logger.log(`Immich Server is listening on ${await app.getUrl()} [v${serverVersion}] [${envName}] `);
|
||||||
|
|
Loading…
Reference in a new issue