Seeking feedback on GCP VM setup for Coder
Hey all, I’m working on a proof of concept for a dev environment using Coder with ephemeral GCP VMs and would love to gut-check some assumptions and get feedback on a few sticking points.
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!
6 Replies
<#1395116203252514937>
Category
Help needed
Product
N/A
Platform
N/A
Logs
Please post any relevant logs/error messages.
What product are you using?
@NozomuDM
- Clone at startup using user credentials via the Git Clone module and External Auth
- not sure what you mean about "tasks" but I feel like you should be doing the nvm install in the image if possible, another thing you'd want to look into would be Dev Containers to bake tools in the image without having to spend a lot of time writing the dockerfile
- just install it as the user you'll be running the container as
Thanks for the feedback!
Sorry I didn't notice I set the link for task: https://taskfile.dev/
I was thinking of using it as like a central command repo and then do like
task setup
I think Dev Containers will be the route I want to go but the challenge I think I have is all of the dependent services for the stack all run in their own containers so I'll have a bunch to untangle thereHome | Task
Task is a task runner / build tool that aims to be simpler and easier to use
hey @NozomuDM apologies, this went under our radar, were you able to get this solved?
The information was helpful, I've been trying more experiments. My VP appreciated my demo of Coder and wants me to continue as I can. I wasn't looking for specific solutions as much as crowd sourcing some best practices and thoughts given what I feel are unique challenges for our stack.
Separately I've been attempting to roll Coder out on my home proxmox server to move away from coding on Windows.