Material.EBDeployer.DeployLogic.ElasticBeanstalkDeployer.DeploySingleSiteDockerApplicationSingleAzAsync C# (CSharp) Méthode

DeploySingleSiteDockerApplicationSingleAzAsync() public méthode

public DeploySingleSiteDockerApplicationSingleAzAsync ( ) : System.Threading.Tasks.Task
Résultat System.Threading.Tasks.Task
        public async Task DeploySingleSiteDockerApplicationSingleAzAsync()
        {
            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.SingleAzConfigurationOptionSettingsAsync());
            
            await elasticBeanstalkService.SingleSiteDockerApplicationEnsureSetupAsync(configurationOptionSettings);

            var currentRoute53Url = await route53Service.GetCurrentEnvSubdomainUrlAsync(elasticBeanstalkService.CurrentCNamePrefix);
            loggerProvider.GetLogger().Debug($"Verified Route53 DNS entries. [Current Url: {currentRoute53Url}]");
            
            await elasticBeanstalkService.UpdateEnvironmentAsync(Environment.Current);

            //Adding delay to allow service to spin up
            await Task.Delay(FIVE_SECONDS);

            loggerProvider.GetLogger().Debug("Deploy finished");
        }

Usage Example

        static void Main(string[] args)
        {
            var configurationProvider = Configuration.Configure<ElasticBeanstalkDeploymentConfigurationProvider>()
                .CreateAndBind(args);
            Log.Logger = SerilogColoredConsoleConfiguration
                .InitializeColoredConsoleLogger(configurationProvider)
                .ForContext(SerilogTemplateConfiguration.CorrelationIdName, Guid.NewGuid().ToString("N"));
            var loggerProvider = new LoggerProvider();
            var elasticBeanstalkService = new ElasticBeanstalkService(configurationProvider, loggerProvider);
            var s3Service = new S3Service(configurationProvider, loggerProvider);
            var ec2Service = new Ec2Service(configurationProvider, loggerProvider);
            var iamService = new IdentityManagementService(configurationProvider, loggerProvider);
            var smokeTestService = new SmokeTestService(configurationProvider, loggerProvider);
            var route53Service = new Route53Service(configurationProvider, loggerProvider);
            var configurationOptionSettingsProvider = new ConfigurationOptionSettingsProvider(loggerProvider,
                ec2Service,
                configurationProvider);
            var sslUploaderService = new SslUploaderService(configurationProvider, loggerProvider);
            var cloudfrontService = new CloudFrontService(configurationProvider, loggerProvider);
            var ebDeployer = new ElasticBeanstalkDeployer(configurationProvider,
                elasticBeanstalkService,
                s3Service,
                smokeTestService,
                iamService,
                configurationOptionSettingsProvider,
                route53Service,
                sslUploaderService,
                cloudfrontService,
                loggerProvider);

            ebDeployer.DeploySingleSiteDockerApplicationSingleAzAsync().Wait();
        }