Created
January 19, 2019 22:24
-
-
Save gbaeke/30ae42dd10836881e7d5410743e4897c to your computer and use it in GitHub Desktop.
Deploy storage account, share, container group with Pulumi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const pulumi = require("@pulumi/pulumi"); | |
const azure = require("@pulumi/azure"); | |
// Create an Azure Resource Group | |
const resourceGroup = new azure.core.ResourceGroup("resourceGroup", { | |
location: "WestEurope", | |
name: "aci-rg", | |
}); | |
const storage = new azure.storage.Account("gortstorage", { | |
accountReplicationType: "LRS", | |
resourceGroupName: resourceGroup.name, | |
accountTier: "Standard", | |
location: resourceGroup.location, | |
}); | |
const share = new azure.storage.Share("go-realtime-cert", { | |
storageAccountName: storage.name, | |
resourceGroupName: resourceGroup.name, | |
}); | |
// Create container group | |
const containerGroup = new azure.containerservice.Group("go-realtime", { | |
location: resourceGroup.location, | |
resourceGroupName: resourceGroup.name, | |
ipAddressType: "public", | |
osType: "linux", | |
dnsNameLabel: "realtime-go-app", | |
containers: [ | |
{ | |
name: "redis", | |
image: "redis", | |
cpu: 0.4, | |
memory: 0.2, | |
port: 6379, | |
}, | |
{ | |
name: "realtime-go", | |
image: "gbaeke/realtime-go-le", | |
cpu: 0.1, | |
memory: 0.2, | |
port: 443, | |
environmentVariables: { | |
"RTHOST": "YOUR_HOSTNAME", | |
"CLOUDFLARE_EMAIL": "YOUR_EMAIL", | |
"CLOUDFLARE_API_KEY": "YOUR_API_KEY" | |
}, | |
volumes: [ | |
{ | |
mountPath: "/.local/share/certmagic", | |
name: "azshare", | |
readOnly: false, | |
shareName: share.name, | |
storageAccountKey: storage.primaryAccessKey, | |
storageAccountName: storage.name | |
} | |
] | |
} | |
] | |
}) | |
// Export the connection string for the storage account | |
exports.containerGroupIP = containerGroup.ipAddress; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment