molitann
molitann
CCoder.com
Created by molitann on 11/5/2024 in #help
Build devcontainer from hostPath and not git repo - Coder in k8s
Hello, I supposed that this is highly unusual and it's not going to be possible but: we have a NFS storage mounted to every k8s node which is then passed as a hostPath to pods. Users have .devcontainer in .gitignore becuase everyone uses different config and devs don't want to use one, universal devcontainer per project. Is it possible to build and open devcontainer from a given path to envbuilder instead of a git repository?
4 replies
CCoder.com
Created by molitann on 10/8/2024 in #help
Envbuilder in Coder: wrong user is used when cache is enabled
Hello, when I build image for the first time, the correct user, specified in .devcontainer is used. But when the pod is restarted and image is pulled from cache, it ALWAYS uses root user which then fails, because only the specified user has private SSH key in their .ssh which can pull from remote repository. This happens regardless of ENVBUILDER_REMOTE_REPO_BUILD_MODE set to true or false. devcontainer:
{
"build": {
"dockerfile": "./Dockerfile",
"context": "."
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"configureZshAsDefaultShell": "true",
"username": "mmolisch",
"userUid": "6043",
"userGid": "6000",
"upgradePackages": "true"
},
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"terminal.integrated.defaultProfile.linux": "zsh"
}
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "mmolisch"
}
{
"build": {
"dockerfile": "./Dockerfile",
"context": "."
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"configureZshAsDefaultShell": "true",
"username": "mmolisch",
"userUid": "6043",
"userGid": "6000",
"upgradePackages": "true"
},
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"terminal.integrated.defaultProfile.linux": "zsh"
}
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "mmolisch"
}
13 replies
CCoder.com
Created by molitann on 10/7/2024 in #help
ENVBUILDER_CACHE_REPO is always empty
Hi, I'm not sure what I'm doing wrong but ENVBUILDER_CACHE_REPO always remains empty in the env of the pod, even after multiple restarts. Here are some snippets of my config. LMK if you need more of my configuration and I will provide. I'm using latest versions of coder/coder, hashicorp/kubernetes and coder/envbuilder providers. Envbuilder image is on 1.0.3. Thanks in advance guys 🙂 Otherwise, it works perfectly
locals {
...
envbuilder_env = {
# ENVBUILDER_GIT_URL and ENVBUILDER_CACHE_REPO will be overridden by the provider
# if the cache repo is enabled.
"ENVBUILDER_GIT_URL" : local.repo_url,
...
}
}

variable "cache_repo" {
default = "url-path-to-our-gitlab-registry"
description = "Use a container registry as a cache to speed up builds."
type = string
}
locals {
...
envbuilder_env = {
# ENVBUILDER_GIT_URL and ENVBUILDER_CACHE_REPO will be overridden by the provider
# if the cache repo is enabled.
"ENVBUILDER_GIT_URL" : local.repo_url,
...
}
}

variable "cache_repo" {
default = "url-path-to-our-gitlab-registry"
description = "Use a container registry as a cache to speed up builds."
type = string
}
8 replies
CCoder.com
Created by molitann on 4/10/2024 in #help
API delete workspace
Hello guys, is there a way how to delete workspace using API? I can create it, but for DELETE method I'm getting 405 NOT ALLOWED and I couldn't find anything in docs. Thanks!
7 replies