Add customizable configuration script to release (#2295)

This commit is contained in:
Jonatan Kłosko 2023-10-24 16:46:40 +02:00 committed by GitHub
parent b603639b77
commit 6406e1fcf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 6 deletions

View file

@ -349,6 +349,11 @@ When clustering is enabled, you must additionally set the following env vars:
`LIVEBOOK_DISTRIBUTION` is automatically set to `name` if clustering is
enabled.
Some variables, like `LIVEBOOK_NODE`, are oftentimes computed at runtime.
When using the Livebook Docker image, you can create a file at `/app/env.sh`
that exports the necessary environment variables. This file is invoked right
before booting Livebook.
## Development
Livebook is primarily a Phoenix web application and can be setup as such:

View file

@ -130,16 +130,12 @@ defmodule Livebook.Hubs.Dockerfile do
""" <>
~S"""
# Custom startup script to cluster multiple Livebook nodes on Fly.io
# Runtime configuration to cluster multiple Livebook nodes on Fly.io
RUN printf '\
#!/bin/bash\n\
export ERL_AFLAGS="-proto_dist inet6_tcp"\n\
export LIVEBOOK_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*-}@${FLY_PRIVATE_IP}"\n\
export LIVEBOOK_CLUSTER="dns:${FLY_APP_NAME}.internal"\n\
/app/bin/livebook start\n\
' > /app/bin/start.sh && chmod +x /app/bin/start.sh
CMD [ "sh", "-c", "/app/bin/start.sh" ]
' > /app/env.sh
"""
end

View file

@ -1,3 +1,7 @@
if exist "!RELEASE_ROOT!\env.bat" (
call "!RELEASE_ROOT!\env.bat"
)
set RELEASE_MODE=interactive
if defined LIVEBOOK_NODE set RELEASE_NODE="!LIVEBOOK_NODE!"
if not defined RELEASE_NODE set RELEASE_NODE=livebook_server

View file

@ -1,3 +1,7 @@
if [ -f "${RELEASE_ROOT}/env.sh" ]; then
. "${RELEASE_ROOT}/env.sh"
fi
export RELEASE_MODE=interactive
export RELEASE_NODE=${LIVEBOOK_NODE:-${RELEASE_NODE:-livebook_server}}
if [ -z "${LIVEBOOK_CLUSTER}" ]; then DISTRIBUTION_DEFAULT="sname"; else DISTRIBUTION_DEFAULT="name"; fi