2022-08-10 01:10:09 +00:00
# Web IDEs
2022-06-19 20:45:14 +00:00
By default, Coder workspaces allow connections via:
- Web terminal
- SSH (plus any [SSH-compatible IDE ](../ides.md ))
It's common to also let developers to connect via web IDEs.
![Row of IDEs ](../images/ide-row.png )
In Coder, web IDEs are defined as
[coder_app ](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/app )
2022-07-09 02:40:05 +00:00
resources in the template. With our generic model, any web application can
be used as a Coder application. For example:
```hcl
2022-09-27 17:58:39 +00:00
# Add button to open Portainer in the workspace dashboard
# Note: Portainer must be already running in the workspace
2022-07-09 02:40:05 +00:00
resource "coder_app" "portainer" {
2022-07-26 13:09:09 +00:00
agent_id = coder_agent.main.id
2022-10-28 17:41:31 +00:00
slug = "portainer"
display_name = "Portainer"
2022-07-09 02:40:05 +00:00
icon = "https://simpleicons.org/icons/portainer.svg"
2022-09-27 17:58:39 +00:00
url = "https://localhost:9443/api/status"
healthcheck {
url = "https://localhost:9443/api/status"
interval = 6
threshold = 10
}
2022-07-09 02:40:05 +00:00
}
```
2022-06-19 20:45:14 +00:00
## code-server
![code-server in a workspace ](../images/code-server-ide.png )
2022-08-12 01:22:06 +00:00
[code-server ](https://github.com/coder/coder ) is our supported method of running VS Code in the web browser. A simple way to install code-server in Linux/macOS workspaces is via the Coder agent in your template:
2022-06-19 20:45:14 +00:00
2022-12-13 19:31:09 +00:00
```console
2022-06-19 20:45:14 +00:00
# edit your template
2022-07-09 02:40:05 +00:00
cd your-template/
2022-06-19 20:45:14 +00:00
vim main.tf
```
```hcl
2022-07-23 20:26:56 +00:00
resource "coder_agent" "main" {
2022-11-11 06:16:14 +00:00
arch = "amd64"
os = "linux"
2022-06-19 20:45:14 +00:00
startup_script = < < EOF
#!/bin/sh
2023-01-29 01:09:41 +00:00
# install code-server
# add '-s -- --version x.x.x' to install a specific code-server version
curl -fsSL https://code-server.dev/install.sh | sh
# start code-server on a specific port
# authn is off since the user already authn-ed into the coder deployment
2022-06-19 20:45:14 +00:00
code-server --auth none --port 13337
EOF
}
```
For advanced use, we recommend installing code-server in your VM snapshot or container image. Here's a Dockerfile which leverages some special [code-server features ](https://coder.com/docs/code-server/ ):
```Dockerfile
FROM codercom/enterprise-base:ubuntu
2023-01-29 01:09:41 +00:00
# install the latest version
RUN curl -fsSL https://code-server.dev/install.sh | sh
2022-06-19 20:45:14 +00:00
2023-01-29 01:09:41 +00:00
# pre-install VS Code extensions
2022-07-09 02:40:05 +00:00
RUN code-server --install-extension eamodio.gitlens
2022-06-19 20:45:14 +00:00
# directly start code-server with the agent's startup_script (see above),
2022-08-01 13:29:52 +00:00
# or use a process manager like supervisord
2022-06-19 20:45:14 +00:00
```
You'll also need to specify a `coder_app` resource related to the agent. This is how code-server is displayed on the workspace page.
```hcl
resource "coder_app" "code-server" {
2022-10-28 17:41:31 +00:00
agent_id = coder_agent.main.id
slug = "code-server"
display_name = "code-server"
url = "http://localhost:13337/?folder=/home/coder"
icon = "/icon/code.svg"
2022-09-27 17:58:39 +00:00
healthcheck {
url = "http://localhost:13337/healthz"
interval = 2
threshold = 10
}
2022-06-19 20:45:14 +00:00
}
```
## JetBrains Projector
[JetBrains Projector ](https://jetbrains.github.io/projector-client/mkdocs/latest/ ) is a JetBrains Incubator project which renders JetBrains IDEs in the web browser.
2022-07-30 22:31:22 +00:00
![PyCharm in Coder ](../images/projector-pycharm.png )
2022-06-19 20:45:14 +00:00
2022-07-30 22:31:22 +00:00
> It is common to see latency and performance issues with Projector. We recommend using [JetBrains Gateway](https://youtrack.jetbrains.com/issues/GTW) whenever possible (also no Template edits required!)
2022-06-19 20:45:14 +00:00
Workspace requirements:
2022-07-21 20:03:03 +00:00
- JetBrains projector CLI
- At least 4 CPU cores and 4 GB RAM
2022-06-19 20:45:14 +00:00
- CLion
2022-07-30 22:31:22 +00:00
- PyCharm
2022-06-19 20:45:14 +00:00
- DataGrip
2022-07-30 22:31:22 +00:00
- GoLand
2022-06-19 20:45:14 +00:00
- IntelliJ IDEA Community
- IntelliJ IDEA Ultimate
- PhpStorm
2022-07-30 22:31:22 +00:00
- PyCharm Community
2022-06-19 20:45:14 +00:00
- PyCharm Professional
- Rider
2022-07-30 22:31:22 +00:00
- RubyMine
2022-06-19 20:45:14 +00:00
- WebStorm
2022-07-30 22:31:22 +00:00
2022-07-21 20:03:03 +00:00
**Pre-built templates:**
2022-11-09 10:30:38 +00:00
You can reference/use these pre-built templates with JetBrains projector:
2022-07-21 20:03:03 +00:00
2022-11-02 15:09:42 +00:00
- IntelliJ
2022-11-09 10:30:38 +00:00
([Kubernetes](https://github.com/sharkymark/v2-templates/tree/main/multi-projector-intellij))
2022-07-21 20:03:03 +00:00
2022-11-02 15:09:42 +00:00
- PyCharm
2022-11-09 10:30:38 +00:00
([Kubernetes](https://github.com/sharkymark/v2-templates/tree/main/multi-projector-pycharm))
2022-07-21 20:03:03 +00:00
2022-11-02 15:09:42 +00:00
> You need to have a valid `~/.kube/config` on your Coder host and a namespace
> on a Kubernetes cluster to use the Kubernetes pod template examples.
2022-07-21 20:03:03 +00:00
2022-11-02 15:09:42 +00:00
======= ![PyCharm in Coder ](../images/projector-pycharm.png )
2022-07-21 20:03:03 +00:00
2022-07-09 02:40:05 +00:00
## JupyterLab
2022-06-19 20:45:14 +00:00
2023-01-29 01:09:41 +00:00
Configure your agent and `coder_app` like so to use Jupyter. Notice the
`subdomain=true` configuration:
2022-06-19 20:45:14 +00:00
2022-07-09 02:40:05 +00:00
```hcl
data "coder_workspace" "me" {}
resource "coder_agent" "coder" {
2022-11-11 06:16:14 +00:00
os = "linux"
arch = "amd64"
dir = "/home/coder"
2022-07-09 02:40:05 +00:00
startup_script = < < -EOF
pip3 install jupyterlab
2022-11-07 18:41:03 +00:00
$HOME/.local/bin/jupyter lab --ServerApp.token='' --ip='*'
2022-07-09 02:40:05 +00:00
EOF
}
resource "coder_app" "jupyter" {
2022-10-28 17:41:31 +00:00
agent_id = coder_agent.coder.id
slug = "jupyter"
display_name = "JupyterLab"
2022-11-07 18:41:03 +00:00
url = "http://localhost:8888"
2022-10-28 17:41:31 +00:00
icon = "/icon/jupyter.svg"
2022-11-07 18:41:03 +00:00
share = "owner"
subdomain = true
2022-09-27 17:58:39 +00:00
healthcheck {
2022-11-07 18:41:03 +00:00
url = "http://localhost:8888/healthz"
2022-09-27 17:58:39 +00:00
interval = 5
threshold = 10
}
2022-07-09 02:40:05 +00:00
}
```
2022-11-07 18:41:03 +00:00
![JupyterLab in Coder ](../images/jupyter-on-docker.png )
2022-07-09 02:40:05 +00:00
2023-01-11 15:48:29 +00:00
## RStudio
2022-07-09 02:40:05 +00:00
2022-11-02 15:09:42 +00:00
Configure your agent and `coder_app` like so to use RStudio. Notice the
`subdomain=true` configuration:
2022-07-09 02:40:05 +00:00
```hcl
resource "coder_agent" "coder" {
2022-11-11 06:16:14 +00:00
os = "linux"
arch = "amd64"
dir = "/home/coder"
2022-07-09 02:40:05 +00:00
startup_script = < < EOT
#!/bin/bash
# start rstudio
/usr/lib/rstudio-server/bin/rserver --server-daemonize=1 --auth-none=1 &
EOT
}
2022-06-19 20:45:14 +00:00
2022-11-02 15:09:42 +00:00
# rstudio
resource "coder_app" "rstudio" {
agent_id = coder_agent.coder.id
2022-11-11 06:16:14 +00:00
slug = "rstudio"
display_name = "R Studio"
icon = "https://upload.wikimedia.org/wikipedia/commons/d/d0/RStudio_logo_flat.svg"
2022-11-02 15:09:42 +00:00
url = "http://localhost:8787"
2022-11-11 06:16:14 +00:00
subdomain = true
share = "owner"
2022-07-09 02:40:05 +00:00
2022-11-02 15:09:42 +00:00
healthcheck {
url = "http://localhost:8787/healthz"
interval = 3
threshold = 10
2022-11-07 18:41:03 +00:00
}
2022-11-02 15:09:42 +00:00
}
2022-07-09 02:40:05 +00:00
```
![RStudio in Coder ](../images/rstudio-port-forward.png )
2023-01-11 15:48:29 +00:00
## Airflow
2022-07-09 02:40:05 +00:00
2022-11-02 15:09:42 +00:00
Configure your agent and `coder_app` like so to use Airflow. Notice the
`subdomain=true` configuration:
2022-06-19 20:45:14 +00:00
```hcl
2022-07-09 02:40:05 +00:00
resource "coder_agent" "coder" {
os = "linux"
arch = "amd64"
2022-11-11 06:16:14 +00:00
dir = "/home/coder"
2022-07-09 02:40:05 +00:00
startup_script = < < EOT
#!/bin/bash
# install and start airflow
2022-11-02 15:09:42 +00:00
pip3 install apache-airflow
/home/coder/.local/bin/airflow standalone &
2022-07-09 02:40:05 +00:00
EOT
2022-06-19 20:45:14 +00:00
}
2022-11-02 15:09:42 +00:00
resource "coder_app" "airflow" {
agent_id = coder_agent.coder.id
2022-11-11 06:16:14 +00:00
slug = "airflow"
display_name = "Airflow"
2022-11-02 15:09:42 +00:00
icon = "https://upload.wikimedia.org/wikipedia/commons/d/de/AirflowLogo.png"
url = "http://localhost:8080"
2022-11-11 06:16:14 +00:00
subdomain = true
share = "owner"
2022-06-19 20:45:14 +00:00
2022-11-02 15:09:42 +00:00
healthcheck {
url = "http://localhost:8080/healthz"
interval = 10
threshold = 60
2022-11-07 18:41:03 +00:00
}
2022-11-02 15:09:42 +00:00
}
2022-06-19 20:45:14 +00:00
```
2022-07-09 02:40:05 +00:00
![Airflow in Coder ](../images/airflow-port-forward.png )
2022-11-02 15:09:42 +00:00
## SSH Fallback
If you prefer to run web IDEs in localhost, you can port forward using
[SSH ](../ides.md#ssh ) or the Coder CLI `port-forward` sub-command. Some web IDEs
may not support URL base path adjustment so port forwarding is the only
2022-11-07 18:41:03 +00:00
approach.