/bakeware

SpawnFest 2020 - Your description here..!

Primary LanguageCOtherNOASSERTION

Bakeware

Compile Elixir applications into single, easily distributed executable binaries

The Bakeware oven

Do you have Go-envy for how easy it is to distribute commandline utilities? Or maybe your escript grew too much and you hit a wall with a library that required platform-specific code? Or that OTP release seemed so easy to distribute, but somehow running untar was just enough friction to make someone complain about your use of Elixir.

Bakeware addresses these issues by extending Mix releases with the ability to turn Elixir projects into single binaries that can be copied and directly run. No need to install Erlang or untar files. The binaries look and feel like the build-products from other languages.

Here's a quick list of features:

  • Simple - add the bakeware dependency and the Bakeware assembler to your Mix release settings
  • Supports OSX and Linux (We wrote the code with Windows and the BSDs in mind, so support for those platforms may not be far off)
  • Zstd compression for small binaries
  • Commandline argument passing conveniences
  • Lots of examples
  • Stretch goal for SpawnFest: Optional support for automatic software updates

Some stats:

  • Executables are 12-15 MB on Linux and 5-7 MB on OSX for simple Elixir, Phoenix, and Scenic apps (Zstd compression enabled)
  • Non-scientifically - ~0.5s startup times or better on our computers (measured with time)

How does Bakeware work?

Bakeware combines a compressed OTP release archive with a smart platform-specific self-extractor. The self-extractor expands the OTP release to a cache on first execution and reuses the cache for subsequent invocations. Due to the use of Zstd compression, the expansion is very fast and mostly invisible to the end user.

The best way to try out Bakeware is to clone this repository and try out the examples.

Since the whole point of this project is to avoid needing to install Elixir and and build the binaries yourself, you can download ones that we built from the GitHub Releases page. We built them for 64-bit Linux (we're using Debian-based OSs) and MacOS. Download the tarball for your platform. The binary names correspond to the examples. Please read the example README.md's for information on commandline arguments and what to expect.

# E.g., on MacOS, download and untar bakeware-examples-macos.tgz
$ cd MacOS
$ ./simple_app
Hello, OTP Application!
Exiting...

Documentation is provided in the main bakeware library, the examples, and the SousCheck software update server.

Projects

Here's a list of the projects in this repository:

The following projects were a stretch goal of ours. These projects are a client library and an example server for automatically updating binaries. The idea is that applications can ask a server if an update is available. If one is, it is downloaded and the application is automatically restarted with the new version.

  • bakeware_updater - Small Elixir library to check update server for an available update, download it, and apply it to the existing executable
  • sous_chef - An example update server for binaries built with Bakeware

LICENSE

All code is licensed under Apache-2.0 with the exception of zstd which is dual licensed BSD/GPL. See it's LICENSE and COPYING files for more details.