Skip to content

Commit 8ee0787

Browse files
spikecurtiskylecarbs
authored andcommitted
feat: set /Users/spike for coder agent in gcp-linux template (#2147)
Signed-off-by: Spike Curtis <spike@coder.com>
1 parent 9f974c8 commit 8ee0787

File tree

1 file changed

+17
-1
lines changed
  • examples/templates/gcp-linux

1 file changed

+17
-1
lines changed

examples/templates/gcp-linux/main.tf

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,21 @@ resource "google_compute_instance" "dev" {
7070
email = data.google_compute_default_service_account.default.email
7171
scopes = ["cloud-platform"]
7272
}
73-
metadata_startup_script = coder_agent.dev.init_script
73+
# The startup script runs as root with no $HOME environment set up, which can break workspace applications, so
74+
# instead of directly running the agent init script, setup the home directory, write the init script, and then execute
75+
# it.
76+
metadata_startup_script = <<EOMETA
77+
#!/usr/bin/env sh
78+
set -eux pipefail
79+
80+
mkdir /root || true
81+
cat <<'EOCODER' > /root/coder_agent.sh
82+
${coder_agent.dev.init_script}
83+
EOCODER
84+
chmod +x /root/coder_agent.sh
85+
86+
export HOME=/root
87+
/root/coder_agent.sh
88+
89+
EOMETA
7490
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy