mirror of
https://github.com/docmost/docmost.git
synced 2026-08-25 12:32:24 +10:00
feat: standalone collab server (#767)
* feat: standalone collab server * * custom collab server port env * fix collab start script command * * API prefix * Log startup PORT * Tweak collab debounce
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AppController } from '../../app.controller';
|
||||
import { AppService } from '../../app.service';
|
||||
import { EnvironmentModule } from '../../integrations/environment/environment.module';
|
||||
import { CollaborationModule } from '../collaboration.module';
|
||||
import { DatabaseModule } from '@docmost/db/database.module';
|
||||
import { QueueModule } from '../../integrations/queue/queue.module';
|
||||
import { EventEmitterModule } from '@nestjs/event-emitter';
|
||||
import { HealthModule } from '../../integrations/health/health.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
DatabaseModule,
|
||||
EnvironmentModule,
|
||||
CollaborationModule,
|
||||
QueueModule,
|
||||
HealthModule,
|
||||
EventEmitterModule.forRoot(),
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
})
|
||||
export class CollabAppAppModule {}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { CollabAppAppModule } from './collab-app.module';
|
||||
import {
|
||||
FastifyAdapter,
|
||||
NestFastifyApplication,
|
||||
} from '@nestjs/platform-fastify';
|
||||
import { TransformHttpResponseInterceptor } from '../../common/interceptors/http-response.interceptor';
|
||||
import { InternalLogFilter } from '../../common/logger/internal-log-filter';
|
||||
import { Logger } from '@nestjs/common';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create<NestFastifyApplication>(
|
||||
CollabAppAppModule,
|
||||
new FastifyAdapter({
|
||||
ignoreTrailingSlash: true,
|
||||
ignoreDuplicateSlashes: true,
|
||||
maxParamLength: 500,
|
||||
}),
|
||||
{
|
||||
logger: new InternalLogFilter(),
|
||||
},
|
||||
);
|
||||
|
||||
app.setGlobalPrefix('api', { exclude: ['/'] });
|
||||
|
||||
app.enableCors();
|
||||
|
||||
app.useGlobalInterceptors(new TransformHttpResponseInterceptor());
|
||||
app.enableShutdownHooks();
|
||||
|
||||
const logger = new Logger('CollabServer');
|
||||
|
||||
const port = process.env.COLLAB_PORT || 3001;
|
||||
await app.listen(port, '0.0.0.0', () => {
|
||||
logger.log(`Listening on http://127.0.0.1:${port}`);
|
||||
});
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
Reference in New Issue
Block a user