Conversation
a779b0a to
24794e2
Compare
|
I have implemented |
|
Be careful -- For relx/rebar3/erlang-in-anger, we've basically decided to advise against using it for this reason. |
|
Thanks for the heads up @ferd. @tsloughter also told me to be careful with it so we will move it to a separate mode start mode called |
|
@ferd btw, was the fsync behaviour ever brought to discussion with the OTP team? Any chance we can put it behind a flag and/or disable it by default instead? |
|
@fhunleth @mobileoverlord @ConnorRigby I have some Nerves related questions:
Thanks! |
|
Just to have it here, adding on what Fred said, aside from performance issues with |
Not that i know of. I'll let someone else answer for sure though.
Frank just told me about
Nerves doesn't use Elixir at all to start a release on the device itself. erlinit starts the OTP release similarly to how one would manually start a distillery release. You can see how it is started here
In Nerves we will have a UART console on the device itself, or a console on HDMI on devices that support that just like it were a regular machine. We also allow connecting via |
So if I understand this correctly... you don't even use shell scripts to start it, which means that whatever we are doing here at the CLI level does not make a difference to Nerves. Is this correct? Thanks @ConnorRigby! |
|
@josevalim Correct. Nerves starts an OTP release with |
|
I think Connor answered most of the questions, and the most important one, that we don't use the shell scripts. For completeness, here's info on the parts he skipped.
No. Nerves' erlinit only supports starting the OTP release in the foreground. It waits for exits or crashes to restart the device or take some other action.
Very few people use run_erl with Nerves. Our console frequently runs at 115,200 baud and loses data, so we advise people to avoid using it for logging. I recently caught a NIF outputting useful debug data to the startup console and that's the only reason I use run_erl. run_erl logs are stored under /tmp which is writable on Nerves. |
Never discussed it with them. Mostly the disterl solution was always available (including on windows) and faster to us so we just made the switch. Plus in some scenarios, we'd start before the root disk partition was mounted in write mode. |
|
Hi everyone, this is ready to go and I plan to fully merge it tomorrow. I have an application with barebones releases using those features here: https://github.com/josevalim/potato. Note you will need to use this branch. Run The next steps are:
|
|
|
||
| --boot \"FILE\" Uses the given FILE.boot to start the system | ||
| --boot-var VAR \"VALUE\" Makes \$VAR available as VALUE to FILE.boot (*) | ||
| --pipe-to \"PIPEDIR\" \"LOGDIR\" Starts the Erlang VM as a named PIPEDIR and LOGDIR |
There was a problem hiding this comment.
let's separate words with an underscore
| --pipe-to \"PIPEDIR\" \"LOGDIR\" Starts the Erlang VM as a named PIPEDIR and LOGDIR | |
| --pipe-to \"PIPE_DIR\" \"LOG_DIR\" Starts the Erlang VM as a named PIPE_DIR and LOG_DIR |
| I=$(($I + 1)) | ||
| eval "RUN_ERL_PIPE=\${$I}" | ||
| if [[ "$RUN_ERL_PIPE" == "-"* ]]; then | ||
| echo "--pipe-to : PIPEDIR cannot be a switch" >&2 |
There was a problem hiding this comment.
| echo "--pipe-to : PIPEDIR cannot be a switch" >&2 | |
| echo "--pipe-to : PIPE_DIR cannot be a switch" >&2 |
| --vm-args \"FILE\" Passes the contents in file as arguments to the VM | ||
|
|
||
| --pipe-to starts Elixir dettached from console (UNIX only). | ||
| It will attempt to create PIPEDIR and LOGDIR if they don't exist. |
There was a problem hiding this comment.
| It will attempt to create PIPEDIR and LOGDIR if they don't exist. | |
| It will attempt to create PIPE_DIR and LOG_DIR if they don't exist. |
|
|
||
| --pipe-to starts Elixir dettached from console (UNIX only). | ||
| It will attempt to create PIPEDIR and LOGDIR if they don't exist. | ||
| See run_erl to learn more. To reattach, run: to_erl PIPEDIR. |
There was a problem hiding this comment.
| See run_erl to learn more. To reattach, run: to_erl PIPEDIR. | |
| See run_erl to learn more. To reattach, run: to_erl PIPE_DIR. |
| echo. | ||
| echo --boot "FILE" Uses the given FILE.boot to start the system | ||
| echo --boot-var VAR "VALUE" Makes $VAR available as VALUE to FILE.boot (*) | ||
| echo --pipe-to "PIPEDIR" "LOGDIR" Starts the Erlang VM as a named PIPEDIR and LOGDIR |
There was a problem hiding this comment.
| echo --pipe-to "PIPEDIR" "LOGDIR" Starts the Erlang VM as a named PIPEDIR and LOGDIR | |
| echo --pipe-to "PIPE_DIR" "LOG_DIR" Starts the Erlang VM as a named PIPE_DIR and LOG_DIR |
| I=$(($I + 1)) | ||
| eval "RUN_ERL_LOG=\${$I}" | ||
| if [[ "$RUN_ERL_LOG" == "-"* ]]; then | ||
| echo "--pipe-to : LOGDIR cannot be a switch" >&2 |
There was a problem hiding this comment.
| echo "--pipe-to : LOGDIR cannot be a switch" >&2 | |
| echo "--pipe-to : LOG_DIR cannot be a switch" >&2 |
There was a problem hiding this comment.
Erlang refers to those and other environment variables without snake case so I am going with their convention for now.
Co-Authored-By: josevalim <jose.valim@gmail.com>
| ;; | ||
| --werl) | ||
| USE_WERL=true | ||
| ;; |
There was a problem hiding this comment.
All these options in this sections can be sorted alphabetically
Co-Authored-By: josevalim <jose.valim@gmail.com>
Co-Authored-By: josevalim <jose.valim@gmail.com>
| See the -heart mode of the Erlang VM for more information. | ||
|
|
||
| ** Options marked with (*) can be given more than once." >&2 | ||
| exit 1 |
There was a problem hiding this comment.
Should we just exit? I think at least elixir --help, or elixir -h should return 0.
There was a problem hiding this comment.
I believe it was because if Elixir is accidentally called without argument or something of sorts. So we probably need to check why we are invoking this. Let's do that in a separate occasion.
This is a proposal to add five new options to Elixir's CLI with the goal of having releases into Elixir in the future.
In order to start an Elixir application in a release, there is a lot of work that has to be done by the underlying script: setting up the
HEART_COMMAND, configuring boot files and boot vars, definingrun_erland making sure both pipe and log directories exist.Because we want the scripts in an Elixir release to be minimal, we will move the complexity of managing those steps directly to the elixir/iex executables. Besides making releases more manageable, it means features like
heartandrun_erlbecome easily accessible to Elixir developers even outside of releases.The options
This PR adds 5 new options to elixir CLI:
--pipe-to PIPEDIR LOGDIR- invokesrun_erlwith daemon pipe and logs. This option is only for UNIX-like systems. Releases on Windows use a separate schema.--rpc-eval NODE COMMAND- evaluates the given expression on the given node--boot FILE,--boot-var VAR VALUEand--vm-args FILE- which are equivalent to Erlang's-boot,-boot_varand-args_fileBy adding those options, we can build a script that would be part of a release and allows you to start, enable a remote console, perform rpcs (which includes stop, restart, pids, etc) in 70 LOC:
This PR also reorganizes the CLI help instructions to make understanding all of those options slightly more manageable. It also trims down the
iexCLI and makes it point toelixir -h. I am looking for feedback on the new options as well as on the new help structure.Summary
We are not quite sure yet how Elixir releases will look like but this is the first step. Given we have 6 months until the next Elixir release, we have plenty of time to remove or add any new options if necessary. In fact, we know we will need at least one extra option for Windows support, but that will be tackled in another PR.