Dmk
Xamal - Deploy Elixir releases to bare metal servers via SSH
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/kamal: Deploy web apps anywhere. · GitHub (Basecamp’s Docker deployment tool), but replaces Docker containers with Elixir releases and kamal-proxy with Caddy.
If you’ve used Kamal, the workflow is the same - same YAML config structure, same CLI commands, same hook system and secrets management. The key differences:
- Elixir releases instead of Docker containers - built with mix release, distributed as tarballs
- Caddy instead of kamal-proxy - automatic TLS via Let’s Encrypt, zero-downtime blue-green deploys via port switching
- Erlang SSH instead of shelling out to ssh - uses the :ssh stdlib with connection pooling
- Escript CLI - single binary, no Ruby or Docker required on the deploying machine
Install
curl -fsSL https://raw.githubusercontent.com/dmkenney/xamal/master/install.sh | bash
Or build from source with mix escript.build. Requires Erlang/OTP 26+ on the machine running xamal.
Quick start
xamal init # generates config/deploy.yml and sample hooks
xamal setup # bootstraps servers and deploys
xamal deploy # subsequent deploys
xamal rollback # roll back to previous version
Links
Most Liked
Dmk
Update: Xamal is now Mix-first (no more stand-alone CLI)
Big one. @dannote (Danila Poyarkov) put together a substantial PR that reworked Xamal from a standalone escript CLI into idiomatic Mix tasks. mix xamal.* is now the command surface, config moved from YAML/EEx to native Elixir config, and there’s an explicit Xamal.Context{} passed through instead of process-global state. It fits a normal Elixir project much more naturally now.
Huge thanks Danila - I like this approach much better!
Since then (all in the last few hours) I’ve cleaned things up on top: 0.3.1 is on Hex with CI/release sorted, plus a handful of fixes ~ expansion in SSH key paths, interactive SSH sessions, and CLI flag parsing.
Hex: xamal | Hex
Repo: GitHub - dmkenney/xamal: Deploy Elixir apps to bare metal servers. Like Kamal, but with native releases + Caddy instead of Docker. · GitHub
PR: Make Xamal Mix-first and Elixir-config driven by dannote · Pull Request #4 · dmkenney/xamal · GitHub
Dmk
It was two-fold.
- First it just seemed like an extra unnecessary layer - which it is, but admittedly does have some nice benefits probably why it was on my todo list for so long.
- One of my applications needs ffmpeg which roughly tripled the Docker image size. Not the end of the world, but it just bothered me a bit. I did try to install ffmpeg on the underlying OS and shell out from the application running inside Docker to it (so it wasn’t included in the image), but couldn’t get it to work.
So mostly just an itch I had for a while to simplify things since we really don’t need Docker with Elixir.
rhcarvalho
Thanks for sharing!
Just like they made a custom proxy that understands their needs (Rails), I can see a world where a custom proxy (or an off the shelve proxy configured appropriately) that understands the BEAM, Phoenix and LiveView could be beneficial.
Popular in Announcing
Other popular topics
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
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









