feat: deploy all stacks to shared ai-stack-portal project

- Add SHARED_PROJECT_ID and SHARED_ENVIRONMENT_ID env vars
- Add findApplicationByName to Dokploy client for app-based lookup
- Update production-deployer to use shared project instead of creating new ones
- Update name availability check to query apps in shared environment
- Update delete endpoint to remove apps from shared project
- Rollback no longer deletes shared project (only app/domain)
- Backward compatible: falls back to per-project if env vars not set
This commit is contained in:
Oussama Douhou
2026-01-11 01:05:14 +01:00
parent 4750db265d
commit 21161c6554
4 changed files with 118 additions and 41 deletions

View File

@@ -408,6 +408,22 @@ export class DokployProductionClient {
);
}
async getApplicationsByEnvironmentId(environmentId: string): Promise<DokployApplication[]> {
const env = await this.request<{ applications: DokployApplication[] }>(
'GET',
`/environment.one?environmentId=${environmentId}`,
undefined,
'environment',
'get-apps'
);
return env.applications || [];
}
async findApplicationByName(environmentId: string, name: string): Promise<DokployApplication | null> {
const apps = await this.getApplicationsByEnvironmentId(environmentId);
return apps.find(a => a.name === name) || null;
}
async createDomain(
host: string,
applicationId: string,