Elixir on Microsoft Azure

I’m wondering if anyone has experience in deploying Elixir apps (Phoenix apps or otherwise) to Microsoft Azure. If so, I would love to hear about your experience.

The company where I work is heavily invested in Azure from before, so I’m trying to determine whether it would be a viable option for Elixir apps as well.

Here are some of the types of questions I have in mind:

  • How did your setup look like?
  • Did you use Azure Container Instances or Azure Virtual Machines?
  • Did you deploy to a single node or multiple nodes?
    • If multiple nodes: Did you have any issues connecting them?
  • Were you using some kind of containers and orchestration, e.g. Docker and Kubernetes?
  • Does Azure play well with BEAM instrumentation and debugging tools?
    • Is it possible to attach to an Azure environment with Erlang’s remote shell?
  • Did you experience any significant difficulties?
  • Are there any noteworthy caveats or drawbacks?

Any input on such topics would be greatly appreciated.

7 Likes

(full disclosure: I work for Microsoft, and love Elixir :slight_smile:)

Hi,

I haven’t yet spent too much time on the actual runtime side of Elixir on Azure. One thing I did was to run a Distillery with multi-stage docker, then push the resulting image to Azure Web Apps (with Linux). Also Azure Kubernetes Service (AKS) is an obvious solution. When it comes to running an Erlang Cluster in a virtual network, there are no reasons why it should not be possible…

Regarding your question on whether Azure plays well with BEAM instrumentation, I would guess all BEAM things would be independent of or orthogonal to Azure?

As for the Elixir application side of things, I started to build libraries to interact with various Azure APIs:

Feel free to ping me via mail (chgeuer@microsoft)…

13 Likes

:wave:

How did your setup look like?

Terraform with its state stored on s3 (could be azure’s alternative), distillery with docker to build releases (on CI) and upload them to s3 (could be azure’s alternative), epmdless distribution over azure’s vpn (might later move to partisan).

Did you use Azure Container Instances or Azure Virtual Machines?

Azure Virtual Machines (mostly the spot instances)

Did you deploy to a single node or multiple nodes?

Multiple. No issues.

Were you using some kind of containers and orchestration, e.g. Docker and Kubernetes?

No, but we used some bash scripts though which would download the releases from s3 and then enable and start the apps via systemd.

Does Azure play well with BEAM instrumentation and debugging tools?

Since it’s just a linux instance, it works as any other linux instance (which is ok).

Did you experience any significant difficulties?

It would be a bit too expensive for us if it wasn’t for the spot instances.

3 Likes

Jackpot! :laughing:

I’m not knowledgeable enough about the inner workings of the BEAM and surrounding tooling to answer that question. Based on what I’ve read and heard in various Elixir podcasts, some hosting services and cloud services impose certain restrictions, but I don’t know all of the details.

Thank you for taking the time to respond and sharing your work! This is very useful. :purple_heart:

Hello @chgeuer how would you do this today? especially with releases introduced. I would love to know how you deploy docker images to Azure Web Apps, connect to a Postgres database on Azure, run migrations and seed the database.

3 Likes

I am also interested in your experiences @chgeuer . Automating it using Terraform would also be interesting I think… do you take this route?

Hi @dumadi, once your Elixir app is in a Docker image, you can host it (like any other workload) in Azure App Services, Azure Kubernetes Services or Azure Container Apps. When connecting to PostgreSQL on Azure, you just have to ensure that your workload uses TLS to connect to the PostgreSQL database.

@hoetmaaiers, apologies, not clear what the Q is. Terraform is kind-of the outer part. From an Elixir perspective, I guess the Azure-specific Qs are how can an Elixir workload talk to platform-specific services. Whether you deploy an Elixir workload to Azure using Bicep, ARM, Terraform, Pulumi or something seems not the big concern to me?

1 Like