fix(core.gbapp): Boot process fully tested.

This commit is contained in:
Rodrigo Rodriguez 2021-04-22 12:12:05 -03:00
parent 657dd0b849
commit a6d1f90bbf
3 changed files with 51 additions and 32 deletions

View file

@ -170,7 +170,7 @@ export class GBAdminService implements IGBAdminService {
} }
public static isSharePointPath(path: string) { public static isSharePointPath(path: string) {
return path.indexOf('sharepoint.com') > 0; return path.indexOf('sharepoint.com') !== -1;
} }
public static async deployPackageCommand(min: GBMinInstance, text: string, deployer: IGBDeployer) { public static async deployPackageCommand(min: GBMinInstance, text: string, deployer: IGBDeployer) {
const packageName = text.split(' ')[1]; const packageName = text.split(' ')[1];

View file

@ -853,36 +853,55 @@ export class AzureDeployerService implements IGBInstallationDeployer {
} }
private async createServer(farmId, group, name, location) { private async createServer(farmId, group, name, location) {
const parameters: Site = {
location: location,
serverFarmId: farmId,
siteConfig: { let tryed = false;
nodeVersion: GBAdminService.getNodeVersion(), const create = async () => {
detailedErrorLoggingEnabled: true,
requestTracingEnabled: true const parameters: Site = {
location: location,
serverFarmId: farmId,
siteConfig: {
nodeVersion: GBAdminService.getNodeVersion(),
detailedErrorLoggingEnabled: true,
requestTracingEnabled: true
}
};
const server = await this.webSiteClient.webApps.createOrUpdate(group, name, parameters);
const siteLogsConfig: SiteLogsConfig = {
applicationLogs: {
fileSystem: { level: 'Error' }
}
};
await this.webSiteClient.webApps.updateDiagnosticLogsConfig(group, name, siteLogsConfig);
const souceControlConfig: SiteSourceControl = {
repoUrl: 'https://github.com/GeneralBots/BotServer.git',
branch: 'master',
isManualIntegration: true,
isMercurial: false,
deploymentRollbackEnabled: false
};
await this.webSiteClient.webApps.createOrUpdateSourceControl(group, name, souceControlConfig);
return server;
};
try {
return await create();
} catch (e) {
if (!tryed) {
tryed = true;
GBLog.info('Retrying Deploying Bot Server...');
try {
return await create();
} catch (error) {
GBLog.info('Server creation failed at all on MSAzure, stopping...');
throw error;
}
} }
}; }
const server = await this.webSiteClient.webApps.createOrUpdate(group, name, parameters);
const siteLogsConfig: SiteLogsConfig = {
applicationLogs: {
fileSystem: { level: 'Error' }
}
};
await this.webSiteClient.webApps.updateDiagnosticLogsConfig(group, name, siteLogsConfig);
const souceControlConfig: SiteSourceControl = {
repoUrl: 'https://github.com/GeneralBots/BotServer.git',
branch: 'master',
isManualIntegration: true,
isMercurial: false,
deploymentRollbackEnabled: false
};
await this.webSiteClient.webApps.createOrUpdateSourceControl(group, name, souceControlConfig);
return server;
} }
private async updateWebisteConfig(group, name, serverFarmId, instance: IGBInstance) { private async updateWebisteConfig(group, name, serverFarmId, instance: IGBInstance) {

View file

@ -635,7 +635,7 @@ export class GBMinService {
// If there is WhatsApp configuration specified, initialize // If there is WhatsApp configuration specified, initialize
// infrastructure objects. // infrastructure objects.
if (min.instance.whatsappServiceUrl !== null) { if (min.instance.whatsappServiceUrl) {
min.whatsAppDirectLine = new WhatsappDirectLine( min.whatsAppDirectLine = new WhatsappDirectLine(
min, min,
min.botId, min.botId,