Files
coder/docs/templates/tutorial.md
Muhammad Atif Ali a49e6b88f9 docs: reorganize template docs (#10297)
* docs: rework our "templates" section

* wikistuff

* fix formatting

* add diagram

* reorganize some things

* docs: improve workspaces and templates doc (#9139)

* Reorg, updated/new screenshots, consistent terminology

* First pass

* Another pass

* Added integration section

* New outline for template pages, small updates

* Revised outline for templates, added tutorial

* First pass at tutorial

* Some feedback from Ben.

* Update docs/workspaces.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/workspaces.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/workspaces.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Fixed typos

* Expanded tutorial

I have read the CLA Document and I hereby sign the CLA

* New screenshots, improved tutorial, revised anatomy

* Improved tutorial. Anatomy is now a guided tour.

* First pass at guided tour

* Updated authentication info

* Reorganized the guided tour

* Edited more template pages

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tutorial.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Update docs/templates/tour.md

Co-authored-by: Muhammad Atif Ali <matifali@live.com>

* Revised devcontainers and docker-in-workspaces

* Edited and added screenshots

* Prepared first draft, except docs/templates/open-in-coder.md

* Fix typo

* remove legacy parameters and migration guide

* Use coder templates create

* Added screenshot for workspace template variables

* Made it prettier

* Fixed minor typos and markdown problems

* edits to repairing workspaces

* fix broken links in product

* Added troubleshooting, minor corrections.

* fix terminal links

* fmt

---------

Co-authored-by: Muhammad Atif Ali <matifali@live.com>
Co-authored-by: Ben Potter <me@bpmct.net>
Co-authored-by: Atif Ali <atif@coder.com>

* make fmt

* fix merge conflict

* make fmt

* make gen

* update

* lint

* Discard changes to coderd/database/queries.sql.go

* Discard changes to cli/templates.go

* Discard changes to cli/templateversionarchive.go

* Discard changes to cli/templateversions.go

* Update docker-in-workspaces.md

* replace ```sh with ```shell

* open-in-coder

* fmt

* mention coder_metadata in icons.md

* resource_metadata

* use shell

* modules.md

* mention coder registry module

* workspace.md

* resource_metadata

* remove duplication

* address comments

* cleanup

* fmt

* fix broken links

* fix numbering

* mention module registry

* add example

* demote heading

* remove top level entry from manifest

* fmt

---------

Co-authored-by: Ben <me@bpmct.net>
Co-authored-by: Marc Paquette <22124737+marcpaq@users.noreply.github.com>
2023-10-17 14:47:12 +00:00

4.2 KiB

Your first template

A common way to create a template is to begin with a starter template then modify it for your needs. Coder makes this easy with starter templates for popular development targets like Docker, Kubernetes, Azure, and so on. Once your template is up and running, you can edit it in the Coder dashboard. Coder even handles versioning for you so you can publish official updates or revert to previous versions.

In this tutorial, you'll create your first template from the Docker starter template.

Before you start

You'll need a computer or cloud computing instance with both Docker and Coder installed on it.

When setting up your computer or computing instance, make sure to install Docker first, then Coder.

1. Log in to Coder

In your web browser, go to your Coder dashboard to log in.

2. Choose a starter template

Select Templates > Starter Templates.

Starter Templates button

In Filter, select Docker then select Develop in Docker.

Choosing a starter template

Select Use template.

Using a starter template

3. Create your template

In Create template, fill in Name and Display name,then scroll down and select Create template.

Creating a template

4. Create a workspace from your template

When the template is ready, select Create Workspace.

Create workspace

In New workspace, fill in Name then scroll down to select Create Workspace.

New workspace

Coder starts your new workspace from your template.

After a few seconds, your workspace is ready to use.

Workspace is ready

5. Try out your new workspace

This starter template lets you connect to your workspace in a few ways:

  • VS Code Desktop: Loads your workspace into VS Code Desktop installed on your local computer.
  • code-server: Opens browser-based VS Code with your workspace.
  • Terminal: Opens a browser-based terminal with a shell in the workspace's Docker instance.
  • SSH: Use SSH to log in to the workspace from your local machine. If you haven't already, you'll have to install Coder on your local machine to configure your SSH client.

Tip

: You can edit the template to let developers connect to a workspace in a few more ways.

When you're done, you can stop the workspace.

6. Modify your template

Now you can modify your template to suit your team's needs.

Let's replace the golang package in the Docker image with the python3 package. You can do this by editing the template's Dockerfile directly in your web browser.

In the Coder dashboard, select Templates then your first template.

Selecting the first template

In the drop-down menu, select Edit files.

Edit template files

Expand the build directory and select Dockerfile.

Selecting source code

Edit build/Dockerfile to replace golang with python3.

Editing source code

Select Build template and wait for Coder to prepare the template for workspaces.

Building a template

Select Publish version. In the Publish new version dialog, make sure Promote to default version is checked then select Publish.

Publish a template

Now when developers create a new workspace from this template, they can use Python 3 instead of Go.

For developers with workspaces that were created with a previous version of your template, Coder will notify them that there's a new version of the template.

You can also handle change management through your own repo and continuous integration.

Next steps