From df13dd31b29d43e9502a8158618704c29a3904d5 Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 18 May 2025 21:49:44 -0400 Subject: [PATCH 1/5] 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" From 7b0864596b9f091e3bf246a4172f5a8f6df32146 Mon Sep 17 00:00:00 2001 From: Omar Minaya Date: Tue, 20 May 2025 14:37:19 -0400 Subject: [PATCH 2/5] using new build.func for tun and fuse --- ct/kasm.sh | 88 +++++++++++------------------------------ install/kasm-install.sh | 14 ++++++- 2 files changed, 37 insertions(+), 65 deletions(-) diff --git a/ct/kasm.sh b/ct/kasm.sh index 8dd7957..783936b 100644 --- a/ct/kasm.sh +++ b/ct/kasm.sh @@ -1,19 +1,20 @@ #!/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 +source <(curl -s https://raw.githubusercontent.com/omiinaya/ProxmoxVED/refs/heads/testing2/misc/build.func) +# Copyright (c) 2021-2025 tteck # 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 +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://www.debian.org/ 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" +var_tags="${var_tags:-os}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-4192}" +var_disk="${var_disk:-50}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" +var_fuse="${var_fuse:-1}" +var_tun="${var_tun:-1}" header_info "$APP" variables @@ -21,63 +22,22 @@ 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" + header_info + check_container_storage + check_container_resources + if [[ ! -d /var ]]; 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" diff --git a/install/kasm-install.sh b/install/kasm-install.sh index 30b6504..45f4fe2 100644 --- a/install/kasm-install.sh +++ b/install/kasm-install.sh @@ -24,9 +24,21 @@ 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" +msg_ok "Downloading installer..." +curl -fsSL -o "/opt/kasm_release_${KASM_VERSION}.tar.gz" "https://kasm-static-content.s3.amazonaws.com/kasm_release_${KASM_VERSION}.tar.gz" + +msg_ok "Extracting installer..." cd /opt tar -xf "kasm_release_${KASM_VERSION}.tar.gz" +chmod +x /opt/kasm_release/install.sh + +msg_ok "Installing Kasm..." +printf 'y\ny\ny\n4\n' | bash /opt/kasm_release/install.sh | tee ~/kasm-install.output + +msg_ok "Storing credentials..." +sed -n '/Kasm UI Login Credentials/,$p' ~/kasm-install.output > ~/kasm.creds + +msg_ok "Installed Kasm Workspaces" motd_ssh customize From e75ddec54add427d21030d8163533b3acab1f1eb Mon Sep 17 00:00:00 2001 From: Omar Minaya Date: Tue, 20 May 2025 14:38:37 -0400 Subject: [PATCH 3/5] correcting build.func source --- ct/kasm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/kasm.sh b/ct/kasm.sh index 783936b..3bcb90d 100644 --- a/ct/kasm.sh +++ b/ct/kasm.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/omiinaya/ProxmoxVED/refs/heads/testing2/misc/build.func) +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) # Copyright (c) 2021-2025 tteck # Author: Omar Minaya # License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE From 118d744f54862714866dac1e817e08d5fc1542ea Mon Sep 17 00:00:00 2001 From: Omar Minaya Date: Tue, 20 May 2025 15:14:45 -0400 Subject: [PATCH 4/5] applying suggested changes. --- install/kasm-install.sh | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/install/kasm-install.sh b/install/kasm-install.sh index 45f4fe2..0aeff08 100644 --- a/install/kasm-install.sh +++ b/install/kasm-install.sh @@ -13,37 +13,21 @@ 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" - -msg_ok "Downloading installer..." curl -fsSL -o "/opt/kasm_release_${KASM_VERSION}.tar.gz" "https://kasm-static-content.s3.amazonaws.com/kasm_release_${KASM_VERSION}.tar.gz" - -msg_ok "Extracting installer..." cd /opt tar -xf "kasm_release_${KASM_VERSION}.tar.gz" chmod +x /opt/kasm_release/install.sh - -msg_ok "Installing Kasm..." printf 'y\ny\ny\n4\n' | bash /opt/kasm_release/install.sh | tee ~/kasm-install.output - -msg_ok "Storing credentials..." sed -n '/Kasm UI Login Credentials/,$p' ~/kasm-install.output > ~/kasm.creds - msg_ok "Installed Kasm Workspaces" motd_ssh customize msg_info "Cleaning up" +$STD rm -f /opt/kasm_release_${KASM_VERSION}.tar.gz $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned" From df0839f8d6f628662eca0233fc431391affd39de Mon Sep 17 00:00:00 2001 From: Omar Minaya Date: Tue, 20 May 2025 15:49:25 -0400 Subject: [PATCH 5/5] applying suggested changes. --- ct/kasm.sh | 6 +++--- install/kasm-install.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ct/kasm.sh b/ct/kasm.sh index 3bcb90d..0e1777c 100644 --- a/ct/kasm.sh +++ b/ct/kasm.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) -# Copyright (c) 2021-2025 tteck +# Copyright (c) 2021-2025 community-scripts ORG # Author: Omar Minaya -# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE -# Source: https://www.debian.org/ +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.kasmweb.com/docs/latest/index.html APP="Kasm" var_tags="${var_tags:-os}" diff --git a/install/kasm-install.sh b/install/kasm-install.sh index 0aeff08..4c05433 100644 --- a/install/kasm-install.sh +++ b/install/kasm-install.sh @@ -3,7 +3,7 @@ # 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: https://www.kasmweb.com/docs/latest/index.html source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" color