https://pulumi.com logo
#general
Title
# general
f

full-dress-10026

05/16/2019, 7:52 PM
Are there any examples on using Azure's App Service to deploy a Docker container? i.e. https://docs.microsoft.com/en-us/azure/app-service/containers/tutorial-custom-docker-image. I'm finding it quite difficult to map the instructions in the Azure docs to what I'd write in Pulumi.
w

white-balloon-205

05/16/2019, 8:05 PM
Cc @tall-librarian-49374 who may have looked at this?
f

full-dress-10026

05/16/2019, 8:13 PM
I can kinda use the TF example https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/examples/app-service/docker-basic/main.tf. It's really unclear what's going on though. And how do you do all the usual configure ports, load balancers, etc.
c

colossal-room-15708

05/16/2019, 8:17 PM
I'm going to write one on the weekend. My company's website runs on app services inside a docker container. If it's not too urgent, let me see how far I get.
f

full-dress-10026

05/16/2019, 8:21 PM
@colossal-room-15708 That'd be fantastic! Using Azure + Pulumi has been quite painful so far, especially compared to AWS. I've found the console UI does not match up with the parameters Pulumi expects. Any direction on how to deploy a Docker container that exposes port 8080 and visit that in the browser?
I have this but I cannot connect to the Azure website:
Copy code
const appPlan = new azure.appservice.Plan("fib-plan", {
    resourceGroupName: resourceGroup.name,
    kind: "Linux",
    name: stackName,
    sku: {
        size: "S1",
        tier: "Standard",
        capacity: 1
    },
});

const fibApp = new azure.appservice.AppService("fib-app-service", {
    name: stackName,
    resourceGroupName: resourceGroup.name,
    appServicePlanId: appPlan.id,
    appSettings: {
        WEBSITES_PORT: 8080
    },
    siteConfig: {
        linuxFxVersion: `DOCKER|${fibImage.imageName}`
    }
});
c

colossal-room-15708

05/16/2019, 8:23 PM
I have a 4hr customer workshop this morning (it's Friday 6:30am here). I'll take a look after that. However, I have traffic manager and app gateway in front of my app service.
Oh, I will also likely use nodejs, if that's okay.
f

full-dress-10026

05/16/2019, 8:34 PM
For Pulumi? Yes.
👍 1
The main problem I'm running into is in this step: https://docs.microsoft.com/en-us/azure/app-service/containers/quickstart-docker-go#create-a-web-app The doc says to run this command:
Copy code
az webapp create --resource-group myResourceGroup --plan myAppServicePlan --name <app name> --deployment-container-image-name microsoft/azure-appservices-go-quickstart
There does not appear to be a way to pass
--deployment-container-image-name
to Pulumi.
c

colossal-room-15708

05/16/2019, 9:05 PM
On the bus now. I wouldn't rely on portal or CLI parameters. Always check what the API wants.
f

full-dress-10026

05/16/2019, 9:05 PM
How do you check that?
REST API reference?
After following the instructions in that doc via the CLI, I can see in the console that an app was created that has the Type
app,linux,container
. My Pulumi written app has the type
app
. Not sure how to get the correct Type.
I diff'ed the output of
az webapp config show
for the example web service and the Pulumi created one and there is nothing significant. There must be some magic happening elsewhere.
Wowza. So apparently in order to create a Linux container app you need to set the property
reserved = true
in your app plan. Nowhere in the docs does it say this.
t

tall-librarian-49374

05/17/2019, 6:21 AM
It seems to be a common ask, see this issue for example https://github.com/pulumi/pulumi-azure/issues/228#issuecomment-489318488
Could you add a comment to it with your scenario? We'll take it and make a new example.
f

few-dog-41530

05/17/2019, 10:49 AM
Is the pattern with pulumi to include the deployment script in each app repo?
f

full-dress-10026

05/17/2019, 3:18 PM
@tall-librarian-49374 Sure - added a comment with the code I ended up with.
c

colossal-room-15708

05/19/2019, 5:47 AM
@full-dress-10026 check the TF doco, there it mentions the
reserved
bit https://www.terraform.io/docs/providers/azurerm/r/app_service_plan.html#kind
2 Views