diff --git a/ct/livebook.sh b/ct/livebook.sh index 3ed7697d..ea387437 100755 --- a/ct/livebook.sh +++ b/ct/livebook.sh @@ -1,5 +1,6 @@ #!/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/community-scripts/ProxmoxVED/refs/heads/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/dkuku/ProxmoxVED/refs/heads/livebook/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: dkuku # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE diff --git a/install/livebook-install.sh b/install/livebook-install.sh index 67793003..84db422b 100644 --- a/install/livebook-install.sh +++ b/install/livebook-install.sh @@ -22,31 +22,48 @@ $STD apt-get install -y \ libncurses5-dev msg_ok "Installed Dependencies" -msg_info "Installing Erlang and Elixir -ELIXIR_VERSION=1.18.4-otp-27 -ERLANG_VERSION=27.3.4 +msg_info "Installing Erlang and Elixir" + mkdir -p /opt /data export HOME=/opt -touch $HOME/.env cd /opt || exit 1 -curl -fsSO https://elixir-lang.org/install.sh -$STD sh install.sh elixir@$ELXIR_VERSION otp@$ERLANG_VERSION -echo 'export HOME=/opt' >> $HOME/.env -echo 'export PATH="/opt/.elixir-install/installs/otp/${ERLANG_VERSION}/bin:/opt/.elixir-install/installs/elixir/${ELIXIR_VERSION}/bin:$PATH"' >> $HOME/.env -msg_ok "Installed Erlang and Elixir" -msg_info "Installing Livebook" +curl -fsSO https://elixir-lang.org/install.sh +$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}') -source /opt/.env -cd /opt || exit 1 $STD mix local.hex --force $STD mix local.rebar --force $STD mix escript.install hex livebook --force -echo 'export PATH="$HOME/.mix/escripts:$PATH"' >> ~/.env -msg_ok "Installed Livebook" -msg_info "Creating Livebook Service" +# Get the actual installed versions from directory names +ERLANG_VERSION=$(ls /opt/.elixir-install/installs/otp/ | head -n1) +ELIXIR_VERSION=$(ls /opt/.elixir-install/installs/elixir/ | head -n1) + +# TODO remove +echo "Found Erlang version: $ERLANG_VERSION" +echo "Found Elixir version: $ELIXIR_VERSION" + +# Create .env file with all environment variables +cat < /opt/.env +export HOME=/opt +export LIVEBOOK_VERSION=$RELEASE +export ERLANG_VERSION=$ERLANG_VERSION +export ELIXIR_VERSION=$ELIXIR_VERSION +export LIVEBOOK_PORT=8080 +export LIVEBOOK_IP="::" +export LIVEBOOK_HOME=/data +export LIVEBOOK_TOKEN_ENABLED=false +export ESCRIPTS_BIN=/opt/.mix/escripts +export ERLANG_BIN="/opt/.elixir-install/installs/otp/\${ERLANG_VERSION}/bin" +export ELIXIR_BIN="/opt/.elixir-install/installs/elixir/\${ELIXIR_VERSION}/bin" +export PATH="\$ESCRIPTS_BIN:\$ERLANG_BIN:\$ELIXIR_BIN:\$PATH" +EOF + +msg_ok "Installed Erlang $ERLANG_VERSION and Elixir $ELIXIR_VERSION" + +msg_info "Installing Livebook" + cat </etc/systemd/system/livebook.service [Unit] Description=Livebook @@ -57,25 +74,17 @@ Type=exec User=root Group=root WorkingDirectory=/data -Environment=MIX_ENV=prod -Environment=HOME=/opt -Environment=PATH=/opt/.mix/escripts:/opt/.elixir-install/installs/otp/27.3.4/bin:/opt/.elixir-install/installs/elixir/1.18.4-otp-27/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -Environment=LIVEBOOK_PORT=8080 -Environment=LIVEBOOK_IP="::" -Environment=LIVEBOOK_HOME=/data -Environment=LIVEBOOK_TOKEN_ENABLED=false -ExecStart=/bin/bash -c 'cd /opt && livebook server' +EnvironmentFile=-/opt/.env +ExecStart=/bin/bash -c 'source /opt/.env && cd /opt && livebook server' Restart=always RestartSec=5 -StandardOutput=journal -StandardError=journal [Install] WantedBy=multi-user.target EOF systemctl enable -q --now livebook -msg_ok "Created Livebook Service" +msg_ok "Installed Livebook" motd_ssh customize diff --git a/misc/build.func b/misc/build.func index c40a57bd..49b20b7f 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1438,7 +1438,7 @@ EOF' fi 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() { diff --git a/misc/install.func b/misc/install.func index e3751c29..9b6bd60e 100644 --- a/misc/install.func +++ b/misc/install.func @@ -196,7 +196,8 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" 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://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 if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then mkdir -p /root/.ssh