Skip to content
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

Merged
merged 3 commits into from
Jun 13, 2024
Merged

Defer distribution boot in releases #2648

merged 3 commits into from
Jun 13, 2024

Conversation

jonatanklosko
Copy link
Member

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 using RELEASE_DISTRIBUTION=name as typically, we can set RELEASE_DISTRIBUTION=none and let the distribution be started on application boot, as we do for mix 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.

Copy link

github-actions bot commented Jun 13, 2024

Uffizzi Preview deployment-53025 was deleted.

Livebook.Config.cookie!("LIVEBOOK_COOKIE") ||
Livebook.Config.cookie!("RELEASE_COOKIE") ||
Livebook.Utils.random_cookie()
Livebook.Config.cookie!("LIVEBOOK_COOKIE") || Livebook.Utils.random_cookie()
Copy link
Member Author

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
Copy link
Member Author

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.

README.md Show resolved Hide resolved
@jonatanklosko jonatanklosko merged commit 84b183d into main Jun 13, 2024
8 checks passed
@jonatanklosko jonatanklosko deleted the jk-release-dist branch June 13, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants