From af3804892ea20feb7c105b4fe6dcfb4f934f1f77 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Tue, 26 Sep 2023 00:28:59 +0000 Subject: [PATCH 1/2] chore: swap dogfood to use modules --- dogfood/main.tf | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/dogfood/main.tf b/dogfood/main.tf index 91bcee5641a68..82defe04c6482 100644 --- a/dogfood/main.tf +++ b/dogfood/main.tf @@ -200,40 +200,18 @@ resource "coder_agent" "dev" { timeout = 5 } - startup_script_timeout = 60 startup_script = <<-EOT - set -eux -o pipefail - - # change to home - cd "$HOME" - - # install and start code-server - 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 & - # Install and launch filebrowser curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash filebrowser --noauth --root /home/coder --port 13338 >/tmp/filebrowser.log 2>&1 & - repo_dir="${data.coder_parameter.repo_dir.value}" - repo_dir="$${repo_dir/#~\//$HOME\/}" - if [ ! -d "$repo_dir" ]; then - mkdir -p "$repo_dir" - git clone https://github.com/coder/coder "$repo_dir" - fi - sudo service docker start DOTFILES_URI="${data.coder_parameter.dotfiles_url.value}" rm -f ~/.personalize.log if [ -n "$${DOTFILES_URI// }" ]; then coder dotfiles "$DOTFILES_URI" -y 2>&1 | tee -a ~/.personalize.log fi - if [ -x ~/personalize ]; then - ~/personalize 2>&1 | tee -a ~/.personalize.log - elif [ -f ~/personalize ]; then - echo "~/personalize is not executable, skipping..." | tee -a ~/.personalize.log - fi # Automatically authenticate the user if they are not # logged in to another deployment @@ -242,10 +220,26 @@ resource "coder_agent" "dev" { else echo "You are already authenticated with coder" fi - EOT } +module "code-server" { + source = "https://registry.coder.com/modules/code-server" + agent_id = coder_agent.dev.id +} + +module "personalize" { + source = "https://registry.coder.com/modules/personalize" + agent_id = coder_agent.dev.id +} + +module "git-clone" { + source = "https://registry.coder.com/modules/git-clone" + agent_id = coder_agent.dev.id + repo = "https://github.com/coder/coder" + path = data.coder_parameter.repo_dir.value +} + resource "coder_app" "code-server" { agent_id = coder_agent.dev.id slug = "code-server" From ef5f283cc673e11437cfcbee0b5a7642b8c330b4 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Tue, 26 Sep 2023 00:32:32 +0000 Subject: [PATCH 2/2] fmt --- dogfood/main.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dogfood/main.tf b/dogfood/main.tf index 82defe04c6482..f5189a3a0bf02 100644 --- a/dogfood/main.tf +++ b/dogfood/main.tf @@ -224,20 +224,20 @@ resource "coder_agent" "dev" { } module "code-server" { - source = "https://registry.coder.com/modules/code-server" + source = "https://registry.coder.com/modules/code-server" agent_id = coder_agent.dev.id } module "personalize" { - source = "https://registry.coder.com/modules/personalize" + source = "https://registry.coder.com/modules/personalize" agent_id = coder_agent.dev.id } module "git-clone" { - source = "https://registry.coder.com/modules/git-clone" + source = "https://registry.coder.com/modules/git-clone" agent_id = coder_agent.dev.id - repo = "https://github.com/coder/coder" - path = data.coder_parameter.repo_dir.value + repo = "https://github.com/coder/coder" + path = data.coder_parameter.repo_dir.value } resource "coder_app" "code-server" {