test new logic

This commit is contained in:
Daniel Kukula 2025-08-17 07:50:40 +02:00
parent 95030997c5
commit aa25f6d3e3
4 changed files with 40 additions and 29 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/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 # 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

View File

@ -22,31 +22,48 @@ $STD apt-get install -y \
libncurses5-dev libncurses5-dev
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing Erlang and Elixir msg_info "Installing Erlang and Elixir"
ELIXIR_VERSION=1.18.4-otp-27
ERLANG_VERSION=27.3.4
mkdir -p /opt /data mkdir -p /opt /data
export HOME=/opt export HOME=/opt
touch $HOME/.env
cd /opt || exit 1 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}') 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.hex --force
$STD mix local.rebar --force $STD mix local.rebar --force
$STD mix escript.install hex livebook --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 <<EOF > /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 <<EOF >/etc/systemd/system/livebook.service cat <<EOF >/etc/systemd/system/livebook.service
[Unit] [Unit]
Description=Livebook Description=Livebook
@ -57,25 +74,17 @@ Type=exec
User=root User=root
Group=root Group=root
WorkingDirectory=/data WorkingDirectory=/data
Environment=MIX_ENV=prod EnvironmentFile=-/opt/.env
Environment=HOME=/opt ExecStart=/bin/bash -c 'source /opt/.env && cd /opt && livebook server'
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'
Restart=always Restart=always
RestartSec=5 RestartSec=5
StandardOutput=journal
StandardError=journal
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
systemctl enable -q --now livebook systemctl enable -q --now livebook
msg_ok "Created Livebook Service" msg_ok "Installed Livebook"
motd_ssh motd_ssh
customize customize

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,8 @@ 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://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