From df13dd31b29d43e9502a8158618704c29a3904d5 Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 18 May 2025 21:49:44 -0400 Subject: [PATCH] init --- ct/kasm.sh | 86 ++++++++++++++++++++++++++++++++++ frontend/public/json/kasm.json | 44 +++++++++++++++++ install/kasm-install.sh | 37 +++++++++++++++ 3 files changed, 167 insertions(+) create mode 100644 ct/kasm.sh create mode 100644 frontend/public/json/kasm.json create mode 100644 install/kasm-install.sh diff --git a/ct/kasm.sh b/ct/kasm.sh new file mode 100644 index 0000000..8dd7957 --- /dev/null +++ b/ct/kasm.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Omar Minaya +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.kasmweb.com/docs/1.10.0/install/single_server_install.html + +APP="Kasm" +var_tags="kasm;workspaces;docker" +var_cpu="2" +var_ram="4096" +var_disk="50" +var_os="debian" +var_version="12" +var_unprivileged="0" +var_fuse="yes" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/kasm ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating ${APP} LXC" + $STD apt-get update + $STD apt-get -y upgrade + msg_ok "Updated ${APP} LXC" + exit +} + +start +build_container + +CT_CONF="/etc/pve/lxc/${CTID}.conf" + +msg_info "Configuring TUN/TAP support" +cat <>"$CT_CONF" +lxc.cgroup2.devices.allow: c 10:200 rwm +lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file +EOF +msg_ok "Configured TUN/TAP support" + +msg_info "Rebooting container to apply configuration" +pct reboot "$CTID" + +msg_info "Waiting for container to be back online" +MAX_ATTEMPTS=60 +ATTEMPT=1 +while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do + STATUS=$(pct status "$CTID" | grep -o "running") + if [ "$STATUS" = "running" ] && pct exec "$CTID" -- true >/dev/null 2>&1; then + msg_ok "Container is back online" + break + fi + echo -n "." + sleep 2 + ATTEMPT=$((ATTEMPT + 1)) +done + +if [ $ATTEMPT -gt $MAX_ATTEMPTS ]; then + msg_error "Container failed to come back online within $MAX_ATTEMPTS attempts" + exit 1 +fi + +msg_ok "Running Kasm installer" +pct exec "$CTID" -- bash -c " +chmod +x /opt/kasm_release/install.sh +printf 'y\ny\ny\n4\n' | bash /opt/kasm_release/install.sh | tee ~/kasm-install.output +sed -n '/Kasm UI Login Credentials/,\$p' ~/kasm-install.output > ~/kasm.creds +" + +msg_ok "Installed Kasm Workspaces" + +description + +msg_ok "Completed Successfully!\n" +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}https://${IP}:443${CL}" diff --git a/frontend/public/json/kasm.json b/frontend/public/json/kasm.json new file mode 100644 index 0000000..6a2e7f8 --- /dev/null +++ b/frontend/public/json/kasm.json @@ -0,0 +1,44 @@ +{ + "name": "Kasm", + "slug": "kasm", + "categories": [ + 9 + ], + "date_created": "2025-03-24", + "type": "ct", + "updateable": false, + "privileged": true, + "config_path": "", + "interface_port": 443, + "documentation": "https://www.kasmweb.com/docs/", + "website": "https://www.kasmweb.com/", + "logo": "https://raw.githubusercontent.com/selfhst/icons/refs/heads/main/svg/kasm.svg", + "description": "Kasm Workspaces is a container streaming platform that delivers browser-based access to desktops, applications, and web services with enhanced security and scalability.", + "install_methods": [ + { + "type": "default", + "script": "ct/kasm.sh", + "resources": { + "cpu": 2, + "ram": 4096, + "hdd": 50, + "os": "Debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "WARNING: Installation sources scripts outside of Community Scripts repo. Please check the source before installing.", + "type": "warning" + }, + { + "text": "Show password: `cat ~/kasm.creds`", + "type": "info" + } + ] +} diff --git a/install/kasm-install.sh b/install/kasm-install.sh new file mode 100644 index 0000000..30b6504 --- /dev/null +++ b/install/kasm-install.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Omar Minaya +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.kasmweb.com/docs/1.10.0/install/single_server_install.html + +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 \ + curl \ + sudo \ + wget +msg_ok "Installed Dependencies" + +msg_info "Installing Kasm Workspaces" +KASM_VERSION=$(curl -s 'https://www.kasmweb.com/downloads' | grep -o 'https://kasm-static-content.s3.amazonaws.com/kasm_release_[^"]*\.tar\.gz' | head -n 1 | sed -E 's/.*release_(.*)\.tar\.gz/\1/') +msg_ok "Latest Kasm Version: $KASM_VERSION" + +wget -q -P /opt "https://kasm-static-content.s3.amazonaws.com/kasm_release_${KASM_VERSION}.tar.gz" +cd /opt +tar -xf "kasm_release_${KASM_VERSION}.tar.gz" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"