fix: fix misc. issues (#45)
This commit is contained in:
committed by
GitHub
parent
1e3ac8be4c
commit
34aedce094
6
.github/workflows/ci.yaml
vendored
6
.github/workflows/ci.yaml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: oven-sh/setup-bun@v1
|
- uses: oven-sh/setup-bun@v1
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
@@ -24,8 +24,8 @@ jobs:
|
|||||||
fmt:
|
fmt:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: oven-sh/setup-bun@v1
|
- uses: oven-sh/setup-bun@v1
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
- run: bun fmt:ci
|
- run: bun fmt:ci
|
||||||
|
|||||||
BIN
.images/jupyterlab.png
Normal file
BIN
.images/jupyterlab.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 526 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 163 KiB |
@@ -1,17 +1,18 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
echo "Instalalting ${MODULE_NAME}..."
|
BOLD='\033[0;1m'
|
||||||
|
echo "$${BOLD}Installing MODULE_NAME..."
|
||||||
# Add code here
|
# Add code here
|
||||||
# Use varibles from the templatefile function in main.tf
|
# Use varibles from the templatefile function in main.tf
|
||||||
# e.g. LOG_PATH, PORT, etc.
|
# e.g. LOG_PATH, PORT, etc.
|
||||||
|
|
||||||
echo "Installation comlete!"
|
echo "🥳 Installation comlete!"
|
||||||
|
|
||||||
echo "Starting ${MODULE_NAME}..."
|
echo "👷 Starting MODULE_NAME in background..."
|
||||||
# Start the app in here
|
# Start the app in here
|
||||||
# 1. Use & to run it in background
|
# 1. Use & to run it in background
|
||||||
# 2. redirct stdout and stderr to log files
|
# 2. redirct stdout and stderr to log files
|
||||||
|
|
||||||
./app >${LOG_PATH} 2>&1 &
|
./app >${LOG_PATH} 2>&1 &
|
||||||
|
|
||||||
echo "Sample app started!"
|
echo "check logs at ${LOG_PATH}"
|
||||||
|
|||||||
@@ -10,3 +10,10 @@ tags: [helper]
|
|||||||
# Dotfiles
|
# Dotfiles
|
||||||
|
|
||||||
Allow developers to optionally bring their own [dotfiles repository](https://dotfiles.github.io)! Under the hood, this module uses the [coder dotfiles](https://coder.com/docs/v2/latest/dotfiles) command.
|
Allow developers to optionally bring their own [dotfiles repository](https://dotfiles.github.io)! Under the hood, this module uses the [coder dotfiles](https://coder.com/docs/v2/latest/dotfiles) command.
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
module "dotfiles" {
|
||||||
|
source = "https://registry.coder.com/modules/dotfiles"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ variable "agent_id" {
|
|||||||
|
|
||||||
data "coder_parameter" "dotfiles_uri" {
|
data "coder_parameter" "dotfiles_uri" {
|
||||||
type = "string"
|
type = "string"
|
||||||
|
name = "dotfiles_uri"
|
||||||
display_name = "Dotfiles URL (optional)"
|
display_name = "Dotfiles URL (optional)"
|
||||||
default = ""
|
default = ""
|
||||||
description = "Enter a URL for a [dotfiles repository](https://dotfiles.github.io) to personalize your workspace"
|
description = "Enter a URL for a [dotfiles repository](https://dotfiles.github.io) to personalize your workspace"
|
||||||
mutable = true
|
mutable = true
|
||||||
icon = "https://raw.githubusercontent.com/jglovier/dotfiles-logo/main/dotfiles-logo-icon.svg"
|
icon = "/icon/dotfiles.svg"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "coder_script" "personalize" {
|
resource "coder_script" "personalize" {
|
||||||
@@ -32,6 +33,6 @@ resource "coder_script" "personalize" {
|
|||||||
fi
|
fi
|
||||||
EOT
|
EOT
|
||||||
display_name = "Dotfiles"
|
display_name = "Dotfiles"
|
||||||
icon = "https://raw.githubusercontent.com/jglovier/dotfiles-logo/main/dotfiles-logo-icon.svg"
|
icon = "/icon/dotfiles.svg"
|
||||||
run_on_start = true
|
run_on_start = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ tags: [jupyter, helper, ide, web]
|
|||||||
|
|
||||||
A module that adds JupyterLab in your Coder template.
|
A module that adds JupyterLab in your Coder template.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
module "jupyterlab" {
|
module "jupyterlab" {
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ terraform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
locals {
|
|
||||||
icon_url = "/icon/jupyter.svg"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add required variables for your modules and remove any unneeded variables
|
# Add required variables for your modules and remove any unneeded variables
|
||||||
variable "agent_id" {
|
variable "agent_id" {
|
||||||
type = string
|
type = string
|
||||||
@@ -34,13 +30,12 @@ variable "port" {
|
|||||||
resource "coder_script" "jupyterlab" {
|
resource "coder_script" "jupyterlab" {
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
display_name = "jupyterlab"
|
display_name = "jupyterlab"
|
||||||
icon = local.icon_url
|
icon = "/icon/jupyter.svg"
|
||||||
script = templatefile("${path.module}/run.sh", {
|
script = templatefile("${path.module}/run.sh", {
|
||||||
LOG_PATH : var.log_path,
|
LOG_PATH : var.log_path,
|
||||||
PORT : var.port
|
PORT : var.port
|
||||||
})
|
})
|
||||||
run_on_start = true
|
run_on_start = true
|
||||||
run_on_stopt = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "coder_app" "jupyterlab" {
|
resource "coder_app" "jupyterlab" {
|
||||||
@@ -48,7 +43,7 @@ resource "coder_app" "jupyterlab" {
|
|||||||
slug = "jupyterlab"
|
slug = "jupyterlab"
|
||||||
display_name = "JupyterLab"
|
display_name = "JupyterLab"
|
||||||
url = "http://localhost:${var.port}"
|
url = "http://localhost:${var.port}"
|
||||||
icon = local.icon_url
|
icon = "/icon/jupyter.svg"
|
||||||
subdomain = true
|
subdomain = true
|
||||||
share = "owner"
|
share = "owner"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,25 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
echo "Instalalting ${MODULE_NAME}..."
|
BOLD='\033[0;1m'
|
||||||
|
|
||||||
|
echo "$${BOLD}Installing jupyterlab!\n"
|
||||||
|
|
||||||
# check if jupyterlab is installed
|
# check if jupyterlab is installed
|
||||||
if ! command -v jupyterlab &> /dev/null then
|
if ! command -v jupyterlab > /dev/null 2>&1; then
|
||||||
# install jupyterlab
|
# install jupyterlab
|
||||||
# check if python3 pip is installed
|
# check if python3 pip is installed
|
||||||
if ! command -v pip3 &> /dev/null then
|
if ! command -v pip3 > /dev/null 2>&1; then
|
||||||
echo "pip3 is not installed"
|
echo "pip3 is not installed"
|
||||||
echo "Please install pip3 and try again"
|
echo "Please install pip3 in your Dockerfile/VM image before running this script"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
pip3 install jupyterlab
|
# install jupyterlab
|
||||||
echo "jupyterlab installed!"
|
pip3 install --upgrade --no-cache-dir --no-warn-script-location jupyterlab
|
||||||
|
echo "🥳 jupyterlab has been installed\n\n"
|
||||||
|
else
|
||||||
|
echo "🥳 jupyterlab is already installed\n\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting ${MODULE_NAME}..."
|
echo "👷 Starting jupyterlab in background..."
|
||||||
|
echo "check logs at ${LOG_PATH}"
|
||||||
$HOME/.local/bin/jupyter lab --no-browser --LabApp.token='' --LabApp.password='' >${LOG_PATH} 2>&1 &
|
$HOME/.local/bin/jupyter lab --ServerApp.ip='0.0.0.0' --ServerApp.port=${PORT} --no-browser --ServerApp.token='' --ServerApp.password='' >${LOG_PATH} 2>&1 &
|
||||||
|
|
||||||
echo "Started ${MODULE_NAME}!"
|
|
||||||
|
|||||||
@@ -1,39 +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) 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
|
|
||||||
version = "1.0.0"
|
|
||||||
desktop_environment = "mate"
|
|
||||||
port = 6080
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
![Screenshot of KasmVNC]() //TODO
|
|
||||||
@@ -1,55 +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 "version" {
|
|
||||||
type = string
|
|
||||||
description = "Version of KasmVNC to install."
|
|
||||||
default = "1.2.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
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.version
|
|
||||||
})
|
|
||||||
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,40 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Check if desktop enivronment is installed
|
|
||||||
if ! dpkg -s ${DESKTOP_ENVIRONMENT} &>/dev/null; then
|
|
||||||
sudo apt-get update
|
|
||||||
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y ${DESKTOP_ENVIRONMENT}
|
|
||||||
else
|
|
||||||
echo "${DESKTOP_ENVIRONMENT} is already installed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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_focal_${VERSION}_amd64.deb
|
|
||||||
sudo apt install -y ./kasmvncserver_focal_${VERSION}_amd64.deb
|
|
||||||
printf "🥳 KasmVNC v${VERSION} has been successfully installed!\n\n"
|
|
||||||
else
|
|
||||||
echo "KasmVNC is already installed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo addgroup $USER ssl-cert
|
|
||||||
|
|
||||||
# Coder port-forwarding from dashboard only supports HTTP
|
|
||||||
sudo bash -c 'cat > /etc/kasmvnc/kasmvnc.yaml <<EOF
|
|
||||||
network:
|
|
||||||
protocol: http
|
|
||||||
websocekt_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 su -u $USER bash -c 'vncserver -select-de "${DESKTOP_ENVIRONMENT}" -disableBasicAuth'
|
|
||||||
@@ -10,3 +10,10 @@ tags: [helper]
|
|||||||
# Personalize
|
# Personalize
|
||||||
|
|
||||||
Run a script on workspace start that allows developers to run custom commands to personalize their workspace.
|
Run a script on workspace start that allows developers to run custom commands to personalize their workspace.
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
module "personalize" {
|
||||||
|
source = "https://registry.coder.com/modules/personalize"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ resource "coder_script" "personalize" {
|
|||||||
PERSONALIZE_PATH : var.path,
|
PERSONALIZE_PATH : var.path,
|
||||||
})
|
})
|
||||||
display_name = "Personalize"
|
display_name = "Personalize"
|
||||||
icon = "/emojis/1f58c.png"
|
icon = "/icon/personalize.svg"
|
||||||
log_path = var.log_path
|
log_path = var.log_path
|
||||||
run_on_start = true
|
run_on_start = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,3 +12,10 @@ tags: [ide, vscode, helper]
|
|||||||
Add a button to open any workspace with a single click.
|
Add a button to open any workspace with a single click.
|
||||||
|
|
||||||
Uses the [Coder Remote VS Code Extension](https://github.com/coder/vscode-coder).
|
Uses the [Coder Remote VS Code Extension](https://github.com/coder/vscode-coder).
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
module "vscode" {
|
||||||
|
source = "https://registry.coder.com/modules/vscode-desktop"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -17,10 +17,11 @@ variable "agent_id" {
|
|||||||
data "coder_workspace" "me" {}
|
data "coder_workspace" "me" {}
|
||||||
|
|
||||||
resource "coder_app" "vscode" {
|
resource "coder_app" "vscode" {
|
||||||
agent_id = var.agent_id
|
agent_id = var.agent_id
|
||||||
external = true
|
external = true
|
||||||
icon = "/icons/code.svg"
|
icon = "/icon/code.svg"
|
||||||
slug = "vscode"
|
slug = "vscode"
|
||||||
|
display_name = "VS Code Desktop"
|
||||||
url = join("", [
|
url = join("", [
|
||||||
"vscode://coder.coder-remote/open?owner=",
|
"vscode://coder.coder-remote/open?owner=",
|
||||||
data.coder_workspace.me.owner,
|
data.coder_workspace.me.owner,
|
||||||
|
|||||||
Reference in New Issue
Block a user