Skip to content

Commit f7c8908

Browse files
authored
chore: swap dogfood to use modules (#9870)
1 parent 442fb10 commit f7c8908

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

dogfood/main.tf

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -200,40 +200,18 @@ resource "coder_agent" "dev" {
200200
timeout = 5
201201
}
202202

203-
204203
startup_script_timeout = 60
205204
startup_script = <<-EOT
206-
set -eux -o pipefail
207-
208-
# change to home
209-
cd "$HOME"
210-
211-
# install and start code-server
212-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.8.3
213-
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
214-
215205
# Install and launch filebrowser
216206
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
217207
filebrowser --noauth --root /home/coder --port 13338 >/tmp/filebrowser.log 2>&1 &
218208
219-
repo_dir="${data.coder_parameter.repo_dir.value}"
220-
repo_dir="$${repo_dir/#~\//$HOME\/}"
221-
if [ ! -d "$repo_dir" ]; then
222-
mkdir -p "$repo_dir"
223-
git clone https://github.com/coder/coder "$repo_dir"
224-
fi
225-
226209
sudo service docker start
227210
DOTFILES_URI="${data.coder_parameter.dotfiles_url.value}"
228211
rm -f ~/.personalize.log
229212
if [ -n "$${DOTFILES_URI// }" ]; then
230213
coder dotfiles "$DOTFILES_URI" -y 2>&1 | tee -a ~/.personalize.log
231214
fi
232-
if [ -x ~/personalize ]; then
233-
~/personalize 2>&1 | tee -a ~/.personalize.log
234-
elif [ -f ~/personalize ]; then
235-
echo "~/personalize is not executable, skipping..." | tee -a ~/.personalize.log
236-
fi
237215
238216
# Automatically authenticate the user if they are not
239217
# logged in to another deployment
@@ -242,10 +220,26 @@ resource "coder_agent" "dev" {
242220
else
243221
echo "You are already authenticated with coder"
244222
fi
245-
246223
EOT
247224
}
248225

226+
module "code-server" {
227+
source = "https://registry.coder.com/modules/code-server"
228+
agent_id = coder_agent.dev.id
229+
}
230+
231+
module "personalize" {
232+
source = "https://registry.coder.com/modules/personalize"
233+
agent_id = coder_agent.dev.id
234+
}
235+
236+
module "git-clone" {
237+
source = "https://registry.coder.com/modules/git-clone"
238+
agent_id = coder_agent.dev.id
239+
repo = "https://github.com/coder/coder"
240+
path = data.coder_parameter.repo_dir.value
241+
}
242+
249243
resource "coder_app" "code-server" {
250244
agent_id = coder_agent.dev.id
251245
slug = "code-server"

0 commit comments

Comments
 (0)