Пример #1
0
        /// <summary>
        /// create a cosmos db instance for the message store
        /// </summary>
        private Pulumi.Azure.CosmosDB.Account MappingServiceCosmosDb(string prefix)
        {
            var cosmosAccount = new Pulumi.Azure.CosmosDB.Account($"{prefix}mapping-service",
                                                                  new Pulumi.Azure.CosmosDB.AccountArgs()
            {
                ResourceGroupName = _resourceGroup.Name,
                GeoLocations      = new InputList <AccountGeoLocationArgs>()
                {
                    new AccountGeoLocationArgs()
                    {
                        Location         = _resourceGroup.Location,
                        FailoverPriority = 0
                    },
                    new AccountGeoLocationArgs()
                    {
                        Location         = "Australia Southeast",
                        FailoverPriority = 1
                    }
                },
                ConsistencyPolicy = new AccountConsistencyPolicyArgs()
                {
                    ConsistencyLevel     = "Session",
                    MaxStalenessPrefix   = 100,
                    MaxIntervalInSeconds = 5
                },
                OfferType = "Standard",
                EnableAutomaticFailover = false
            });

            var mappingDb = new Pulumi.Azure.CosmosDB.SqlDatabase("mapping-service", new Pulumi.Azure.CosmosDB.SqlDatabaseArgs()
            {
                Name = "mapping-service",
                ResourceGroupName = _resourceGroup.Name,
                AccountName       = cosmosAccount.Name,
                Throughput        = 400
            });

            var mappingContainer = new Pulumi.Azure.CosmosDB.SqlContainer("mappings", new SqlContainerArgs()
            {
                ResourceGroupName = _resourceGroup.Name,
                AccountName       = cosmosAccount.Name,
                DatabaseName      = mappingDb.Name,
                PartitionKeyPath  = "/id",
                Throughput        = 400
            });

            return(cosmosAccount);
        }
Пример #2
0
        private AppService AdminPortal(string prefix, InputMap <string> commonAppSettings, Pulumi.Azure.CosmosDB.Account messageStoreCosmosAccount)
        {
            var registry = new Pulumi.Azure.ContainerService.Registry($"{prefix}magicbusregistry", new RegistryArgs()
            {
                ResourceGroupName = _resourceGroup.Name,
                Sku          = "Basic",
                AdminEnabled = true
            });

            var dockerImage = new Pulumi.Docker.Image("adminportal", new ImageArgs()
            {
                ImageName = Output.Format($"{registry.LoginServer}/adminportal:latest"),
                Build     = new DockerBuild()
                {
                    Context = "../",
                },
                Registry = new ImageRegistry()
                {
                    Server   = registry.LoginServer,
                    Username = registry.AdminUsername,
                    Password = registry.AdminPassword
                }
            });
            var appServicePlan = new Plan("admin-portal-plan", new PlanArgs()
            {
                ResourceGroupName = _resourceGroup.Name,
                Location          = "australiasoutheast",
                Kind     = "linux",
                Reserved = true,
                Sku      = new PlanSkuArgs()
                {
                    Tier     = "Basic",
                    Size     = "B1",
                    Capacity = 1
                }
            });
            var app = new AppService("magic-bus-admin-portal", new AppServiceArgs()
            {
                ResourceGroupName = _resourceGroup.Name,
                AppServicePlanId  = appServicePlan.Id,
                Location          = "australiasoutheast",
                AppSettings       = InputMap <string> .Merge(commonAppSettings, new InputMap <string>()
                {
                    { "WEBSITES_ENABLE_APP_SERVICE_STORAGE", "false" },
                    { "DOCKER_REGISTRY_SERVER_URL", Output.Format($"https://{registry.LoginServer}") },
                    { "DOCKER_REGISTRY_SERVER_USERNAME", registry.AdminUsername },
                    { "DOCKER_REGISTRY_SERVER_PASSWORD", registry.AdminPassword },
                    { "WEBSITES_PORT", "80,443" },
                    { "CosmosDbEndpoint", messageStoreCosmosAccount.Endpoint },
                    { "CosmosDbAuthKey", messageStoreCosmosAccount.PrimaryMasterKey }
                }),
                SiteConfig = new AppServiceSiteConfigArgs()
                {
                    AlwaysOn       = true,
                    LinuxFxVersion = Output.Format($"DOCKER|{dockerImage.ImageName}")
                },
                HttpsOnly = true
            });

            return(app);
        }