fix(core.gbapp): Boot process fully tested.
This commit is contained in:
parent
657dd0b849
commit
a6d1f90bbf
3 changed files with 51 additions and 32 deletions
|
@ -170,7 +170,7 @@ export class GBAdminService implements IGBAdminService {
|
|||
}
|
||||
|
||||
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) {
|
||||
const packageName = text.split(' ')[1];
|
||||
|
@ -192,7 +192,7 @@ export class GBAdminService implements IGBAdminService {
|
|||
// .gbot packages are handled using storage API, so no download
|
||||
// of local resources is required.
|
||||
|
||||
await deployer['downloadFolder'](min,
|
||||
await deployer['downloadFolder'](min,
|
||||
Path.join('work', `${min.instance.botId}.gbai`),
|
||||
Path.basename(folderName));
|
||||
await deployer.deployPackage(min, localFolder);
|
||||
|
|
|
@ -435,7 +435,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
|||
instance.nlpEndpoint = nlp.endpoint;
|
||||
instance.nlpKey = keys.key1;
|
||||
instance.nlpAppId = nlpAppId;
|
||||
|
||||
|
||||
GBLog.info(`Deploying Bot...`);
|
||||
instance.botEndpoint = this.defaultEndPoint;
|
||||
|
||||
|
@ -853,36 +853,55 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
|||
}
|
||||
|
||||
private async createServer(farmId, group, name, location) {
|
||||
const parameters: Site = {
|
||||
location: location,
|
||||
serverFarmId: farmId,
|
||||
|
||||
siteConfig: {
|
||||
nodeVersion: GBAdminService.getNodeVersion(),
|
||||
detailedErrorLoggingEnabled: true,
|
||||
requestTracingEnabled: true
|
||||
let tryed = false;
|
||||
const create = async () => {
|
||||
|
||||
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) {
|
||||
|
|
|
@ -635,7 +635,7 @@ export class GBMinService {
|
|||
// If there is WhatsApp configuration specified, initialize
|
||||
// infrastructure objects.
|
||||
|
||||
if (min.instance.whatsappServiceUrl !== null) {
|
||||
if (min.instance.whatsappServiceUrl) {
|
||||
min.whatsAppDirectLine = new WhatsappDirectLine(
|
||||
min,
|
||||
min.botId,
|
||||
|
|
Loading…
Add table
Reference in a new issue