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

michalmuskala
Another small library today. PersistentEts Hex: persistent_ets | Hex GitHub: GitHub - michalmuskala/persistent_ets · GitHub Ets table ...
New
Eiji
ExApi is a library that I’m developing now and hope release soon This library will allow to: list all apis list all api implementation...
New
sbs
Only 650 LOC, wrote for fun :slight_smile: https://github.com/sunboshan/qrcode
New
josevalim
Yes, yet another parser combinator library! Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
159 19483 141
New
josevalim
Hi everyone, We would like to announce that Plataformatec is working on a new MySQL driver called MyXQL. Our goal is to eventually integ...
New
achempion
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library. The progre...
New
ityonemo
Currently just starting out on a new mini-project - getting zig NIFs to run in elixir. https://github.com/ityonemo/zigler The idea here...
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
woutdp
Hi! I wanted to introduce my latest project LiveSvelte. It allows you to render Svelte inside LiveView with end-to-end reactivity. It’s ...
New
markmark206
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127536 1222
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
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
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New

We're in Beta

About us Mission Statement