From ab9cba9396f2c7b2ba9195c317f570aed7d67bd1 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Fri, 10 Feb 2023 13:36:46 +0000 Subject: [PATCH] chore: update template examples and docs to install code-server under /tmp (#6138) Updates templates examples and docs to pass the --method standalone argument to code-server install script, and installs code-server under /tmp/code-server. Co-authored-by: Mathias Fredriksson --------- Co-authored-by: Mathias Fredriksson --- docs/ides/web-ides.md | 7 +++++-- docs/templates.md | 13 ++++++++----- dogfood/main.tf | 4 ++-- examples/templates/aws-ecs-container/main.tf | 4 ++-- examples/templates/aws-linux/main.tf | 4 ++-- examples/templates/docker-image-builds/main.tf | 4 ++-- examples/templates/docker/main.tf | 4 ++-- examples/templates/gcp-linux/main.tf | 4 ++-- examples/templates/gcp-vm-container/main.tf | 4 ++-- examples/templates/kubernetes-with-podman/main.tf | 6 ++++-- examples/templates/kubernetes/main.tf | 4 ++-- 11 files changed, 33 insertions(+), 25 deletions(-) diff --git a/docs/ides/web-ides.md b/docs/ides/web-ides.md index 042ae69c2b..1f2fb2a071 100644 --- a/docs/ides/web-ides.md +++ b/docs/ides/web-ides.md @@ -52,11 +52,12 @@ resource "coder_agent" "main" { #!/bin/sh # 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 + curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server # start code-server on a specific port # authn is off since the user already authn-ed into the coder deployment - code-server --auth none --port 13337 + # & is used to run the process in the background + /tmp/code-server/bin/code-server --auth none --port 13337 & EOF } ``` @@ -67,7 +68,9 @@ For advanced use, we recommend installing code-server in your VM snapshot or con FROM codercom/enterprise-base:ubuntu # install the latest version +USER root RUN curl -fsSL https://code-server.dev/install.sh | sh +USER coder # pre-install VS Code extensions RUN code-server --install-extension eamodio.gitlens diff --git a/docs/templates.md b/docs/templates.md index 35ae2e7bce..1502cee284 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -160,12 +160,15 @@ resource "coder_agent" "coder" { startup_script = </tmp/code-server.log 2>&1 & # var.repo and var.dotfiles_uri is specified # elsewhere in the Terraform code as input diff --git a/dogfood/main.tf b/dogfood/main.tf index 285f26a345..0774e7e06f 100644 --- a/dogfood/main.tf +++ b/dogfood/main.tf @@ -66,8 +66,8 @@ resource "coder_agent" "dev" { startup_script = <<-EOT set -eux -o pipefail # install and start code-server - curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 - code-server --auth none --port 13337 & + curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.8.3 + /tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & sudo service docker start DOTFILES_URI=${var.dotfiles_uri} rm -f ~/.personalize.log diff --git a/examples/templates/aws-ecs-container/main.tf b/examples/templates/aws-ecs-container/main.tf index 2ae6b833d4..8862edfa56 100644 --- a/examples/templates/aws-ecs-container/main.tf +++ b/examples/templates/aws-ecs-container/main.tf @@ -103,8 +103,8 @@ resource "coder_agent" "coder" { set -e # install and start code-server - curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 - code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & + curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.8.3 + /tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & EOT } diff --git a/examples/templates/aws-linux/main.tf b/examples/templates/aws-linux/main.tf index 4a70707f6c..d662a52f37 100644 --- a/examples/templates/aws-linux/main.tf +++ b/examples/templates/aws-linux/main.tf @@ -83,8 +83,8 @@ resource "coder_agent" "main" { set -e # install and start code-server - curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 - code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & + curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.8.3 + /tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & EOT } diff --git a/examples/templates/docker-image-builds/main.tf b/examples/templates/docker-image-builds/main.tf index 6668867053..a541e8b698 100644 --- a/examples/templates/docker-image-builds/main.tf +++ b/examples/templates/docker-image-builds/main.tf @@ -31,8 +31,8 @@ resource "coder_agent" "main" { set -e # install and start code-server - curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 - code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & + curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.8.3 + /tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & EOT } diff --git a/examples/templates/docker/main.tf b/examples/templates/docker/main.tf index 89bf7215e2..a6bff978d3 100644 --- a/examples/templates/docker/main.tf +++ b/examples/templates/docker/main.tf @@ -34,8 +34,8 @@ resource "coder_agent" "main" { set -e # install and start code-server - curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 - code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & + curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.8.3 + /tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & EOT # These environment variables allow you to make Git commits right away after creating a diff --git a/examples/templates/gcp-linux/main.tf b/examples/templates/gcp-linux/main.tf index 26ed3ab365..3ebd10dac3 100644 --- a/examples/templates/gcp-linux/main.tf +++ b/examples/templates/gcp-linux/main.tf @@ -56,8 +56,8 @@ resource "coder_agent" "main" { set -e # install and start code-server - curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 - code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & + curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.8.3 + /tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & EOT } diff --git a/examples/templates/gcp-vm-container/main.tf b/examples/templates/gcp-vm-container/main.tf index 92b5162195..256d4028a5 100644 --- a/examples/templates/gcp-vm-container/main.tf +++ b/examples/templates/gcp-vm-container/main.tf @@ -46,8 +46,8 @@ resource "coder_agent" "main" { set -e # install and start code-server - curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 - code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & + curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.8.3 + /tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & EOT } diff --git a/examples/templates/kubernetes-with-podman/main.tf b/examples/templates/kubernetes-with-podman/main.tf index c7a96969d0..cf89063264 100644 --- a/examples/templates/kubernetes-with-podman/main.tf +++ b/examples/templates/kubernetes-with-podman/main.tf @@ -32,8 +32,10 @@ resource "coder_agent" "dev" { dir = "/home/podman" startup_script = </tmp/code-server.log 2>&1 & # Run once to avoid unnecessary warning: "/" is not a shared mount podman ps diff --git a/examples/templates/kubernetes/main.tf b/examples/templates/kubernetes/main.tf index 73ae829510..3166d0ed83 100644 --- a/examples/templates/kubernetes/main.tf +++ b/examples/templates/kubernetes/main.tf @@ -58,8 +58,8 @@ resource "coder_agent" "main" { set -e # install and start code-server - curl -fsSL https://code-server.dev/install.sh | sh -s - code-server --auth none --port 13337 & + curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.8.3 + /tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & EOT }