-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defer distribution boot in releases #2648
Conversation
Uffizzi Preview |
Livebook.Config.cookie!("LIVEBOOK_COOKIE") || | ||
Livebook.Config.cookie!("RELEASE_COOKIE") || | ||
Livebook.Utils.random_cookie() | ||
Livebook.Config.cookie!("LIVEBOOK_COOKIE") || Livebook.Utils.random_cookie() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josevalim we are no longer respecting RELEASE_NODE
, because the Elixir release script defaults its value to release name, which we don't want to use. I think we should ignore RELEASE_COOKIE
also for consistency. I think it makes sense to expect the configuration to happen via LIVEBOOK_*
env vars.
cookie_path="${RELEASE_ROOT}/releases/COOKIE" | ||
if [ ! -f $cookie_path ] && [ -z "$RELEASE_COOKIE" ]; then | ||
RELEASE_COOKIE=$(cat /dev/urandom | env LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | ||
echo "$RELEASE_COOKIE" > "$cookie_path" || export RELEASE_COOKIE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FTR we used to attempt to write the random cookie to a file and respect RELEASE_COOKIE
, such that the cookie was the same on subsequent boots. This was necessary because in the past Livebook Desktop was calling bin/release rpc
and so it had to use the same cookie. We no longer do that though, so I simplified the code to no longer write the file.
Follow up to #2646 that fixes releases. We need to specify the default node name, but whether we want
127.0.0.1
or::1
depends on-proto_dist
, which can be passed in multiple ways and is hard to know in the env files. I realised that instead of usingRELEASE_DISTRIBUTION=name
as typically, we can setRELEASE_DISTRIBUTION=none
and let the distribution be started on application boot, as we do formix phx.server
and Escript. This way we have a single code path for setting up distribution and also less logic in the release env files.