mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-26 05:55:54 +00:00
update logic
This commit is contained in:
@@ -23,82 +23,29 @@ $STD apt-get install --no-install-recommends -y \
|
||||
libncurses5-dev
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Creating Livebook User and Directories"
|
||||
useradd -r -s /bin/bash -d /opt livebook
|
||||
mkdir -p /opt /data
|
||||
chown livebook:livebook /opt /data
|
||||
|
||||
chmod 777 /opt
|
||||
msg_ok "Created Livebook User and Directories"
|
||||
|
||||
msg_info "Installing Erlang and Elixir"
|
||||
# Create a temporary script
|
||||
cat > /tmp/setup_elixir.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
mkdir -p /opt /data
|
||||
export HOME=/opt
|
||||
cd /opt
|
||||
touch $HOME/.env
|
||||
cd /opt || exit 1
|
||||
curl -fsSO https://elixir-lang.org/install.sh
|
||||
sh install.sh elixir@1.18.4 otp@27.3.4 >/dev/null 2>&1
|
||||
|
||||
# Create .env if it doesn't exist and set permissions
|
||||
touch $HOME/.env
|
||||
chmod 644 $HOME/.env
|
||||
|
||||
# Add exports to .env
|
||||
echo 'export HOME=/opt' >> $HOME/.env
|
||||
echo 'export PATH="$HOME/.elixir-install/installs/otp/27.3.4/bin:$HOME/.elixir-install/installs/elixir/1.18.4-otp-27/bin:$PATH"' >> $HOME/.env
|
||||
EOF
|
||||
|
||||
# Make it executable and run as livebook user
|
||||
chmod +x /tmp/setup_elixir.sh
|
||||
$STD sudo -u livebook -H /tmp/setup_elixir.sh
|
||||
rm /tmp/setup_elixir.sh
|
||||
echo 'export PATH="/opt/.elixir-install/installs/otp/27.3.4/bin:/opt/.elixir-install/installs/elixir/1.18.4-otp-27/bin:$PATH"' >> $HOME/.env
|
||||
msg_ok "Installed Erlang 27.3.4 and Elixir 1.18.4"
|
||||
|
||||
msg_info "Installing Livebook"
|
||||
|
||||
cat > /tmp/install_livebook.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/livebook-dev/livebook/releases/latest | grep "tag_name" | awk -F'"' '{print $4}')
|
||||
echo "${RELEASE}" >/opt/Livebook_version.txt
|
||||
|
||||
set -e # Exit on any error
|
||||
source /opt/.env
|
||||
cd $HOME
|
||||
|
||||
# Install hex and rebar for Mix.install/2 and Mix runtime (matching Dockerfile)
|
||||
echo "Installing hex..."
|
||||
mix local.hex --force
|
||||
echo "Installing rebar..."
|
||||
mix local.rebar --force
|
||||
|
||||
# Following official Livebook escript installation instructions
|
||||
echo "Installing Livebook escript..."
|
||||
MIX_ENV=prod mix escript.install hex livebook --force
|
||||
|
||||
# Add escripts to PATH
|
||||
cd /opt || exit 1
|
||||
mix local.hex --force >/dev/null 2>&1
|
||||
mix local.rebar --force >/dev/null 2>&1
|
||||
mix escript.install hex livebook --force >/dev/null 2>&1
|
||||
echo 'export PATH="$HOME/.mix/escripts:$PATH"' >> ~/.env
|
||||
|
||||
# Verify livebook was installed and make executable
|
||||
if [ -f ~/.mix/escripts/livebook ]; then
|
||||
chmod +x ~/.mix/escripts/livebook
|
||||
echo "Livebook escript installed successfully"
|
||||
ls -la ~/.mix/escripts/livebook
|
||||
else
|
||||
echo "ERROR: Livebook escript not found after installation"
|
||||
ls -la ~/.mix/escripts/ || echo "No escripts directory found"
|
||||
# Try to show what went wrong
|
||||
echo "Mix environment:"
|
||||
mix --version
|
||||
echo "Available packages:"
|
||||
mix hex.info livebook || echo "Could not get livebook info"
|
||||
exit 1
|
||||
fi
|
||||
EOF
|
||||
|
||||
chmod +x /tmp/install_livebook.sh
|
||||
$STD sudo -u livebook -H /tmp/install_livebook.sh
|
||||
rm /tmp/install_livebook.sh
|
||||
msg_ok "Installed Livebook"
|
||||
|
||||
msg_info "Creating Livebook Service"
|
||||
cat <<EOF >/etc/systemd/system/livebook.service
|
||||
@@ -108,8 +55,8 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
User=livebook
|
||||
Group=livebook
|
||||
User=root
|
||||
Group=root
|
||||
WorkingDirectory=/data
|
||||
Environment=MIX_ENV=prod
|
||||
Environment=HOME=/opt
|
||||
@@ -129,6 +76,7 @@ WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
$STD systemctl enable livebook.service
|
||||
$STD systemctl start livebook.service
|
||||
msg_ok "Created Livebook Service"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
@@ -137,11 +85,6 @@ $STD apt-get autoremove -y
|
||||
$STD apt-get autoclean
|
||||
msg_ok "Cleaned Up"
|
||||
|
||||
msg_info "Starting Livebook Service"
|
||||
$STD systemctl start livebook.service
|
||||
msg_ok "Started Livebook Service"
|
||||
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
|
||||
Reference in New Issue
Block a user