Skip to content

Workspaces

While core tools of the platform are already up and running after installation, other components have to be individually deployed. This is easily and quickly done by creating workspaces in Coder, by using templates.

Open your browser and go to the address of the Coder instance of the platform which should have been provided to you. You will need to sign in and will then be directed to the Workspaces page.

Access the Templates tab at the top. Available templates are listed.

Coder templates image

To deploy one of these tools, click its corresponding Use template button. It will ask for a name for the workspace, the owner, and possibly a number of configurations that change depending on the template. More details on each template's configuration will be described in its respective component's section.

Once a component has been created, it will appear under the Workspaces tab, but may take a few minutes before it's Running. Then, you can click on it to open its overview, and access the tools it offers by using the buttons above the logs.

Workspaces in Coder contain dependencies and configuration required for applications to run.

Let's take a look at how to access the workspace in a terminal.

The easiest and fastest way is to simply click on the Terminal button above the logs, which will open a terminal in your browser that allows you to browse the workspace's environment.

Coder buttons image

If you click on VS Code Desktop, it will open a connection to the workspace in your local instance of VSCode and you can open a terminal by clicking Terminal > New Terminal.

Access the workspace in a local terminal

You can also connect your local terminal to the workspace via SSH. If you click on SSH, it will show some commands you need to run in your terminal, but first you have to install the coder command and log into the Coder instance.

Install coder:

curl -fsSL https://coder.com/install.sh | sh

Download the release for your OS (for example: coder_0.27.2_windows_amd64.zip), unzip it and move the coder executable to a location that's on your PATH. If you need to know how to add a directory to PATH, follow this.

Restart the command prompt

If it is already running, you will need to restart the Command Prompt for this change to take into effect.

Log in:

coder login https://coder.my-digitalhub-instance.it
A tab will open in your browser, ask you to log-in if you haven't already, then display a token that you're supposed to copy and paste in the terminal.

Coder token image

Now you can run the two commands you saw when you clicked on SSH. Configure SSH hosts (confirm with yes when asked):

coder config-ssh
Note that, if you create new workspaces after running this command, you will need to re-run it to connect to them.

The sample command below displays how to connect to the Jupyter workspace and will differ depending on the workspace you want to connect to. Take the actual command from what you see when you click SSH on Coder.

ssh coder.jupyter.jupyter

Your terminal should now be connected to the workspace. When you want to terminate the connection, simply type exit. To log coder out, type coder logout.

Port-forwarding

Port-forwarding may be done on any port: there are no pre-configured ones and it will work as long as there is a service listening on that port. Ports may be forwarded to make a service public, or through a local session.

Public

This can be done from Coder, directly from the workspace's page. Click on Port forward, enter the port number and click Open URL. Users will have to log in to access the service.

Local

You can start a SSH port-forwarding session from your local terminal. First, log in:

coder login https://coder.my-digitalhub-instance.it

The format for the SSH port-forwarding command is:

ssh -L [localport]:localhost:[remoteport] coder.[workspace]

For example, it may be:

ssh -L 3000:localhost:3000 coder.jupyter.jupyter

You will now be able to access the service in your browser, at localhost:3000.

Resources