Enhance Docker and backend configurations for improved deployment

- Updated docker-compose.yml to include environment variable support for services, enhancing flexibility in configuration.
- Refactored Dockerfile to utilize build arguments for VITE environment variables, allowing for better customization during builds.
- Improved Nginx configuration to handle larger video uploads by increasing client_max_body_size to 5GB.
- Enhanced backend Dockerfile to include wget for health checks and improved startup logging for database migrations.
- Added validation for critical environment variables in the backend to ensure necessary configurations are present before application startup.
- Updated content streaming logic to support direct HLS URL construction, improving streaming reliability and user experience.
- Refactored various components and services to streamline access checks and improve error handling during content playback.
This commit is contained in:
Dorian
2026-02-13 12:35:03 +00:00
parent 7e9a35a963
commit 3ca43b62e4
23 changed files with 799 additions and 244 deletions

View File

@@ -3,15 +3,18 @@ import { AppModule } from './app.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { ValidationPipe } from '@nestjs/common';
import { useContainer } from 'class-validator';
// Sentry instrumentation removed (see instrument.ts)
import * as express from 'express';
import {
ExpressAdapter,
NestExpressApplication,
} from '@nestjs/platform-express';
import { RawBodyRequest } from './types/raw-body-request';
import { validateEnvironment } from './common/validate-env';
async function bootstrap() {
// Fail fast if critical env vars are missing
validateEnvironment();
const server = express();
const captureRawBody = (
request: RawBodyRequest,
@@ -46,7 +49,10 @@ async function bootstrap() {
useContainer(app.select(AppModule), { fallbackOnErrors: true });
if (process.env.ENVIRONMENT === 'development') {
if (
process.env.ENVIRONMENT === 'development' ||
process.env.ENVIRONMENT === 'local'
) {
const swagConfig = new DocumentBuilder()
.setTitle('IndeeHub API')
.setDescription('This is the API for the IndeeHub application')
@@ -61,19 +67,29 @@ async function bootstrap() {
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
if (process.env.ENVIRONMENT === 'production') {
// Build CORS origin list from FRONTEND_URL + known domains
const origins: string[] = [
'https://indeehub.studio',
'https://www.indeehub.studio',
'https://app.indeehub.studio',
'https://bff.indeehub.studio',
];
if (process.env.FRONTEND_URL) {
origins.push(process.env.FRONTEND_URL);
}
if (process.env.DOMAIN) {
origins.push(`https://${process.env.DOMAIN}`);
}
app.enableCors({
origin: [
'https://indeehub.studio',
'https://www.indeehub.studio',
'https://app.indeehub.studio',
'https://bff.indeehub.studio',
'https://indeehub.retool.com',
'https://www.indeehub.retool.com',
],
origin: [...new Set(origins)],
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
credentials: true,
});
} else app.enableCors();
} else {
app.enableCors();
}
await app.listen(process.env.PORT || 4000);
}