feat: add comprehensive logging infrastructure

- Add Loki/Prometheus/Grafana stack in logging-stack/
- Add log-ingest service for receiving events from AI stacks
- Add Grafana dashboard with stack_name filtering
- Update Dokploy client with setApplicationEnv method
- Configure STACK_NAME env var for deployed stacks
- Add alerting rules for stack health monitoring
This commit is contained in:
Oussama Douhou
2026-01-10 13:22:46 +01:00
parent e617114310
commit 2f4722acd0
16 changed files with 1631 additions and 0 deletions

View File

@@ -388,6 +388,16 @@ export class DokployProductionClient {
);
}
async setApplicationEnv(applicationId: string, env: string): Promise<void> {
await this.request(
'POST',
'/application.update',
{ applicationId, env },
'application',
'set-env'
);
}
async getApplication(applicationId: string): Promise<DokployApplication> {
return this.request<DokployApplication>(
'GET',

View File

@@ -149,6 +149,20 @@ export class DokployClient {
} satisfies CreateDomainRequest);
}
async setApplicationEnv(applicationId: string, env: string): Promise<void> {
await this.request('POST', '/application.update', {
applicationId,
env
});
}
async addApplicationLabel(applicationId: string, key: string, value: string): Promise<void> {
await this.request('POST', '/application.update', {
applicationId,
dockerLabels: `${key}=${value}`
});
}
async deployApplication(applicationId: string): Promise<void> {
await this.request('POST', '/application.deploy', { applicationId });
}

View File

@@ -280,6 +280,18 @@ export class ProductionDeployer {
registryId: config.registryId,
});
state.progress = 52;
state.message = 'Setting environment variables for logging';
const envVars = [
`STACK_NAME=${config.stackName}`,
`USAGE_LOGGING_ENABLED=true`,
`LOG_INGEST_URL=${process.env.LOG_INGEST_URL || 'http://10.100.0.20:3102/ingest'}`,
`METRICS_PORT=9090`,
].join('\n');
await this.client.setApplicationEnv(state.resources.applicationId, envVars);
state.progress = 55;
state.message = 'Creating persistent storage';