bitwalker / distillery

Simplify deployments in Elixir with OTP releases!
MIT License
2.96k stars 396 forks source link

--logger-sasl-reports : Unknown option #687

Closed Hermanverschooten closed 5 years ago

Hermanverschooten commented 5 years ago

Steps to reproduce

Disitllery version: 2.1.0 Erlang version: 22.0.3-1 Elixir version: 1.9.0

Verbose Logs

Jun 25 09:04:14 studentenjobs systemd[1]: Started StudentenJobs Website. Jun 25 09:04:15 studentenjobs studenten_jobs[9985]: Starting dependencies.. Jun 25 09:04:15 studentenjobs studenten_jobs[9985]: Starting repos.. Jun 25 09:04:15 studentenjobs studenten_jobs[9985]: Running migrations for studenten_jobs Jun 25 09:04:15 studentenjobs studenten_jobs[9985]: --logger-sasl-reports : Unknown option Jun 25 09:04:15 studentenjobs systemd[1]: studenten_jobs.service: Main process exited, code=exited, status=1/FAILURE Jun 25 09:04:15 studentenjobs systemd[1]: studenten_jobs.service: Failed with result 'exit-code'. Jun 25 09:04:15 studentenjobs systemd[1]: studenten_jobs.service: Service hold-off time over, scheduling restart. Jun 25 09:04:15 studentenjobs systemd[1]: studenten_jobs.service: Scheduled restart job, restart counter is at 5. Jun 25 09:04:15 studentenjobs systemd[1]: Stopped StudentenJobs Website.

Description of issue

I upgraded to distillery version 2.1.0 this morning and this broke my deployment via circleci. So I upgraded elixir and erlang too, and changed the necessary references and commands according to the changelog.

But my application will not start anymore., due to the Unknown option error above. If I remove my migration hook, it starts. the hook contains:

#!/bin/sh

release_ctl eval --mfa "ReleaseTasks.migrate/1" --argv -- "$0"
bitwalker commented 5 years ago

I'm not clear why this would be failing, that option is known to Elixir (even in the newly released 1.9.0). Could you run the release with DEBUG_BOOT=true set in the environment and paste the output here? Feel free to strip sensitive information, I mostly am looking for where that error is raised specifically and what the arguments are.

Hermanverschooten commented 5 years ago

I have set that option in systemd service and uncommented the release_ctl syslog.txt. I only replaced the cookie with xxx.

Hermanverschooten commented 5 years ago

I recreated the issue with a simple test phx app. https://github.com/Hermanverschooten/dist_test Creating the release and running it locally produces the same error.

hubertlepicki commented 5 years ago

I have similar issue, but my main application would start - the remote_console however not. It's crashing with:

./bin/myapp_phoenix remote_console
--logger-sasl-reports : Unknown option
Node myapp-staging@X.X.X.X is not running!

plus I get the constant error showing up in my logs on the running app:

--logger-sasl-reports : Unknown option
pong

which repeats every 1 second or so.

At the same time of upgrading Distillery to 2.1, I have also upgraded to Erlang 22.0.3 and Elixir 1.9 so I understand any of these may be an issuue.

Hermanverschooten commented 5 years ago

I too have the issue that the remote_console is not working and complains the node is not running.

hubertlepicki commented 5 years ago

I recreated the issue with a simple test phx app. https://github.com/Hermanverschooten/dist_test Creating the release and running it locally produces the same error.

Have you deleted the app?

hubertlepicki commented 5 years ago

I think it's not about "--logger-sasl-reports false" but "pong"... as this is repeating on my console as error all the time now.

hubertlepicki commented 5 years ago

Further investigation shows that if I modify two scripts on the built release I have no problem anymore.

I edited releases/0.1.0/libexec/erts.sh two functions there to get rid of --logger-sasl-reports false line:

# Use release_ctl for local operations
# Use like `release_ctl eval "IO.puts(\"Hi!\")"`
# NOTE: removed the following line below "elixir" line:
#           --logger-sasl-reports false \
release_ctl() {
    command="$1"; shift
    elixir -e "Distillery.Releases.Runtime.Control.main" \
           -- \
           "$command" "$@"
}

# Use release_ctl for remote operations
# Use like `release_remote_ctl ping`
# NOTE: removed the following line below "elixir" line:
#           --logger-sasl-reports false \
release_remote_ctl() {
    require_cookie

    command="$1"; shift
    name="${PEERNAME:-$NAME}"
    elixir -e "Distillery.Releases.Runtime.Control.main" \
           -- \
           "$command" \
           --name="$name" \
           --cookie="$COOKIE" \
           "$@"
}

this makes app start with no issues and no "Unknown option"l is logged every second.

However, remote_console still fails with:

/bin/myapp_phoenix remote_console
Erlang/OTP 22 [erts-10.4.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe]

--erl : Unknown option
-noshell -user Elixir.IEx.CLI : Unknown option
--erl : Unknown option
-hidden -kernel net_ticktime 60 : Unknown option
--logger-sasl-reports : Unknown option
No file named false

The fix for that is to launch it with "USE_ERL_SHELL=true" environment variable set.

The problem seems to boil down to "elixir" and "iex" from within release not accepting any options. My "iex" and "elixir" installed in the system do accept these options, but the ones in release do not.

include_erts: false doesn't fix the issue either.

It appears the shell scripts generating the commands are doing something Erlang 22.0 or Elixir 1.9 doesn't like when passing arguments. I suspect --logger-sasl-reports="true" instead of --logger-sasl-reports true would work but that's just a hunch...

Hermanverschooten commented 5 years ago

I forgot to push it,...

ejscunha commented 5 years ago

We are also having this issue when executing a pre_start hook which uses the release_ctl script. We get the --logger-sasl-reports : Unknown option message. Also with Elixir 1.9 and OTP 22.

bitwalker commented 5 years ago

This is fixed in 2.1.1 (published to Hex) and master