Seeking feedback on GCP VM setup for Coder
Setup Overview:
- I'm using Packer to build a custom Ubuntu image with all base OS-level dependencies preinstalled (Docker, Python 3.11, Task, etc.)
- The metadata startup script creates the user and installs the Coder agent
- Devs connect via Cursor
Challenges / Questions:
- Git repo setup: Not sure if I should pre-clone repos in the Packer image (faster boot, but potentially stale), or always clone at runtime using task. What’s worked for you?
- User-level setup: Thinking about using task as the entry point after boot to run nvm install, configure git, clone repos, and spin up containers. Is this a sane division of concerns?
- nvm weirdness: Since it’s user-scoped, I’m running into some complexity around where to install and load it reliably. Any patterns you like?
- Ephemeral VM boot time: Since these VMs are short-lived, I’m trying to minimize cold boot time. Packer helps a lot, but I’m still fine-tuning what should be preinstalled vs. what can be scripted on boot.
Right now I’m trying to make it feel as close to a local dev machine as possible. I'm open to improving the approach with different pieces e.g. devcontainer, installing docker based services directly, etc.
Appreciate any tips or validation, thank you!
