acrolink
Deployment of Phoenix applications to AWS Elastic Beanstalk
Is there any specialized packages or official documentation addressing deployment to AWS Elastic Beanstalk ? Possibly also using also AWS CodePipeline to build from a GitHub repository branch.
What is the best way to do that?
Thank you ![]()
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated!
To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead.
Sta...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #performance










First 10 of 21 Posts
arcyfelix
I would probably suggest Kubernetes.
You can setup a pipeline that will push your Docker build to building pipeline (I don’t know the name for AWS as I use GCP) and then roll out to all pods.
Clustering is quite easy this way as well.
acrolink
Thank you. As for Kubernetes, is they any packages or official documentation on this topic?
I don’t have to use AWS Elastic Beanstalk. I can possibly use Kubernetes on another hosting provider. What I am looking for is auto scaling based on load (web application).
arcyfelix
Just a few sources:
https://medium.com/@chargio/creating-a-simple-elixir-phoenix-application-to-deploy-in-kubernetes-2eff2c8e367c
Blond11516
I don’t know of any official documentation specifically for Elixir, but I’d use Docker to deploy on Beanstalk. You can use the
mix phx.gen.release --dockertask to generate a suitable Dockerfile and then follow the official AWS documentation to deploy a Docker image to beanstalk. I’m sure AWS also has docs and guides to automate this with CodePipeline.acrolink
@Blond11516 thank you! One more minor question, how do you deploy and redeploy code changes? Do you do a
git pullinsideDockerfile?Blond11516
No, that’s not really how Docker containers work. The basic idea is that you, as the application developer, write a
Dockerfilewhich describes how to build, configure and start your application. You then use this Dockerfile to build a Docker image (through thedocker buildcommand). This image is a bit like a small virtual machine with your application and its dependencies baked in. Finally, you push your image to some repository and ask your cloud provider to deploy this image to a server.The goal behind this is that images provide a reproducible deployment environment that is built from scratch every time. This means you can take your image and deploy it as many times as you want, on any server you want from any provider you want and it should work the same every single time. This is in contradiction to VPS-based deployments, where you have a single server that you configure manually and push updates to, which often ends up with the server holding all sorts of hidden dependencies and configurations that can be extremely hard to reproduce if you ever need to migrate or scale to another server.
Now, because we want reproducible builds from scratch, updating the application usually means building a whole new image with our updated code and deploying that new image to replace the old one. The exact way to do this will depend on the service you’re using to host your app.
With all that said, I’d recommend you avoid deploying to AWS if you can. AWS is a very complex system that’s more tailored to bigger teams or experienced developers who want fine-grained control over their infrastructure. Because of that, their documentation is honestly pretty hard to follow if you don’t already kind of know what you’re doing.
I’d recommend looking at smaller infrastructure providers with more focused and beginner-friendly offerings. fly.io is very popular in the elixir community for very good reason imo. They have a dedicated guide for Elixir (although the deployment process is basically the same as with any other stack) and it lets you deploy and update an app with just a couple of commands.
acrolink
Thank you. I have spent some time in the meantime to learn more about Docker. Actually I have deployed my first small application using Docker on a Kubernetes cluster on Linode! Looks great. Seems that it is easier and cheaper to do that using Linode. I will surely check out your suggestions. What is important for me is the auto scaling features of either Kubernetes or AWS Elastic Beanstalk,
thiagomajesk
Deploying to Elastic Beanstalk is fairly easy (probably the easiest method to deploy something on AWS). As mentioned previously; you can have a Docker image set up and do the rest from the CLI. You can also run the Beanstalk CLI to trigger the build (like you would do from your machine) from your CI on code changes (after a PR gets merged, etc).
However, I must say that If you are going the Elastic Beanstalk route be aware that you are in for a world of pain™️ if you have to deal with distribution down the line - at least if you intend to use any of the standard libcluster strategies (IIRC, EB does not support exposing multiple ports when you use Docker).
Also, If you are using automatic autoscaling and you have shared state for stuff like authentication (using ETS for instance), you might get all sorts of problems because the autoscaled instances are not aware of each other.
PS.: I think the DNS cluster strategy or the Postgres cluster strategy could help with that, but I honestly haven’t tested it on EB yet.
acrolink
Thank you. How would you deal with that ? Simply using Kubernetes instead of AWS Elastic Beanstalk?
thiagomajesk
I advise you to try creating a cluster with the new strategies for autoscaled instances (links in my previous reply) and see if that is going to work. If everything works, keep using EB; it’s a lot less work than setting up K8s overall (I mean if you don’t need to).