From f99b8caf9953efd57429e363bb56288e80fa0c29 Mon Sep 17 00:00:00 2001 From: Mark Milligan Date: Sat, 12 Mar 2022 15:53:17 -0600 Subject: [PATCH 1/3] removed projector from workspace apps, replaced with http server --- workspaces/applications.md | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/workspaces/applications.md b/workspaces/applications.md index c4dc2aa7e..771cd6926 100644 --- a/workspaces/applications.md +++ b/workspaces/applications.md @@ -1,18 +1,18 @@ --- -title: "Applications" +title: "Workspace Applications" description: Learn how to access web apps running in your workspace. state: beta --- -You can connect to web applications installed on your workspace using the +You can connect to web applications installed on your workspace using a applications specification file located at `/coder/apps/config.yaml` of the workspace filesystem. ![Application Launcher](../assets/workspaces/applications.png) -## Enabling custom apps +## Enabling workspace applications -If you'd like to use custom apps in Coder, you can enable this feature in the +If you'd like to use workspace applications in Coder, you can enable this feature in the UI: 1. In the top-right, click on your avatar and select **Feature Preview**. @@ -20,12 +20,16 @@ UI: ## Application specification file -To define custom applications, add a configuration file at -`/coder/apps/config.yaml` to your image. +To define workspace applications, add a configuration file at +`/coder/apps/config.yaml` to your image. When making the image, create a coder/apps folder in the same folder as your Dockerfile. Add a Dockerfile step to copy the coder folder into the image. Also add the icon that you would like to render for your app - into the coder/apps folder along with the config.yaml so it is copied into the image as well. + +```text +# copy custom apps info (config.yaml) +COPY ["./coder", "/coder"] +``` The config file specifies the parameters Coder requires in order to launch the -application. Within the file, you can specify the following for each -application: +application. Here is an example config.yaml for adding a Python http server as a workspace application to a workspace. The python3 binary is included in Coder's base images. ```yaml # /coder/apps/config.yaml @@ -34,11 +38,11 @@ apps: # Name of application in launcher. Name may consist of alphanumeric # characters, dashes, underscores. Names must begin with an alphanumeric # character. Names must be unique per application. Required. - - name: projector + - name: HTTP server # Application scheme - must be http or https. Required. scheme: http # Application port. Required. - port: 9999 + port: 8000 # Host of the application to use when dialing. Defaults to localhost. # Optional. host: "localhost" @@ -46,11 +50,11 @@ apps: working-directory: /home/coder # File path to icon used in application launcher. Icons should be either # PNG, SVG, or JPG. Required. - icon-path: /home/coder/goland.svg + icon-path: /home/coder/python-logo.png # Command to start the application. Required. - command: /home/coder/.local/bin/projector + command: python3 # Array of arguments for command. Optional. - args: ["run"] + args: ["-m", "http.server"] # Health checks to get running application status. Can use exec or http # health checks to localhost. Optional, but we recommend specifying a # health check. If you don't supply one, then an http request is sent to @@ -59,7 +63,7 @@ apps: # Exec commands require an exit code of '0' to report healthy. exec: command: "pgrep" - args: ["projector"] + args: ["python3"] # http sends a GET request to the address specified via the parameters. # Expects the status codes to match; default is HTTP 200. http: @@ -71,10 +75,10 @@ apps: host: "localhost" # Port to use when dialing the application. If not specified it # inherits the application port. Optional. - port: 9999 + port: 8000 # Path to use for the health check. If not specified defaults to # "/". Optional. - path: "/healthz" + path: "" ``` **Notes**: @@ -89,6 +93,8 @@ helps you [set up a VNC](../guides/customization/vnc.md). With a VNC available, you can add an icon to your **Browser applications** via setting the [config file](https://github.com/coder/enterprise-images/blob/91ef8f521b2275783fed54b27052cc544153cd99/images/vnc/coder/apps/config.yaml). +You are welcome to try the [public Dockerfile repo for the example above](https://github.com/mtm20176/dockerfiles/tree/main/python/workspace-apps). The repo includes Python and Node http servers, and related icons. + You can also see our [blog post](https://coder.com/blog/run-any-application-or-ide-in-coder) for further samples on adding tools like Portainer, Insomnia, and various versions From 21ceb6a67b5e1e1afd3b7bfb2bb9d4c76d3e0cf0 Mon Sep 17 00:00:00 2001 From: Katie Horne Date: Mon, 14 Mar 2022 13:23:00 -0500 Subject: [PATCH 2/3] chore: edit text --- workspaces/applications.md | 41 ++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/workspaces/applications.md b/workspaces/applications.md index 771cd6926..3bceab6f0 100644 --- a/workspaces/applications.md +++ b/workspaces/applications.md @@ -1,10 +1,10 @@ --- -title: "Workspace Applications" +title: "Workspace applications" description: Learn how to access web apps running in your workspace. state: beta --- -You can connect to web applications installed on your workspace using a +You can connect to web applications installed on your workspace using an applications specification file located at `/coder/apps/config.yaml` of the workspace filesystem. @@ -12,8 +12,8 @@ workspace filesystem. ## Enabling workspace applications -If you'd like to use workspace applications in Coder, you can enable this feature in the -UI: +If you'd like to use workspace applications in Coder, you can enable this +feature in the UI: 1. In the top-right, click on your avatar and select **Feature Preview**. 1. Click **Workspace applications** and select **Enable**. @@ -21,15 +21,12 @@ UI: ## Application specification file To define workspace applications, add a configuration file at -`/coder/apps/config.yaml` to your image. When making the image, create a coder/apps folder in the same folder as your Dockerfile. Add a Dockerfile step to copy the coder folder into the image. Also add the icon that you would like to render for your app - into the coder/apps folder along with the config.yaml so it is copied into the image as well. +`/coder/apps/config.yaml` to your image. -```text -# copy custom apps info (config.yaml) -COPY ["./coder", "/coder"] -``` - -The config file specifies the parameters Coder requires in order to launch the -application. Here is an example config.yaml for adding a Python http server as a workspace application to a workspace. The python3 binary is included in Coder's base images. +The config file specifies the parameters Coder requires to launch the +application. Here is a sample `config.yaml` for adding a Python HTTP server as a +workspace application. Note that this requires the `python3` binary, which is +included in Coder's base images. ```yaml # /coder/apps/config.yaml @@ -86,6 +83,21 @@ apps: - A health check _must_ report healthy for you to access the application. - If you specify both the HTTP and Exec health checks, Coder prioritizes HTTP. +### Image creation + +When creating your image, be sure to: + +1. In the folder where your Dockerfile is, add a `coder/apps` folder +1. Add the `config.yaml` you created to `coder/apps`. +1. Add the icon that you would like Coder to render for your app to the + `coder/apps` folder +1. Add a step to your Dockerfile to copy the `coder` folder into the image: + +```text +# copy custom apps info (config.yaml) +COPY ["./coder", "/coder"] +``` + ## Sample usage Coder offers an [image](https://hub.docker.com/r/codercom/enterprise-vnc) that @@ -93,7 +105,10 @@ helps you [set up a VNC](../guides/customization/vnc.md). With a VNC available, you can add an icon to your **Browser applications** via setting the [config file](https://github.com/coder/enterprise-images/blob/91ef8f521b2275783fed54b27052cc544153cd99/images/vnc/coder/apps/config.yaml). -You are welcome to try the [public Dockerfile repo for the example above](https://github.com/mtm20176/dockerfiles/tree/main/python/workspace-apps). The repo includes Python and Node http servers, and related icons. +You are welcome to try the +[public Dockerfile repo that contains the example above](https://github.com/mtm20176/dockerfiles/tree/main/python/workspace-apps). +The repo includes config files that set up Python and Node.js HTTP servers and +the accompanying icons. You can also see our [blog post](https://coder.com/blog/run-any-application-or-ide-in-coder) for From 1dbef2a90c7580060c9e36e3e128f1d889d45133 Mon Sep 17 00:00:00 2001 From: Katie Horne Date: Mon, 14 Mar 2022 15:14:13 -0500 Subject: [PATCH 3/3] chore: fix manifest --- manifest.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 9e53536de..c75b984a5 100644 --- a/manifest.json +++ b/manifest.json @@ -53,9 +53,6 @@ { "path": "./workspaces/lifecycle.md" }, - { - "path": "./workspaces/applications.md" - }, { "path": "./workspaces/autostart.md" }, @@ -86,6 +83,9 @@ { "path": "./workspaces/vs-code-extensions.md" }, + { + "path": "./workspaces/applications.md" + }, { "path": "./workspaces/workspace-params.md" },