From 5f0fb3bc3eca3b97d75d6c360a769b13ae1f9434 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Mon, 27 May 2019 13:52:10 -0300 Subject: [PATCH] fix(core.gbapp): Self-replication on Azure --- .../services/AzureDeployerService.ts | 25 ++++++++----------- src/app.ts | 2 +- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts index 2f4cdde3..1d600cbc 100644 --- a/packages/azuredeployer.gbapp/services/AzureDeployerService.ts +++ b/packages/azuredeployer.gbapp/services/AzureDeployerService.ts @@ -404,18 +404,9 @@ export class AzureDeployerService implements IGBInstallationDeployer { instance.botEndpoint = this.defaultEndPoint; instance = await this.internalDeployBot( - instance, - this.accessToken, - name, - name, - name, - 'General BootBot', - `${proxyAddress}/api/messages/${name}`, - 'global', - instance.nlpAppId, - instance.nlpKey, - instance.marketplaceId, - instance.marketplacePassword, + instance, this.accessToken, name, name, name, 'General BootBot', + `${proxyAddress}/api/messages/${name}`, 'global', + instance.nlpAppId, instance.nlpKey, instance.marketplaceId, instance.marketplacePassword, instance.cloudSubscriptionId ); @@ -424,6 +415,10 @@ export class AzureDeployerService implements IGBInstallationDeployer { spinner.stop(); + GBLog.info('Opening your browser with default.gbui...'); + const opn = require('opn'); + opn(`https://${serverName}.azurewebsites.net`); + return instance; } @@ -451,7 +446,7 @@ export class AzureDeployerService implements IGBInstallationDeployer { const credentials = await GBAdminService.getADALCredentialsFromUsername(username, password); // tslint:disable-next-line:no-http-string - const url = `http://${instance.botId}.azurewebsites.net`; + const url = `https://${instance.botId}.azurewebsites.net`; this.deployFarm(url, instance, credentials, subscriptionId); } @@ -713,7 +708,6 @@ export class AzureDeployerService implements IGBInstallationDeployer { }; await this.webSiteClient.webApps.createOrUpdateSourceControl(group, name, souceControlConfig); - // await this.webSiteClient.webApps.syncRepository(name, name); return server; } @@ -725,10 +719,11 @@ export class AzureDeployerService implements IGBInstallationDeployer { serverFarmId: serverFarmId, siteConfig: { appSettings: [ - { name: 'WEBSITES_CONTAINER_START_TIME_LIMIT', value: webSiteResponseTimeout }, + { name: 'WEBSITES_CONTAINER_START_TIME_LIMIT', value: WebSiteResponseTimeout }, { name: 'WEBSITE_NODE_DEFAULT_VERSION', value: GBAdminService.getNodeVersion() }, { name: 'ADDITIONAL_DEPLOY_PATH', value: `` }, { name: 'ADMIN_PASS', value: `${instance.adminPass}` }, + { name: 'BOT_ID', value: `${instance.botId}` }, { name: 'CLOUD_SUBSCRIPTIONID', value: `${instance.cloudSubscriptionId}` }, { name: 'CLOUD_LOCATION', value: `${instance.cloudLocation}` }, { name: 'CLOUD_GROUP', value: `${instance.botId}` }, diff --git a/src/app.ts b/src/app.ts index 2f826991..a661e1b3 100644 --- a/src/app.ts +++ b/src/app.ts @@ -99,7 +99,7 @@ export class GBServer { GBLog.info(`Establishing a development local proxy (ngrok)...`); GBServer.globals.publicAddress = await core.ensureProxy(port); } else { - const serverAddress = `http://${process.env.WEBSITE_SITE_NAME}.azurewebsites.net`; + const serverAddress = `https://${process.env.WEBSITE_SITE_NAME}.azurewebsites.net`; GBLog.info(`Defining server address at ${serverAddress}...`); GBServer.globals.publicAddress = serverAddress; }