cr suggetions

This commit is contained in:
Daniel Kukula 2025-08-17 20:19:55 +02:00
parent a89a5351e3
commit 319a779d49
4 changed files with 28 additions and 27 deletions

View File

@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/refs/heads/main/misc/build.func) source <(curl -fsSL https://raw.githubusercontent.com/dkuku/ProxmoxVED/refs/heads/livebook/misc/build.func)
#source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/refs/heads/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG # Copyright (c) 2021-2025 community-scripts ORG
# Author: dkuku # Author: dkuku
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -24,7 +25,7 @@ function update_script() {
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -f /opt/.mix/escripts/livebook ]]; then if [[ ! -f /opt/livebook/.mix/escripts/livebook ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit 1 exit 1
fi fi
@ -32,19 +33,19 @@ function update_script() {
msg_info "Checking for updates..." msg_info "Checking for updates..."
RELEASE=$(curl -fsSL https://api.github.com/repos/livebook-dev/livebook/releases/latest | grep "tag_name" | awk -F'"' '{print $4}') RELEASE=$(curl -fsSL https://api.github.com/repos/livebook-dev/livebook/releases/latest | grep "tag_name" | awk -F'"' '{print $4}')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt 2>/dev/null)" ]]; then if [[ "${RELEASE}" != "$(cat /opt/.livebook 2>/dev/null)" ]]; then
msg_info "Updating ${APP} LXC" msg_info "Updating ${APP} LXC"
$STD apt-get update $STD apt-get update
$STD apt-get -y upgrade $STD apt-get -y upgrade
msg_ok "Updated ${APP} LXC" msg_ok "Updated ${APP} LXC"
msg_info "Updating ${APP} to ${RELEASE}" msg_info "Updating ${APP} to ${RELEASE}"
source /opt/.env source /opt/livebook/.env
cd /opt || exit 1 cd /opt/livebook || exit 1
mix escript.install hex livebook --force mix escript.install hex livebook --force
echo "$RELEASE" | $STD tee /opt/${APP}_version.txt >/dev/null echo "$RELEASE" | $STD tee /opt/.livebook
chown -R livebook:livebook /opt /data chown -R livebook:livebook /opt/livebook /data
msg_ok "Successfully updated to ${RELEASE}" msg_ok "Successfully updated to ${RELEASE}"
else else

View File

@ -13,7 +13,7 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Installing Dependencies (matching Livebook Dockerfile)" msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt-get install -y \
build-essential \ build-essential \
ca-certificates \ ca-certificates \
@ -23,24 +23,24 @@ $STD apt-get install -y \
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Creating livebook user" msg_info "Creating livebook user"
adduser --system --group --home /opt --shell /bin/bash livebook adduser --system --group --home /opt/livebook --shell /bin/bash livebook
msg_ok "Created livebook user" msg_ok "Created livebook user"
msg_info "Installing Erlang and Elixir" msg_info "Installing Erlang and Elixir"
mkdir -p /opt /data mkdir -p /opt/livebook /data
export HOME=/opt export HOME=/opt/livebook
cd /opt || exit 1 cd /opt/livebook || exit 1
curl -fsSO https://elixir-lang.org/install.sh curl -fsSO https://elixir-lang.org/install.sh
$STD sh install.sh elixir@latest otp@latest $STD sh install.sh elixir@latest otp@latest
RELEASE=$(curl -fsSL https://api.github.com/repos/livebook-dev/livebook/releases/latest | grep "tag_name" | awk -F'"' '{print $4}') RELEASE=$(curl -fsSL https://api.github.com/repos/livebook-dev/livebook/releases/latest | grep "tag_name" | awk -F'"' '{print $4}')
ERLANG_VERSION=$(ls /opt/.elixir-install/installs/otp/ | head -n1) ERLANG_VERSION=$(ls /opt/livebook/.elixir-install/installs/otp/ | head -n1)
ELIXIR_VERSION=$(ls /opt/.elixir-install/installs/elixir/ | head -n1) ELIXIR_VERSION=$(ls /opt/livebook/.elixir-install/installs/elixir/ | head -n1)
export ERLANG_BIN="/opt/.elixir-install/installs/otp/$ERLANG_VERSION/bin" export ERLANG_BIN="/opt/livebook/.elixir-install/installs/otp/$ERLANG_VERSION/bin"
export ELIXIR_BIN="/opt/.elixir-install/installs/elixir/$ELIXIR_VERSION/bin" export ELIXIR_BIN="/opt/livebook/.elixir-install/installs/elixir/$ELIXIR_VERSION/bin"
export PATH="$ERLANG_BIN:$ELIXIR_BIN:$PATH" export PATH="$ERLANG_BIN:$ELIXIR_BIN:$PATH"
$STD mix local.hex --force $STD mix local.hex --force
@ -49,13 +49,13 @@ $STD mix escript.install hex livebook --force
LIVEBOOK_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c16) LIVEBOOK_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c16)
cat <<EOF > /opt/livebook.creds cat <<EOF > /opt/livebook/livebook.creds
Livebook-Credentials Livebook-Credentials
Livebook Password: $LIVEBOOK_PASSWORD Livebook Password: $LIVEBOOK_PASSWORD
EOF EOF
cat <<EOF > /opt/.env cat <<EOF > /opt/livebook/.env
export HOME=/opt export HOME=/opt/livebook
export LIVEBOOK_VERSION=$RELEASE export LIVEBOOK_VERSION=$RELEASE
export ERLANG_VERSION=$ERLANG_VERSION export ERLANG_VERSION=$ERLANG_VERSION
export ELIXIR_VERSION=$ELIXIR_VERSION export ELIXIR_VERSION=$ELIXIR_VERSION
@ -63,9 +63,9 @@ export LIVEBOOK_PORT=8080
export LIVEBOOK_IP="::" export LIVEBOOK_IP="::"
export LIVEBOOK_HOME=/data export LIVEBOOK_HOME=/data
export LIVEBOOK_PASSWORD="$LIVEBOOK_PASSWORD" export LIVEBOOK_PASSWORD="$LIVEBOOK_PASSWORD"
export ESCRIPTS_BIN=/opt/.mix/escripts export ESCRIPTS_BIN=/opt/livebook/.mix/escripts
export ERLANG_BIN="/opt/.elixir-install/installs/otp/\${ERLANG_VERSION}/bin" export ERLANG_BIN="/opt/livebook/.elixir-install/installs/otp/\${ERLANG_VERSION}/bin"
export ELIXIR_BIN="/opt/.elixir-install/installs/elixir/\${ELIXIR_VERSION}/bin" export ELIXIR_BIN="/opt/livebook/.elixir-install/installs/elixir/\${ELIXIR_VERSION}/bin"
export PATH="\$ESCRIPTS_BIN:\$ERLANG_BIN:\$ELIXIR_BIN:\$PATH" export PATH="\$ESCRIPTS_BIN:\$ERLANG_BIN:\$ELIXIR_BIN:\$PATH"
EOF EOF
@ -82,8 +82,8 @@ Type=exec
User=livebook User=livebook
Group=livebook Group=livebook
WorkingDirectory=/data WorkingDirectory=/data
EnvironmentFile=-/opt/.env EnvironmentFile=-/opt/livebook/.env
ExecStart=/bin/bash -c 'source /opt/.env && cd /opt && livebook server' ExecStart=/bin/bash -c 'source /opt/livebook/.env && cd /opt/livebook && livebook server'
Restart=always Restart=always
RestartSec=5 RestartSec=5
@ -92,7 +92,7 @@ WantedBy=multi-user.target
EOF EOF
msg_info "Setting ownership and permissions" msg_info "Setting ownership and permissions"
chown -R livebook:livebook /opt /data chown -R livebook:livebook /opt/livebook /data
msg_ok "Set ownership and permissions" msg_ok "Set ownership and permissions"
systemctl enable -q --now livebook systemctl enable -q --now livebook

View File

@ -1438,7 +1438,7 @@ EOF'
fi fi
msg_ok "Customized LXC Container" msg_ok "Customized LXC Container"
lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)" lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/dkuku/ProxmoxVED/refs/heads/livebook/install/${var_install}.sh)"
} }
destroy_lxc() { destroy_lxc() {

View File

@ -196,7 +196,7 @@ EOF
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
msg_ok "Customized Container" msg_ok "Customized Container"
fi fi
echo "bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${app}.sh)\"" >/usr/bin/update echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/dkuku/ProxmoxVED/refs/heads/livebook/ct/${app}.sh)\"" >/usr/bin/update
chmod +x /usr/bin/update chmod +x /usr/bin/update
if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then
mkdir -p /root/.ssh mkdir -p /root/.ssh