ausimian
Castle - Hot-Code Upgrade Support for Elixir
Castle is a package I put together to assist with building Elixir releases capable of being live-upgraded via the ‘official’ release handling mechanisms.
It augments existing Elixir release support, providing:
- build-time support for
appupandreluphandling and release generation. - runtime support for
sys.configgeneration (incl. support forruntime.exs)
It additionally provides script support for release mgmt, adding commands to unpack, install, commit and remove releases in running systems.
This is an early release, there’s definitely a few rough edges notably:
- No support for config providers
- Untested on umbrella apps
- No Windows support
I will definitely get to the first two in the short term.
Edit - Just to add, it will not generate your appup scripts for you and is unlikely to. If you need hot-code upgrades for your app, it is assumed you understand the implications and will write your own appups.
Most Liked
ausimian
Castle 0.2.2 has been released:
- Support for config providers is added. Like
runtime.exs, Castle takes over the invocation of these providers in a separate instance prior to boot, or in the running instance before hot-code upgrades/downgrades. - The generation correctly honours the config_env/0 property during config generation.
ausimian
Castle 0.3.0 has been released:
- This version separates out all the build-time support (release assembly, appup/relup handling etc) into a separate dependency, Forecastle. Applications should continue to use Castle as their dependency.
- Mix Projects that don’t define a release, but do wish to generate an appup into their ebin folder, can bring in Castle as
runtime: false. - Projects that do define a release, should bring in Castle as a runtime dependency. Due to its separation from build-time concerns, the dependency now consists of a single small module.
- Mix Projects that don’t define a release, but do wish to generate an appup into their ebin folder, can bring in Castle as
- Prior versions of Castle wrapped the existing shell script in the release’s
binfolder, which was a kludge. This version replaces the shell script entirely, with the new release handling commands now integrated directly.
jackalcooper
that’s so cool! I am looking for a library for this
ausimian
I would like to see more maintainers provider appup files with their libraries, but i recognise this is out of scope for many of them. I think the appup generation tooling itself needs to improve as well.
From a technical perspective, it is the responsibility of the build tool to move appup files into the ebin folder of the compiled application. Castle does this currently via its appup compiler.
hst337
Great library, I’ve thought about writing something like this after finishing my current projects








