elpd

elpd

Fusion - run Elixir code on remote servers via SSH, no deployment needed

Ten years ago I got curious: what would a Chef/Ansible-like tool look like built entirely in Elixir? One that uses Erlang distribution instead of agents installed on remote machines.

I got most of it working — SSH tunnels, remote BEAM bootstrap, transparent clustering. But in the last piece, full code loading I run out of time. Life happened. The project sat.

A few weeks ago I picked it back up. Finished the bytecode pushing and dependency resolution with some AI assist, cleaned it up to newer utilities and shipped it in a day.

What it does

Connect to a remote server over SSH, push your modules, run them. No deployment. No pre-installed app on the remote. Just SSH access and Elixir.

target = %Fusion.Target{
  host: "10.0.1.5",
  port: 22,
  username: "deploy",
  auth: {:key, "~/.ssh/id_ed25519"}
}

{:ok, manager} = Fusion.NodeManager.start_link(target)
{:ok, remote_node} = Fusion.NodeManager.connect(manager)

# Run your own modules remotely — dependencies are pushed automatically
{:ok, result} = Fusion.run(remote_node, MyApp.Worker, :process, [data])

When you call MyApp.Worker remotely, Fusion reads the BEAM bytecode, walks the dependency tree, and pushes everything the module needs. No manual tracking.

Why build this

Back then it was mainly for curiosity. The idea was that instead of python or ruby, you can run Elixir on remote machines without a full deployment pipeline. Ad-hoc tasks across a fleet. Provisioning. One-off diagnostics. Interactive remote exploration.

Fusion gives you that without leaving Elixir.

How it works (the short version)

  • 3 SSH tunnels bridge Erlang distribution through firewalls — two reverse, one forward
  • Remote BEAM bootstrap starts Elixir on the remote with flags that route all traffic through the tunnels
  • Bytecode pushing transfers compiled .beam binaries (not source) with automatic dependency resolution

Zero runtime dependencies. ~700 lines of Elixir.

Deep dive articles

I wrote a three-part series covering the internals:

  1. Running Elixir on Remote Servers with Fusion — hands-on tutorial
  2. How Fusion Works: Tunnels and Distribution — SSH tunnel architecture
  3. How Fusion Works: Bytecode Pushing — dependency resolution and code loading

Links

https://github.com/elpddev/fusion

Feedback welcome

This is a POC. I do not plan using it in prod anytime soon. If someone find this interesting I’d love to hear your thoughts. API design, use cases I haven’t considered, rough edges. Maybe someone will find this useful.

Most Liked

AndyL

AndyL

I dislike Ansible but have not been able to find a better replacement. So I’m rooting for you!

For design inspiration, you might like to review the work done on JetPorch, a deploy tool by Michael DeHaan, the original Ansible developer. DeHaan worked on this project for a year-ish, then abandoned the project. But IMO his design was very good! You can find the archived JetPorch repo here: ~mpdehaan/jetporch - the Jet Enterprise Professional Orchestrator - sourcehut git

adam12

adam12

This looks great!

I rewrote one of my older applications just recently which is an IaaS platform similar to Linode/DO/etc. I originally had it as Ruby orchestrator + a Go sidecar deployed to each hypervisor, but when I brought it over to Elixir/Phoenix I ended up using SSH as the transport for simplicity, with nothing running on the hypervisor.

I looked at doing something similar to Fusion but I couldn’t completely crack the problem. I wanted to keep things simple, but I definitely made a few compromises in the journey.

I’m going to check this out in depth once I get a free moment.

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
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
mbuhot
Leverage Open Api 3.0 (Swagger) to document, test, validate and explore your Plug and Phoenix APIs. Generate and serve a JSON Open API ...
New
kip
ex_cldr provides localisation and internationalisation support based upon the data from the Unicode CLDR project. Unicode released CLDR ...
407 13366 120
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
martinthenth
Hello everybody :wave: Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New
scohen
Lexical Lexical is a next-generation language server for the Elixir programming language. Features Context aware code completion As-you...
New

Other popular topics Top

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
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
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
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 40165 209
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement