Dmk

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

https://github.com/dmkenney/xamal

Most Liked

Dmk

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

Dmk

It was two-fold.

  1. 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.
  2. 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

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.

Where Next?

Popular in Announcing Top

Hal9000
Here is my first stab at this. README pasted below. https://github.com/Hal9000/elixir_random Comments and critiques are welcome. Thank...
New
bryanjos
Hi, I just published version 0.23.0 of Elixirscript. https://github.com/bryanjos/elixirscript/blob/master/CHANGELOG.md Most of the chan...
New
tmbb
I’ve decided to create this topic to discuss optimization possibilities for something like Phoenix LiveView. I’ve created this topic unde...
144 10483 141
New
dbern
I’m excited to announce that TaxJar has developed and open-sourced DateTimeParser. We developed it because we found a need to parse user ...
New
mathieuprog
Hello :waving_hand: Allow me to introduce you to Tz, an alternative time zone database support to Tzdata. Why another library? First a...
New
Qqwy
TypeCheck: Fast and flexible runtime type-checking for your Elixir projects. Core ideas Type- and function specifications are const...
336 14534 100
New
kevinlang
Hey all, We have made an Ecto3 Adapter for SQLite3, ecto_sqlite3! We have successfully on-boarded the full suite of integration tests (...
New
mplatts
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components. We also have a boi...
New
zoltanszogyenyi
Hey everyone :waving_hand: Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-s...
New
mtrudel
Bandit is an HTTP server for Plug and WebSock apps. Bandit is written entirely in Elixir and is built atop Thousand Island. It can serve...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54250 245
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39523 209
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

We're in Beta

About us Mission Statement