commit
94c288bc12
60
ct/livebook.sh
Executable file
60
ct/livebook.sh
Executable file
@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/refs/heads/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: dkuku
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/livebook-dev/livebook
|
||||
|
||||
APP="Livebook"
|
||||
var_tags="${var_tags:-development}"
|
||||
var_disk="${var_disk:-4}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-1024}"
|
||||
var_os="${var_os:-ubuntu}"
|
||||
var_version="${var_version:-24}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -f /opt/livebook/.mix/escripts/livebook ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "livebook" "livebook-dev/livebook"; then
|
||||
msg_info "Stopping ${APP}"
|
||||
systemctl stop livebook
|
||||
msg_info "Service stopped"
|
||||
|
||||
msg_info "Updating container"
|
||||
$STD apt-get update
|
||||
$STD apt-get -y upgrade
|
||||
msg_ok "Updated container"
|
||||
|
||||
msg_info "Updating ${APP}"
|
||||
source /opt/livebook/.env
|
||||
cd /opt/livebook
|
||||
$STD mix escript.install hex livebook --force
|
||||
|
||||
chown -R livebook:livebook /opt/livebook /data
|
||||
systemctl start livebook
|
||||
msg_ok "Updated ${APP}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}"
|
40
frontend/public/json/livebook.json
Normal file
40
frontend/public/json/livebook.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "Livebook",
|
||||
"slug": "livebook",
|
||||
"categories": [
|
||||
20
|
||||
],
|
||||
"date_created": "2025-08-12",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 8080,
|
||||
"documentation": null,
|
||||
"config_path": "/opt/.env",
|
||||
"website": "https://livebook.dev",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/svg/livebook.svg",
|
||||
"description": "Elixir Livebook is an interactive, web-based notebook platform for Elixir that combines code, documentation, and visualizations in a single document. Similar to Jupyter notebooks, it allows developers to write and execute Elixir code in real-time, making it ideal for data exploration, prototyping, learning, and collaborative development. Livebook features rich markdown support, built-in charting capabilities, and seamless integration with the Elixir ecosystem.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/livebook.sh",
|
||||
"resources": {
|
||||
"cpu": 1,
|
||||
"ram": 1024,
|
||||
"hdd": 4,
|
||||
"os": "Ubuntu",
|
||||
"version": "24.04"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "Show Livebook password: `cat /opt/livebook.creds`",
|
||||
"type": "info"
|
||||
}
|
||||
]
|
||||
}
|
105
install/livebook-install.sh
Normal file
105
install/livebook-install.sh
Normal file
@ -0,0 +1,105 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: dkuku
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/livebook-dev/livebook
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
git \
|
||||
libncurses5-dev
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Creating livebook user"
|
||||
$STD adduser --system --group --home /opt/livebook --shell /bin/bash livebook
|
||||
msg_ok "Created livebook user"
|
||||
|
||||
msg_info "Installing Erlang and Elixir"
|
||||
|
||||
mkdir -p /opt/livebook /data
|
||||
export HOME=/opt/livebook
|
||||
cd /opt/livebook
|
||||
|
||||
curl -fsSO https://elixir-lang.org/install.sh
|
||||
$STD sh install.sh elixir@latest otp@latest
|
||||
|
||||
ERLANG_VERSION=$(ls /opt/livebook/.elixir-install/installs/otp/ | head -n1)
|
||||
ELIXIR_VERSION=$(ls /opt/livebook/.elixir-install/installs/elixir/ | head -n1)
|
||||
LIVEBOOK_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c16)
|
||||
|
||||
export ERLANG_BIN="/opt/livebook/.elixir-install/installs/otp/$ERLANG_VERSION/bin"
|
||||
export ELIXIR_BIN="/opt/livebook/.elixir-install/installs/elixir/$ELIXIR_VERSION/bin"
|
||||
export PATH="$ERLANG_BIN:$ELIXIR_BIN:$PATH"
|
||||
|
||||
$STD mix local.hex --force
|
||||
$STD mix local.rebar --force
|
||||
$STD mix escript.install hex livebook --force
|
||||
|
||||
cat <<EOF > /opt/livebook/.env
|
||||
export HOME=/opt/livebook
|
||||
export ERLANG_VERSION=$ERLANG_VERSION
|
||||
export ELIXIR_VERSION=$ELIXIR_VERSION
|
||||
export LIVEBOOK_PORT=8080
|
||||
export LIVEBOOK_IP="::"
|
||||
export LIVEBOOK_HOME=/data
|
||||
export LIVEBOOK_PASSWORD="$LIVEBOOK_PASSWORD"
|
||||
export ESCRIPTS_BIN=/opt/livebook/.mix/escripts
|
||||
export ERLANG_BIN="/opt/livebook/.elixir-install/installs/otp/\${ERLANG_VERSION}/bin"
|
||||
export ELIXIR_BIN="/opt/livebook/.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
|
||||
[Unit]
|
||||
Description=Livebook
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
User=livebook
|
||||
Group=livebook
|
||||
WorkingDirectory=/data
|
||||
EnvironmentFile=-/opt/livebook/.env
|
||||
ExecStart=/bin/bash -c 'source /opt/livebook/.env && cd /opt/livebook && livebook server'
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
chown -R livebook:livebook /opt/livebook /data
|
||||
|
||||
systemctl enable -q --now livebook
|
||||
msg_ok "Installed Livebook"
|
||||
|
||||
msg_info "Saving Livebook credentials"
|
||||
cat <<EOF > /opt/livebook/livebook.creds
|
||||
Livebook-Credentials
|
||||
Livebook Password: $LIVEBOOK_PASSWORD
|
||||
EOF
|
||||
msg_ok "Livebook password stored in /opt/livebook/livebook.creds"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -f /opt/install.sh
|
||||
$STD apt-get autoremove -y
|
||||
$STD apt-get autoclean
|
||||
msg_ok "Cleaned Up"
|
Loading…
x
Reference in New Issue
Block a user