Skip to content

Add Parsec module for low-latency remote desktop streaming #227

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added registry/glitchdoescode/.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.
11 changes: 11 additions & 0 deletions registry/glitchdoescode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
display_name: "glitchdoescode"
bio: "Open source enthusiast and code contributor"
avatar_url: "./.images/avatar.png"
github: "glitchdoescode"
status: "community"
---

# glitchdoescode

Open source enthusiast and code contributor, passionate about making development tools more accessible and efficient.
174 changes: 174 additions & 0 deletions registry/glitchdoescode/modules/parsec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
---
display_name: Parsec
description: Low-latency remote desktop streaming for gaming and creative work
icon: ../../../../.icons/desktop.svg
maintainer_github: glitchdoescode
verified: false
tags: [remote-desktop, streaming, gaming, creative, low-latency]
---

# Parsec

Automatically install and configure [Parsec](https://parsec.app/) for low-latency remote desktop access in your Coder workspace. Parsec provides near-zero latency streaming with up to 4K resolution at 60 FPS, making it ideal for gaming, video editing, and other graphics-intensive applications.

## Features

- **Ultra-low latency**: Near-zero latency for responsive remote desktop access
- **High performance**: Up to 4K resolution at 60 FPS with hardware acceleration
- **Cross-platform**: Connect from any device to your Linux workspace
- **Secure**: Peer-to-peer connections with enterprise-grade security
- **Optimized**: Built specifically for gaming and creative workflows

## Basic Usage

```tf
module "parsec" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/glitchdoescode/parsec/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
}
```

## Advanced Configuration

### Specify Installation Method

```tf
module "parsec" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/glitchdoescode/parsec/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
installation_method = "deb" # Options: "auto", "deb", "appimage"
}
```

### Disable Hardware Acceleration

```tf
module "parsec" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/glitchdoescode/parsec/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
enable_hardware_acceleration = false
}
```

### Complete Example with Grouping

```tf
module "parsec" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/glitchdoescode/parsec/coder"
version = "1.0.0"
agent_id = coder_agent.example.id

# UI positioning
order = 1
group = "Remote Access"

# Performance settings
enable_hardware_acceleration = true
installation_method = "auto"
}
```

## Installation Methods

The module supports multiple installation methods:

- **`auto`** (default): Automatically detects your Linux distribution and chooses the best method
- **`deb`**: Uses the official DEB package for Ubuntu/Debian systems
- **`appimage`**: Uses the universal AppImage for maximum compatibility

## System Requirements

### Minimum Requirements

- Linux distribution (Ubuntu, Debian, Arch, Fedora, etc.)
- X11 or Wayland display server
- Audio system (PulseAudio or ALSA)
- Network connection

### Recommended for Best Performance

- Dedicated GPU (NVIDIA, AMD, or Intel)
- Hardware acceleration drivers installed
- Fast internet connection (minimum 5 Mbps)

## Supported Distributions

- ✅ Ubuntu 18.04+ (LTS recommended)
- ✅ Debian 10+
- ✅ Arch Linux
- ✅ Fedora 32+
- ✅ CentOS 8+
- ✅ Manjaro
- ✅ Pop!\_OS
- ✅ Most other Linux distributions via AppImage

## Getting Started

1. **Install the module** in your Coder template
2. **Start your workspace** - Parsec will install automatically
3. **Launch Parsec** from your applications menu or run `parsec` in terminal
4. **Create a Parsec account** at [parsec.app](https://parsec.app)
5. **Connect** from any device using the Parsec client

## Hardware Acceleration

When enabled (default), the module installs appropriate drivers for:

- **Intel**: VA-API drivers for Intel integrated graphics
- **NVIDIA**: VDPAU drivers for NVIDIA GPUs
- **AMD**: Mesa drivers for AMD GPUs

## Security

Parsec uses:

- **Peer-to-peer connections** - Traffic never goes through Parsec servers
- **AES-256 encryption** - All data is encrypted in transit
- **Host control** - You control exactly what guests can access

## Troubleshooting

### Audio Issues

If you don't hear audio, ensure your audio system is properly configured:

```bash
# Check audio system
pulseaudio --check -v

# Restart PulseAudio if needed
pulseaudio -k && pulseaudio --start
```

### Graphics Issues

For optimal performance, ensure graphics drivers are installed:

```bash
# Check for graphics acceleration
vainfo # For VA-API
vdpauinfo # For VDPAU
```

### Connection Issues

- Ensure your firewall allows Parsec connections
- Check your network connection speed
- Verify Parsec service is running: `systemctl --user status parsec`

## Variables

| Variable | Type | Default | Description |
| ------------------------------ | ------ | -------- | ------------------------------------------------------- |
| `agent_id` | string | - | **Required.** The ID of a Coder agent |
| `installation_method` | string | `"auto"` | Installation method: `"auto"`, `"deb"`, or `"appimage"` |
| `enable_hardware_acceleration` | bool | `true` | Enable hardware acceleration for optimal performance |
| `order` | number | `null` | Position in the Coder dashboard |
| `group` | string | `null` | Group name for organization |
71 changes: 71 additions & 0 deletions registry/glitchdoescode/modules/parsec/main.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { describe, expect, it } from "bun:test";
import {
runTerraformApply,
runTerraformInit,
testRequiredVariables,
} from "~test";

describe("parsec", async () => {
await runTerraformInit(import.meta.dir);

testRequiredVariables(import.meta.dir, {
agent_id: "foo",
});

it("accepts valid installation methods", async () => {
await runTerraformApply(import.meta.dir, {
agent_id: "foo",
installation_method: "auto",
});

await runTerraformApply(import.meta.dir, {
agent_id: "foo",
installation_method: "deb",
});

await runTerraformApply(import.meta.dir, {
agent_id: "foo",
installation_method: "appimage",
});
});

it("rejects invalid installation methods", () => {
const t = async () => {
await runTerraformApply(import.meta.dir, {
agent_id: "foo",
installation_method: "invalid",
});
};
expect(t).toThrow("Installation method must be one of: auto, deb, appimage");
});

it("accepts hardware acceleration settings", async () => {
await runTerraformApply(import.meta.dir, {
agent_id: "foo",
enable_hardware_acceleration: true,
});

await runTerraformApply(import.meta.dir, {
agent_id: "foo",
enable_hardware_acceleration: false,
});
});

it("sets default values correctly", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
});

// Check that default values are applied
expect(state.outputs.parsec_info.value.installation_method).toBe("auto");
expect(state.outputs.parsec_info.value.hardware_acceleration).toBe(true);
});

it("configures UI positioning", async () => {
await runTerraformApply(import.meta.dir, {
agent_id: "foo",
order: 1,
group: "Remote Access",
});
});
});
80 changes: 80 additions & 0 deletions registry/glitchdoescode/modules/parsec/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
terraform {
required_version = ">= 1.0"

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

variable "agent_id" {
type = string
description = "The ID of a Coder agent."
}

variable "installation_method" {
type = string
description = "Installation method for Parsec: 'auto' (detect), 'deb' (Ubuntu/Debian), or 'appimage' (universal)"
default = "auto"
validation {
condition = contains(["auto", "deb", "appimage"], var.installation_method)
error_message = "Installation method must be one of: auto, deb, appimage"
}
}

variable "enable_hardware_acceleration" {
type = bool
description = "Enable hardware acceleration for optimal performance"
default = true
}

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
}

variable "group" {
type = string
description = "The name of a group that this app belongs to."
default = null
}

data "coder_workspace" "me" {}
data "coder_workspace_owner" "me" {}

resource "coder_script" "parsec" {
agent_id = var.agent_id
display_name = "Parsec"
icon = "/icon/desktop.svg"
script = templatefile("${path.module}/run.sh", {
INSTALLATION_METHOD = var.installation_method,
ENABLE_HARDWARE_ACCELERATION = var.enable_hardware_acceleration ? "true" : "false"
})
run_on_start = true
run_on_stop = false
}

resource "coder_app" "parsec" {
agent_id = var.agent_id
slug = "parsec"
display_name = "Parsec"
icon = "/icon/desktop.svg"
external = true
order = var.order
group = var.group

# Parsec uses a custom protocol, so we'll launch the installed app
url = "parsec://"
}

output "parsec_info" {
value = {
installation_method = var.installation_method
hardware_acceleration = var.enable_hardware_acceleration
status = "Parsec installation completed"
}
description = "Information about the Parsec installation"
}
Loading
Loading