Skip to content

chore: add envbuilder-dogfood template #13720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 28, 2024
Merged

chore: add envbuilder-dogfood template #13720

merged 2 commits into from
Jun 28, 2024

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Jun 28, 2024

I've been dogfooding it for the last few days without any major issues, so putting this under VCS.

This template uses the latest version of coder/envbuilder, and makes heavy use of a Docker cache to avoid having to actually execute all of the layers.
With this, a newly created workspace is available in approximately 7 minutes from the envbuilder image starting.

Some notes and future work:

  1. Some directives in our dogfood Dockerfile currently are not (yet!) supported by our caching (in particular, ENV and ARG commands appear to bust the cache),
  2. Extracting the layers to the filesystem currently takes a significant amount of time. There may be some changes we can do to reduce the time spent here.
  3. If we check the remote cache (e.g. via checking docker logs output) and just run that pre-built cached image, we would have a big speed-up!
  4. On most newer distros, /var/run is a symlink to /run. Kaniko appears to ignore symbolic links in images, meaning that in the built image there is no /var/run folder. For now I'm symlinking this in the agent startup script before starting the Docker daemon.
  5. Because the image gets built in-place, the docker group is added to the running system. However, the Coder agent executed by the non-root user doesn't end up in this group. As a workaround, I've made /var/run/docker.sock world read-writable. The alternative is hacking the agent startup script to include newgrp or adding the ability for envbuilder to do the equivalent of a newgrp invocation.

@johnstcn johnstcn self-assigned this Jun 28, 2024
@johnstcn johnstcn requested review from dannykopping and mtojek June 28, 2024 10:52
Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go!

Non-blocking: I wonder if we can extract some common elements of this and the dogfood definitions to avoid copy-pasta?

@johnstcn
Copy link
Member Author

Let's go!

Non-blocking: I wonder if we can extract some common elements of this and the dogfood definitions to avoid copy-pasta?

Yeah I'd like to do that at some point!

@johnstcn johnstcn merged commit 1a87771 into main Jun 28, 2024
34 checks passed
@johnstcn johnstcn deleted the cj/envbuilder-dogfood branch June 28, 2024 11:56
@github-actions github-actions bot locked and limited conversation to collaborators Jun 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants