-
Notifications
You must be signed in to change notification settings - Fork 73
Add Rustdesk module #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add Rustdesk module #266
Changes from 8 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
59c2932
Add Rustdesk module
eef8b83
Update README.md
1a53794
Update README.md
BenraouaneSoufiane 89bd112
Delete registry/benraouanesoufiane directory
BenraouaneSoufiane 3632017
Update README.md
BenraouaneSoufiane 66854ab
Merge branch 'coder:main' into main
BenraouaneSoufiane 03c06e6
Fix mentionned issues
2f593bb
Moving module to BenraouaneSoufiane & updating readme.md
1b285fb
Merge branch 'coder:main' into main
BenraouaneSoufiane b1210b7
Merge branch 'main' into main
DevelopmentCats 8d198a2
Delete rustdesk-1.1.9.deb
BenraouaneSoufiane e0521fc
Delete rustdesk-1.1.9.deb.1
BenraouaneSoufiane c7124c9
Delete rustdesk-1.4.0-x86_64.deb
BenraouaneSoufiane 79cc39e
Delete rustdesk-1.4.0-x86_64.deb.1
BenraouaneSoufiane d20b0f0
Delete rustdesk-1.4.0-x86_64.deb.2
BenraouaneSoufiane 832981c
Delete rustdesk-1.4.0-x86_64.deb.3
BenraouaneSoufiane 918f79b
Fix outlined issues
ba840b7
Merge branch 'coder:main' into main
BenraouaneSoufiane d917244
Delete RustDesk.toml
BenraouaneSoufiane 77a8e9a
Update registry/BenraouaneSoufiane/modules/rustdesk/README.md
BenraouaneSoufiane 01f93a3
Update registry/BenraouaneSoufiane/modules/rustdesk/README.md
BenraouaneSoufiane 3b11a27
Update registry/BenraouaneSoufiane/modules/rustdesk/main.tf
BenraouaneSoufiane 97330a6
Update registry/BenraouaneSoufiane/modules/rustdesk/run.sh
BenraouaneSoufiane b889cff
Update registry/BenraouaneSoufiane/modules/rustdesk/run.sh
BenraouaneSoufiane 15a734e
Merge branch 'coder:main' into main
BenraouaneSoufiane fb3ee63
Update README.md
BenraouaneSoufiane a8a2a75
Formatting files using fmt command
6ebd45b
Delete package-lock.json
BenraouaneSoufiane 1c97157
chore: run bun run fmt
DevelopmentCats 17ee696
chore: update avatar_url to avatar
DevelopmentCats 2349eba
chore: restructure and clean up README
DevelopmentCats 608a411
chore: bun run fmt
DevelopmentCats b20615d
chore: update examples
DevelopmentCats f5ca292
fix: change default version to latest unless specified instead of har…
DevelopmentCats 2c94a68
fix: use sudo instead of requiring root
DevelopmentCats 0797881
chore: bun run fmt
DevelopmentCats a777679
fix: add LOG_PATH
DevelopmentCats 6a386b2
fix: update README and run script to remove XFCE dependency and clari…
DevelopmentCats 97f6571
fix: add xkb-data and xkeyboard-config dependencies for proper instal…
DevelopmentCats 1726629
Update README.md
BenraouaneSoufiane f91ac76
Merge branch 'coder:main' into main
BenraouaneSoufiane aa4d104
Update run.sh
BenraouaneSoufiane 453766a
Merge branch 'coder:main' into main
BenraouaneSoufiane e7bf22b
chore: bun run fmt
DevelopmentCats 72240b9
Merge branch 'main' into main
DevelopmentCats 4d62fbd
Merge branch 'coder:main' into main
BenraouaneSoufiane 78aaf88
fix: update installation dependencies for RustDesk on apt, dnf, and yum
DevelopmentCats e86b305
fix: update installation dependencies for RustDesk to include correct…
DevelopmentCats 8484447
fix: improve logging and password generation in RustDesk setup script
DevelopmentCats 55eaf1f
Merge branch 'coder:main' into main
BenraouaneSoufiane b4b50d8
Merge branch 'main' into main
DevelopmentCats e7fb751
chore: format run.sh using bun run fmt
BenraouaneSoufiane 348b03f
Merge branch 'main' into main
BenraouaneSoufiane 9f14c2a
Merge branch 'main' into main
BenraouaneSoufiane 3a521dd
Merge branch 'main' into main
DevelopmentCats File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[security] | ||
password = "123456" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
BenraouaneSoufiane marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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 | ||
BenraouaneSoufiane marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
--- | ||
|
||
## 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`: | ||
|
||
```hcl | ||
module "rustdesk" { | ||
source = "registry.coder.com/BenraouaneSoufiane/rustdesk/BenraouaneSoufiane" | ||
agent_id = var.agent_id | ||
} | ||
``` | ||
Also add this within resource "docker_container" "workspace": | ||
|
||
```hcl | ||
BenraouaneSoufiane marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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 | ||
} | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
terraform { | ||
required_version = ">= 1.0" | ||
|
||
required_providers { | ||
coder = { | ||
source = "coder/coder" | ||
version = ">= 2.5" | ||
} | ||
} | ||
} | ||
|
||
locals { | ||
# A built-in icon like "/icon/code.svg" or a full URL of icon | ||
icon_url = "https://upload.wikimedia.org/wikipedia/commons/9/96/Rustdesk.svg" | ||
} | ||
BenraouaneSoufiane marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
# Add required variables for your modules and remove any unneeded variables | ||
variable "agent_id" { | ||
type = string | ||
description = "The ID of a Coder agent." | ||
} | ||
|
||
variable "log_path" { | ||
type = string | ||
description = "The path to log rustdesk to." | ||
default = "/tmp/rustdesk.log" | ||
} | ||
|
||
variable "port" { | ||
type = number | ||
description = "The port to run rustdesk on." | ||
default = 19999 | ||
} | ||
|
||
variable "order" { | ||
type = number | ||
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)." | ||
default = null | ||
} | ||
|
||
resource "coder_script" "rustdesk" { | ||
count = 1 | ||
agent_id = var.agent_id | ||
display_name = "Rustdesk" | ||
icon = local.icon_url | ||
script = templatefile("${path.module}/run.sh", {}) | ||
run_on_start = true | ||
run_on_stop = false | ||
} | ||
|
||
resource "coder_app" "rustdesk" { | ||
count = 1 | ||
BenraouaneSoufiane marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
agent_id = var.agent_id | ||
slug = "rustdesk" | ||
display_name = "Rustdesk" | ||
url = "https://rustdesk.com/web" | ||
icon = local.icon_url | ||
order = var.order | ||
external = true | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
# Check if RustDesk is installed | ||
if ! command -v rustdesk &> /dev/null; then | ||
echo "RustDesk is not installed. Installing..." | ||
|
||
# Download RustDesk manually | ||
RUSTDESK_VERSION="1.4.0" | ||
RUSTDESK_DEB="rustdesk-$RUSTDESK_VERSION-x86_64.deb" | ||
|
||
echo "Downloading RustDesk $RUSTDESK_VERSION..." | ||
wget "https://github.com/rustdesk/rustdesk/releases/download/$RUSTDESK_VERSION/$RUSTDESK_DEB" | ||
BenraouaneSoufiane marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
# Check if download was successful | ||
if [ $? -eq 0 ]; then | ||
echo "Installing dependencies..." | ||
sudo apt update | ||
sudo apt install -y libva2 libva-drm2 libva-x11-2 libgstreamer-plugins-base1.0-0 gstreamer1.0-pipewire xfce4 xfce4-goodies xvfb x11-xserver-utils dbus-x11 | ||
echo "Installing RustDesk..." | ||
sudo dpkg -i $RUSTDESK_DEB | ||
sudo apt-get install -f -y # To fix any dependencies | ||
rm $RUSTDESK_DEB # Clean up | ||
else | ||
echo "Failed to download RustDesk. Please check your network connection." | ||
exit 1 | ||
fi | ||
else | ||
echo "RustDesk is already installed." | ||
fi | ||
|
||
# Start perform other necessary actions perform other necessary actions | ||
echo "Starting Rustdesk..." | ||
# Start virtual display | ||
Xvfb :99 -screen 0 1024x768x16 & | ||
BenraouaneSoufiane marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
export DISPLAY=:99 | ||
|
||
# Wait for X to be ready | ||
for i in {1..10}; do | ||
if xdpyinfo -display :99 >/dev/null 2>&1; then | ||
echo "X display is ready" | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
|
||
# Start desktop environment | ||
xfce4-session & | ||
# Wait for xfce session to be ready (rudimentary check) | ||
echo "Waiting for xfce4-session to initialize..." | ||
sleep 5 # Adjust if needed | ||
|
||
rustdesk & | ||
# Start RustDesk with password | ||
generated=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 6 | head -n 1) | ||
rustdesk --password "$generated" & | ||
|
||
sleep 5 | ||
|
||
rid=$(rustdesk --get-id) | ||
echo "The ID is: $rid" | ||
echo "The password is: $generated" |
BenraouaneSoufiane marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.