Open LostKobrakai opened 3 years ago
Nerves only uses Mix releases
to assist in creating firmware. Mix releases also creates shell scripts and batch scripts which aren't useful for Nerves. It looks like the shell scripts don't work. I can think of a few solutions:
Have the Nerves tooling erase the shell scripts as a post-release step to avoid any confusion that they might be used. @mobileoverlord and I have discussed coding up our own release generator to avoid using Mix releases. This seems like a step in this direction, even though neither of us is super-excited about coding it up.
Don't support hardcoding the cookie in the firmware at all. The effect would be to erase the line in vm.args as you suggest and then delete the line in the mix.exs that sets it. I'm a big fan of not hardcoding cookies in firmware, but it might cause confusion since mix release docs say that cookies can be set in the mix.exs. The Nerves core team discussed this a year or so ago. Perhaps we need to revisit.
I assume that the reason that you're making a mix release in a Nerves project is to debug something with Shoehorn. Otherwise, I'd think that you'd just run iex -S mix
or mix test
to run on the host. Is that right?
I assume that the reason that you're making a mix release in a Nerves project is to debug something with Shoehorn.
That's kinda the case. It's for creating tests for whatever the shoehorn handler is used for.
That is a very noble effort that I'd like to support. I will think more about this. I'm glad that the workaround for you is easy (i.e., delete the -setcookie
line), though.
Environment
elixir -v
): 1.10.4Nerves environment: (
mix nerves.env --info
) |nerves_bootstrap| Environment Package ListNo packages found |nerves_bootstrap| Loadpaths Start
Nerves environment MIX_TARGET: host MIX_ENV: dev
NERVES_SYSTEM is unset NERVES_TOOLCHAIN is unset |nerves_bootstrap| Environment Variable List target: host toolchain: unset system: unset app: …/05_elixir/edith
|nerves_bootstrap| Loadpaths End
Current behavior
Running a shoehorn release (on host) results in the cookie being read from
$HOME/.erlang.cookie
instead of the one configured through the normal mix release means (config or env variable)Removing the
-setcookie
invm.args.eex
resolves the issue and also doesn't seem to break releases run on targets. Mix releases are always started with an cookie set on the cli. A random cookie is generated when building the release unless a specific one is explicitly set.Expected behavior
The cookie configured in mix.exs or via the env variables is correctly applied.