Delete kasmvnc directory
							parent
							
								
									e446e598fd
								
							
						
					
					
						commit
						fc2cb09f85
					
				@ -1,54 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
display_name: KasmVNC
 | 
			
		||||
description: A modern open source VNC server
 | 
			
		||||
icon: ../.icons/kasmvnc.svg
 | 
			
		||||
maintainer_github: coder
 | 
			
		||||
verified: true
 | 
			
		||||
tags: [helper, VNC, web]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# KasmVNC
 | 
			
		||||
 | 
			
		||||
Automatically install [KasmVNC](https://kasmweb.com/kasmvnc.png) in a workspace, and create an app to access it via the dashboard.
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
## Examples
 | 
			
		||||
 | 
			
		||||
1. Add latest version of KasmVNC with [`lxde`](https://www.lxde.org/) desktop environment:
 | 
			
		||||
 | 
			
		||||
   ```hcl
 | 
			
		||||
   module "kasmvnc" {
 | 
			
		||||
     source   = "https://registry.coder.com/modules/kasmvnc"
 | 
			
		||||
     agent_id = coder_agent.example.id
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
   ```
 | 
			
		||||
 | 
			
		||||
2. Add specific version of KasmVNC with [`mate`](https://mate-desktop.org/) desktop environment and custom port:
 | 
			
		||||
 | 
			
		||||
   ```hcl
 | 
			
		||||
   module "kasmvnc" {
 | 
			
		||||
     source              = "https://registry.coder.com/modules/kasmvnc"
 | 
			
		||||
     agent_id            = coder_agent.example.id
 | 
			
		||||
     custom_version      = "1.0.0"
 | 
			
		||||
     desktop_environment = "mate"
 | 
			
		||||
     port                = 6080
 | 
			
		||||
   }
 | 
			
		||||
   ```
 | 
			
		||||
 | 
			
		||||
3. Use custom timezone and locale:
 | 
			
		||||
 | 
			
		||||
   ```hcl
 | 
			
		||||
   module "kasmvnc" {
 | 
			
		||||
     source              = "https://registry.coder.com/modules/kasmvnc"
 | 
			
		||||
     agent_id            = coder_agent.example.id
 | 
			
		||||
     custom_version      = "1.0.0"
 | 
			
		||||
     desktop_environment = "mate"
 | 
			
		||||
     port                = 6080
 | 
			
		||||
     locale              = "en_US.UTF-8"
 | 
			
		||||
     timezone            = "America/Los_Angeles"
 | 
			
		||||
   }
 | 
			
		||||
   ```
 | 
			
		||||
 | 
			
		||||
   > **Note:** It is recommended to pre-install a desktop environment in your Dockerfile/VM image to speed up the startup time of your workspace.
 | 
			
		||||
@ -1,76 +0,0 @@
 | 
			
		||||
terraform {
 | 
			
		||||
  required_version = ">= 1.0"
 | 
			
		||||
 | 
			
		||||
  required_providers {
 | 
			
		||||
    coder = {
 | 
			
		||||
      source  = "coder/coder"
 | 
			
		||||
      version = ">= 0.12"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "agent_id" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "The ID of a Coder agent."
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "port" {
 | 
			
		||||
  type        = number
 | 
			
		||||
  description = "The port to run KasmVNC on."
 | 
			
		||||
  default     = 8443
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "desktop_environment" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "The desktop environment to for KasmVNC (xfce, lxde, mate, etc)."
 | 
			
		||||
  default     = "lxde"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "custom_version" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "Version of KasmVNC to install."
 | 
			
		||||
  default     = "1.2.0"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "locale" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "Locale to use for KasmVNC."
 | 
			
		||||
  default     = "en_US.UTF-8"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "timezone" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "Timezone to use for KasmVNC."
 | 
			
		||||
  default     = "Etc/UTC"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "log_path" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "Path to store KasmVNC logs."
 | 
			
		||||
  default     = "~/.kasmvnc/kasmvnc.log"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
resource "coder_script" "kasm_vnc" {
 | 
			
		||||
  agent_id     = var.agent_id
 | 
			
		||||
  display_name = "KasmVNC"
 | 
			
		||||
  icon         = "/icon/kasmvnc.svg"
 | 
			
		||||
  script = templatefile("${path.module}/run.sh", {
 | 
			
		||||
    PORT : var.port,
 | 
			
		||||
    DESKTOP_ENVIRONMENT : var.desktop_environment,
 | 
			
		||||
    VERSION : var.custom_version,
 | 
			
		||||
    LOG_PATH : var.log_path,
 | 
			
		||||
    LOCALE : var.locale,
 | 
			
		||||
    TIMEZONE : var.timezone
 | 
			
		||||
  })
 | 
			
		||||
  run_on_start = true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
resource "coder_app" "kasm_vnc" {
 | 
			
		||||
  agent_id     = var.agent_id
 | 
			
		||||
  slug         = "kasm-vnc"
 | 
			
		||||
  display_name = "kasmVNC"
 | 
			
		||||
  url          = "http://localhost:${var.port}"
 | 
			
		||||
  icon         = "/icon/kasmvnc.svg"
 | 
			
		||||
  subdomain    = false
 | 
			
		||||
  share        = "owner"
 | 
			
		||||
}
 | 
			
		||||
@ -1,65 +0,0 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
# Update package list first
 | 
			
		||||
sudo apt-get update
 | 
			
		||||
 | 
			
		||||
# Pre-configure selections for tzdata
 | 
			
		||||
if [[ ! -f /etc/timezone ]]; then
 | 
			
		||||
    echo "tzdata tzdata/Areas select Etc" | sudo debconf-set-selections
 | 
			
		||||
    echo "tzdata tzdata/Zones/Etc select ${TIMEZONE}" | sudo debconf-set-selections
 | 
			
		||||
    sudo DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Pre-configure locales
 | 
			
		||||
echo "locales locales/default_environment_locale select ${LOCALE}" | sudo debconf-set-selections
 | 
			
		||||
echo "locales locales/locales_to_be_generated multiselect ${LOCALE} UTF-8" | sudo debconf-set-selections
 | 
			
		||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y locales
 | 
			
		||||
 | 
			
		||||
# Check if desktop environment is installed
 | 
			
		||||
if ! dpkg -s ${DESKTOP_ENVIRONMENT} &>/dev/null; then
 | 
			
		||||
    sudo DEBIAN_FRONTEND=noninteractive apt-get install -y ${DESKTOP_ENVIRONMENT}
 | 
			
		||||
else
 | 
			
		||||
    echo "${DESKTOP_ENVIRONMENT} is already installed."
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Make sure lsb-release is installed
 | 
			
		||||
sudo apt-get install -y lsb-release
 | 
			
		||||
 | 
			
		||||
# Fetch Ubuntu distribution codename
 | 
			
		||||
codename=$(lsb_release -cs)
 | 
			
		||||
 | 
			
		||||
# Check if vncserver is installed
 | 
			
		||||
if ! dpkg -s kasmvncserver &>/dev/null; then
 | 
			
		||||
    cd /tmp
 | 
			
		||||
    wget "https://github.com/kasmtech/KasmVNC/releases/download/v${VERSION}/kasmvncserver_$${codename}_${VERSION}_amd64.deb"
 | 
			
		||||
    sudo apt-get install -y ./kasmvncserver_$${codename}_${VERSION}_amd64.deb
 | 
			
		||||
    if [ $? -eq 0 ]; then
 | 
			
		||||
        printf "🥳 KasmVNC v${VERSION} has been successfully installed!\n\n"
 | 
			
		||||
    else
 | 
			
		||||
        echo "Failed to install KasmVNC."
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
else
 | 
			
		||||
    echo "KasmVNC is already installed."
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
sudo addgroup $USER ssl-cert
 | 
			
		||||
sudo mkdir -p /etc/kasmvnc
 | 
			
		||||
# Coder port-forwarding from dashboard only supports HTTP
 | 
			
		||||
sudo bash -c 'cat > /etc/kasmvnc/kasmvnc.yaml <<EOF
 | 
			
		||||
network:
 | 
			
		||||
  protocol: http
 | 
			
		||||
  websocket_port: ${PORT}
 | 
			
		||||
  ssl:
 | 
			
		||||
    require_ssl: false
 | 
			
		||||
  udp:
 | 
			
		||||
    public_ip: 127.0.0.1
 | 
			
		||||
EOF'
 | 
			
		||||
 | 
			
		||||
# This password is not used since we start the server without auth.
 | 
			
		||||
# The server is protected via the Coder session token / tunnel
 | 
			
		||||
# and does not listen publicly on the VM
 | 
			
		||||
echo -e "password\npassword\n" | vncpasswd -wo -u $USER
 | 
			
		||||
 | 
			
		||||
# Start the server :)
 | 
			
		||||
sudo -u $USER bash -c "vncserver -select-de \"${DESKTOP_ENVIRONMENT}\" -disableBasicAuth >${LOG_PATH} 2>&1 &"
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue