Skip to content

add: code-server to template examples #3739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions examples/templates/aws-linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ instances provisioned by Coder:
]
}
```

## code-server

`code-server` is installed via the `startup_script` argument in the `coder_agent`
resource block. The `coder_app` resource is defined to access `code-server` through
the dashboard UI over `localhost:13337`.
14 changes: 14 additions & 0 deletions examples/templates/aws-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ resource "coder_agent" "main" {
arch = "amd64"
auth = "aws-instance-identity"
os = "linux"
startup_script = <<EOT
#!/bin/bash

# install and start code-server
curl -fsSL https://code-server.dev/install.sh | sh | tee code-server-install.log
code-server --auth none --port 13337 | tee code-server-install.log &
EOT
}

resource "coder_app" "code-server" {
agent_id = coder_agent.main.id
name = "code-server"
url = "http://localhost:13337/?folder=/home/coder"
icon = "/icon/code.svg"
}

locals {
Expand Down
6 changes: 6 additions & 0 deletions examples/templates/docker-image-builds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ coder ls
coder update [workspace name]
```

## code-server

`code-server` is installed via the `startup_script` argument in the `coder_agent`
resource block. The `coder_app` resource is defined to access `code-server` through
the dashboard UI over `localhost:13337`.

## Extending this template

See the [kreuzwerker/docker](https://registry.terraform.io/providers/kreuzwerker/docker) Terraform provider documentation to
Expand Down
14 changes: 14 additions & 0 deletions examples/templates/docker-image-builds/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ data "coder_workspace" "me" {
resource "coder_agent" "main" {
arch = data.coder_provisioner.me.arch
os = "linux"
startup_script = <<EOT
#!/bin/bash

# install and start code-server
curl -fsSL https://code-server.dev/install.sh | sh | tee code-server-install.log
code-server --auth none --port 13337 | tee code-server-install.log &
EOT
}

resource "coder_app" "code-server" {
agent_id = coder_agent.main.id
name = "code-server"
url = "http://localhost:13337/?folder=/home/coder"
icon = "/icon/code.svg"
}

variable "docker_image" {
Expand Down
6 changes: 6 additions & 0 deletions examples/templates/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ coder template push docker
You can also remove images from the validation list. Workspaces using older template versions will continue using
the removed image until you update the workspace to the latest version.

## code-server

`code-server` is installed via the `startup_script` argument in the `coder_agent`
resource block. The `coder_app` resource is defined to access `code-server` through
the dashboard UI over `localhost:13337`.

## Updating images

To reduce drift, we recommend versioning images in your registry by creating tags. To update the image tag in the template:
Expand Down
6 changes: 6 additions & 0 deletions examples/templates/gcp-linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ a service account:

1. Generate a **JSON private key**, which will be what you provide to Coder
during the setup process.

## code-server

`code-server` is installed via the `startup_script` argument in the `coder_agent`
resource block. The `coder_app` resource is defined to access `code-server` through
the dashboard UI over `localhost:13337`.
22 changes: 19 additions & 3 deletions examples/templates/gcp-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,25 @@ resource "google_compute_disk" "root" {
}

resource "coder_agent" "main" {
auth = "google-instance-identity"
arch = "amd64"
os = "linux"
auth = "google-instance-identity"
arch = "amd64"
os = "linux"
startup_script = <<EOT
#!/bin/bash

# install and start code-server
curl -fsSL https://code-server.dev/install.sh | sh | tee code-server-install.log
code-server --auth none --port 13337 | tee code-server-install.log &
EOT
}

# code-server
resource "coder_app" "code-server" {
agent_id = coder_agent.main.id
name = "code-server"
icon = "/icon/code.svg"
url = "http://localhost:13337?folder=/home/coder"
relative_path = true
}

resource "google_compute_instance" "dev" {
Expand Down
6 changes: 6 additions & 0 deletions examples/templates/gcp-vm-container/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ a service account:

1. Generate a **JSON private key**, which will be what you provide to Coder
during the setup process.

## code-server

`code-server` is installed via the `startup_script` argument in the `coder_agent`
resource block. The `coder_app` resource is defined to access `code-server` through
the dashboard UI over `localhost:13337`.
16 changes: 16 additions & 0 deletions examples/templates/gcp-vm-container/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ resource "coder_agent" "main" {
auth = "google-instance-identity"
arch = "amd64"
os = "linux"
startup_script = <<EOT
#!/bin/bash

# install and start code-server
curl -fsSL https://code-server.dev/install.sh | sh | tee code-server-install.log
code-server --auth none --port 13337 | tee code-server-install.log &
EOT
}

# code-server
resource "coder_app" "code-server" {
agent_id = coder_agent.main.id
name = "code-server"
icon = "/icon/code.svg"
url = "http://localhost:13337?folder=/home/coder"
relative_path = true
}

module "gce-container" {
Expand Down