Maybe a “best practices” guidelines for eval and rpc might be useful. One of my eval statements in my shell script looks like this, which I think is maybe evocative of some of the struggles:
#/bin/sh
my_app/bin/my_app eval "import IP; Application.ensure_all_started(:my_app); :some_atom1; :some_atom2; MyApp.run_file('~/configuration.toml', ~i/$1/);"
- I’m not sure there’s guidance about sometimes needing to do
Application.ensure_all_started/1in anevalstatement; I only knew immediately to put that in from lots of experience, and this may be frustrating for beginners. - the
:some_atomsare there because i have been maybe overly cautious about String.to_existing_atom. - the first parameter to
run_file/2is a charlist to avoid having to escape double quotes, and is a bit of a hack because I happened to rememberrun_filejust calls File.read!, which admits charlists. - the second parameter uses this sigil_i that I happened to remember I’d written because that lets me avoid a quotation mark in
IP.from_string!/1. If I had a function that took a String, I would probably want to use~s//or something, but guidance on that as a best practice would be nice.
It might also be nice to be able to package shell/batch scripts into the release relatively easily in the Release pipeline (like how we have :assemble and :tar directives) I don’t do this currently (and just copy/paste from my source directory into vi).
That said, I love releases. I did a release on a personal project - persistent websocket datascraping into Sqlite last night directly onto an free-tier aws. Smooth as a baby.


















