public async Task DeployDockerApplicationMultiAzAsync()
{
loggerProvider.GetLogger().Debug("Beginning deploy");
if (configurationProvider.EnableHttps == "true")
{
configurationProvider.SslCertificatePath = await sslUploaderService.GetSslCertArnPathAsync();
}
await s3Service.EnsureBucketExistsAsync();
await s3Service.CopyApplicationToBucketAsync(configurationProvider.PackagePath);
await iamService.EnsureEc2ServiceRoleExistsAsync(configurationProvider.ExcuteApiUriForPolicy);
await elasticBeanstalkService.EnsureTerminationsCompleteAsync();
await elasticBeanstalkService.PurgeOldApplicationVersionsAsync();
await CreateOrUpdateApplicationAsync();
loggerProvider.GetLogger().Debug("Constructing list of Configuration Option Settings");
var configurationOptionSettings = new List<ConfigurationOptionSetting>();
configurationOptionSettings.AddRange(await configurationOptionSettingsProvider.MultiAzConfigurationOptionSettingsForNodeAsync());
configurationOptionSettings.AddRange(GetElbConfigurationOptionSettings());
await elasticBeanstalkService.DockerEnsureInitialEnvironmentSetupAsync(configurationOptionSettings);
var route53Urls = await route53Service.GetSubdomainUrlAsync(elasticBeanstalkService.CurrentCNamePrefix, elasticBeanstalkService.NextCNamePrefix);
loggerProvider.GetLogger().Debug($"Verified Route53 DNS entries. [Current Url: {route53Urls.CurrentEnvUrl}] [Next Url: {route53Urls.NextEnvUrl}]");
var currentBeanstalkEnvUrl = route53Urls.CurrentEnvUrl;
var newTestUri = route53Urls.NextEnvUrl;
if (!string.IsNullOrWhiteSpace(newTestUri))
{
var oldTestUri = configurationProvider.TestUri;
configurationProvider.TestUri = newTestUri;
loggerProvider.GetLogger().Debug($"Changing TestUri. [NewValue: {configurationProvider.TestUri}] [OldValue: {oldTestUri}]");
}
await elasticBeanstalkService.UpdateEnvironmentAsync(Environment.Next, GetElbConfigurationOptionSettings());
if (!string.IsNullOrWhiteSpace(configurationProvider.BinaryRouteConfigurationFilePath))
{
await cloudfrontService.MapBinaryRoutesInCloudFrontAsync(currentBeanstalkEnvUrl, configurationProvider.Subdomain, configurationProvider.DeploymentEnvironmentName);
}
//Adding delay to allow service to spin up
await Task.Delay(FIVE_SECONDS);
smokeTestService.RunTests();
loggerProvider.GetLogger().Debug("Deploy finished");
}