Skip to content
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
59c2932
Add Rustdesk module
Jul 24, 2025
eef8b83
Update README.md
Jul 24, 2025
1a53794
Update README.md
BenraouaneSoufiane Jul 24, 2025
89bd112
Delete registry/benraouanesoufiane directory
BenraouaneSoufiane Jul 24, 2025
3632017
Update README.md
BenraouaneSoufiane Jul 24, 2025
66854ab
Merge branch 'coder:main' into main
BenraouaneSoufiane Jul 30, 2025
03c06e6
Fix mentionned issues
Jul 30, 2025
2f593bb
Moving module to BenraouaneSoufiane & updating readme.md
Jul 30, 2025
1b285fb
Merge branch 'coder:main' into main
BenraouaneSoufiane Jul 31, 2025
b1210b7
Merge branch 'main' into main
DevelopmentCats Aug 13, 2025
8d198a2
Delete rustdesk-1.1.9.deb
BenraouaneSoufiane Aug 13, 2025
e0521fc
Delete rustdesk-1.1.9.deb.1
BenraouaneSoufiane Aug 13, 2025
c7124c9
Delete rustdesk-1.4.0-x86_64.deb
BenraouaneSoufiane Aug 13, 2025
79cc39e
Delete rustdesk-1.4.0-x86_64.deb.1
BenraouaneSoufiane Aug 13, 2025
d20b0f0
Delete rustdesk-1.4.0-x86_64.deb.2
BenraouaneSoufiane Aug 13, 2025
832981c
Delete rustdesk-1.4.0-x86_64.deb.3
BenraouaneSoufiane Aug 13, 2025
918f79b
Fix outlined issues
Aug 13, 2025
ba840b7
Merge branch 'coder:main' into main
BenraouaneSoufiane Aug 13, 2025
d917244
Delete RustDesk.toml
BenraouaneSoufiane Aug 13, 2025
77a8e9a
Update registry/BenraouaneSoufiane/modules/rustdesk/README.md
BenraouaneSoufiane Aug 13, 2025
01f93a3
Update registry/BenraouaneSoufiane/modules/rustdesk/README.md
BenraouaneSoufiane Aug 13, 2025
3b11a27
Update registry/BenraouaneSoufiane/modules/rustdesk/main.tf
BenraouaneSoufiane Aug 13, 2025
97330a6
Update registry/BenraouaneSoufiane/modules/rustdesk/run.sh
BenraouaneSoufiane Aug 13, 2025
b889cff
Update registry/BenraouaneSoufiane/modules/rustdesk/run.sh
BenraouaneSoufiane Aug 13, 2025
15a734e
Merge branch 'coder:main' into main
BenraouaneSoufiane Aug 13, 2025
fb3ee63
Update README.md
BenraouaneSoufiane Aug 13, 2025
a8a2a75
Formatting files using fmt command
Aug 14, 2025
6ebd45b
Delete package-lock.json
BenraouaneSoufiane Aug 14, 2025
1c97157
chore: run bun run fmt
DevelopmentCats Aug 15, 2025
17ee696
chore: update avatar_url to avatar
DevelopmentCats Aug 15, 2025
2349eba
chore: restructure and clean up README
DevelopmentCats Aug 15, 2025
608a411
chore: bun run fmt
DevelopmentCats Aug 15, 2025
b20615d
chore: update examples
DevelopmentCats Aug 15, 2025
f5ca292
fix: change default version to latest unless specified instead of har…
DevelopmentCats Aug 15, 2025
2c94a68
fix: use sudo instead of requiring root
DevelopmentCats Aug 15, 2025
0797881
chore: bun run fmt
DevelopmentCats Aug 15, 2025
a777679
fix: add LOG_PATH
DevelopmentCats Aug 15, 2025
6a386b2
fix: update README and run script to remove XFCE dependency and clari…
DevelopmentCats Aug 15, 2025
97f6571
fix: add xkb-data and xkeyboard-config dependencies for proper instal…
DevelopmentCats Aug 15, 2025
1726629
Update README.md
BenraouaneSoufiane Aug 15, 2025
f91ac76
Merge branch 'coder:main' into main
BenraouaneSoufiane Aug 17, 2025
aa4d104
Update run.sh
BenraouaneSoufiane Aug 17, 2025
453766a
Merge branch 'coder:main' into main
BenraouaneSoufiane Aug 19, 2025
e7bf22b
chore: bun run fmt
DevelopmentCats Aug 21, 2025
72240b9
Merge branch 'main' into main
DevelopmentCats Aug 21, 2025
4d62fbd
Merge branch 'coder:main' into main
BenraouaneSoufiane Aug 21, 2025
78aaf88
fix: update installation dependencies for RustDesk on apt, dnf, and yum
DevelopmentCats Aug 22, 2025
e86b305
fix: update installation dependencies for RustDesk to include correct…
DevelopmentCats Aug 22, 2025
8484447
fix: improve logging and password generation in RustDesk setup script
DevelopmentCats Aug 22, 2025
55eaf1f
Merge branch 'coder:main' into main
BenraouaneSoufiane Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .icons/rustdesk.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added registry/BenraouaneSoufiane/.images/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions registry/BenraouaneSoufiane/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
display_name: "Benraouane Soufiane"
bio: "Full stack developer creating awesome things."
avatar_url: "./.images/avatar.png"
github: "benraouanesoufiane"
linkedin: "https://www.linkedin.com/in/benraouane-soufiane" # Optional
website: "https://benraouanesoufiane.com" # Optional
support_email: "[email protected]" # Optional
status: "community"
---

# Benraouane Soufiane

Full stack developer creating awesome things.
68 changes: 68 additions & 0 deletions registry/BenraouaneSoufiane/modules/rustdesk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
display_name: Rustdesk
description: Create desktop environmetn & run rustdesk in your workspace
icon: ../../../../.icons/rustdesk.svg
verified: false
tags: [rustdesk, rdp, vm]
---

# RustDesk Coder Module

This is the basic Coder's rustdesk module that install minimal desktop environment (xfce) & launches the rustdesk within your workspace

---

## Features

- Installs RustDesk & launches it in GUI not with black screen
- Outputs the RustDesk ID and password
- Automatically launches RustDesk on workspace start
- Provides an external app link to the [RustDesk web client](https://rustdesk.com/web)

---

## Usage

### Prerequisites

- Coder v2.5 or higher
- A workspace agent compatible with Linux and `apt` package manager
- Root scope (to install desktop environment, rustdesk & execute rustdesk --password "somepassword", because rustdesk cli does not provide a way to get the password else setup in advance, the command rustdesk --password "somepassword" only for root users)


---

### Quickstart

1. Add the module to your [Coder Terraform workspace](https://registry.coder.com)
2. Include it in your `main.tf`:

```tf
module "rustdesk" {
source = "registry.coder.com/BenraouaneSoufiane/rustdesk/BenraouaneSoufiane"
agent_id = var.agent_id
}
```
Also add this within resource "docker_container" "workspace":

```tf
privileged = true
user = "root"
network_mode = "host"
ports {
internal = 21115
external = 21115
}
ports {
internal = 21116
external = 21116
}
ports {
internal = 21118
external = 21118
}
ports {
internal = 21119
external = 21119
}
```
76 changes: 76 additions & 0 deletions registry/BenraouaneSoufiane/modules/rustdesk/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
terraform {
required_version = ">= 1.0"

required_providers {
coder = {
source = "coder/coder"
version = ">= 2.5"
}
}
}

variable "log_path" {
type = string
description = "The path to log rustdesk to."
default = "/tmp/rustdesk.log"
}

variable "agent_id" {
description = "Attach RustDesk setup to this agent"
type = string
}

variable "order" {
description = "Run order among scripts/apps"
type = number
default = 1
}

# Optional knobs passed as env (you can expose these as variables too)
variable "rustdesk_password" {
description = "If empty, the script will generate one"
type = string
default = ""
sensitive = true
}

variable "xvfb_resolution" {
description = "Xvfb screen size/depth"
type = string
default = "1024x768x16"
}

variable "rustdesk_version" {
description = "RustDesk version to install"
type = string
default = "1.4.0"
}

resource "coder_script" "rustdesk" {
agent_id = var.agent_id
display_name = "RustDesk"
run_on_start = true

# Prepend env as bash exports, then append the script file literally.
script = <<-EOT
# --- module-provided env knobs ---
export RUSTDESK_PASSWORD="${var.rustdesk_password}"
export XVFB_RESOLUTION="${var.xvfb_resolution}"
export RUSTDESK_VERSION="${var.rustdesk_version}"
# ---------------------------------

${file("${path.module}/run.sh")}
EOT
}

resource "coder_app" "rustdesk" {
count = 1
agent_id = var.agent_id
slug = "rustdesk"
display_name = "Rustdesk"
url = "https://rustdesk.com/web"
icon = "/icon/rustdesk.svg"
order = var.order
external = true
}

83 changes: 83 additions & 0 deletions registry/BenraouaneSoufiane/modules/rustdesk/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env bash
set -euo pipefail

# ---- configurable knobs (env overrides) ----
RUSTDESK_VERSION="${RUSTDESK_VERSION:-1.4.0}"
XVFB_RESOLUTION="${XVFB_RESOLUTION:-1024x768x16}"
RUSTDESK_PASSWORD="${RUSTDESK_PASSWORD:-}"

# ---- detect package manager & arch ----
ARCH="$(uname -m)"
case "$ARCH" in
x86_64|amd64) PKG_ARCH="x86_64" ;;
aarch64|arm64) PKG_ARCH="aarch64" ;;
*) echo "Unsupported arch: $ARCH"; exit 1 ;;
esac

if command -v apt-get >/dev/null 2>&1; then
PKG_SYS="deb"
PKG_NAME="rustdesk-${RUSTDESK_VERSION}-${PKG_ARCH}.deb"
INSTALL_DEPS='apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wget ca-certificates xvfb dbus-x11'
INSTALL_CMD="apt-get install -y ./${PKG_NAME}"
CLEAN_CMD="rm -f \"${PKG_NAME}\""
elif command -v dnf >/dev/null 2>&1; then
PKG_SYS="rpm"
PKG_NAME="rustdesk-${RUSTDESK_VERSION}-${PKG_ARCH}.rpm"
INSTALL_DEPS='dnf install -y wget ca-certificates xorg-x11-server-Xvfb dbus-x11 || true'
INSTALL_CMD="dnf install -y ./${PKG_NAME}"
CLEAN_CMD="rm -f \"${PKG_NAME}\""
elif command -v yum >/dev/null 2>&1; then
PKG_SYS="rpm"
PKG_NAME="rustdesk-${RUSTDESK_VERSION}-${PKG_ARCH}.rpm"
INSTALL_DEPS='yum install -y wget ca-certificates xorg-x11-server-Xvfb dbus-x11 || true'
INSTALL_CMD="yum install -y ./${PKG_NAME}"
CLEAN_CMD="rm -f \"${PKG_NAME}\""
else
echo "Unsupported distro: need apt, dnf, or yum."
exit 1
fi

# ---- install rustdesk if missing ----
if ! command -v rustdesk >/dev/null 2>&1; then
echo "Installing dependencies…"
bash -lc "$INSTALL_DEPS"

echo "Downloading RustDesk ${RUSTDESK_VERSION} (${PKG_SYS}, ${PKG_ARCH})…"
URL="https://github.com/rustdesk/rustdesk/releases/download/${RUSTDESK_VERSION}/${PKG_NAME}"
wget -q "$URL"

echo "Installing RustDesk…"
bash -lc "$INSTALL_CMD"

echo "Cleaning up…"
bash -lc "$CLEAN_CMD"
fi

# ---- start virtual display ----
echo "Starting Xvfb with resolution ${XVFB_RESOLUTION}…"
Xvfb :99 -screen 0 "${XVFB_RESOLUTION}" &
export DISPLAY=:99

# ---- create (or accept) password and start rustdesk ----
if [[ -z "${RUSTDESK_PASSWORD}" ]]; then
RUSTDESK_PASSWORD="$(tr -dc 'a-zA-Z0-9' </dev/urandom | head -c 6)"
fi

# give the desktop a moment to come up if you launch XFCE/etc elsewhere
sleep 3

# set password (daemonless; rustdesk CLI handles it)
rustdesk --password "${RUSTDESK_PASSWORD}" >/dev/null 2>&1 || true
rustdesk &

sleep 3
RID="$(rustdesk --get-id || true)"

echo "-----------------------------"
echo " RustDesk ID: ${RID}"
echo " RustDesk Password: ${RUSTDESK_PASSWORD}"
echo " Display (Xvfb): ${DISPLAY} (${XVFB_RESOLUTION})"
echo "-----------------------------"

# keep the script alive if needed (helpful in some runners)
wait -n || true
Loading