But I cannot find in docs or figure out what value is used for the abc123 hash part in abc123-code-server.
Is there a variable that can be used here or exposed through the terraform template? Or maybe there is a better way to get the path for absProxyBasePath?
\nIt seems to be persistent across multiple workspaces and only changed when I used a different repository as base.
\nAny help will be greatly appreciated!
\nFor context this is my devcontainer.json:
{\n \"name\": \"Devcontainer\",\n \"image\": \"node:24-bookworm-slim\",\n \"workspaceFolder\": \"/workspaces/${localWorkspaceFolderBasename}\",\n \"features\": {\n \"ghcr.io/coder/devcontainer-features/code-server:1\": {\n \"port\": 13337,\n \"host\": \"0.0.0.0\",\n \"disableTelemetry\": true,\n \"disableUpdateCheck\": true,\n \"disableFileUploads\": true,\n \"disableFileDownloads\": true,\n \"workspace\": \"/workspaces/${localWorkspaceFolderBasename}\",\n \"absProxyBasePath\": \"/@${localEnv:CODER_WORKSPACE_OWNER_NAME}/${localEnv:CODER_WORKSPACE_NAME}.${localWorkspaceFolderBasename}/apps/edfpe135-code-server\",\n \"auth\": \"none\",\n \"appName\": \"AppName\",\n }\n },\n \"containerEnv\": {\n \"CODER_AGENT_URL\": \"${localEnv:CODER_AGENT_URL}\",\n \"CODER_WORKSPACE_AGENT_NAME\": \"${localEnv:CODER_WORKSPACE_AGENT_NAME}\",\n \"CODER_WORKSPACE_FOLDER_NAME\": \"${localWorkspaceFolderBasename}\",\n \"CODER_WORKSPACE_NAME\": \"${localEnv:CODER_WORKSPACE_NAME}\",\n \"CODER_WORKSPACE_OWNER_NAME\": \"${localEnv:CODER_WORKSPACE_OWNER_NAME}\",\n \"CODER_AGENT_ID\": \"${localEnv:CODER_AGENT_ID}\",\n \"RUNNING_IN_CONTAINER\": \"true\",\n \"VSCODE_PROXY_URI\": \"${localEnv:VSCODE_PROXY_URI}\",\n \"DEVCONTAINER_ID\": \"${devcontainerId}\"\n }\n}I should also add it is possible to ensure a stable subAgent.Name by providing a name in the devcontainer.json via customizations:
{\n \"customizations\": {\n \"coder\": {\n \"name\": \"<name-here>\"\n }\n }\n}\n-
|
Hi! The issue is I need to pass the So the full path when using code-server proxy within coder workspace is for example: I can dynamically build most of it for the "absProxyBasePath": "/@${localEnv:CODER_WORKSPACE_OWNER_NAME}/${localEnv:CODER_WORKSPACE_NAME}.${localWorkspaceFolderBasename}/apps/abc123-code-server",But I cannot find in docs or figure out what value is used for the abc123 hash part in Is there a variable that can be used here or exposed through the terraform template? Or maybe there is a better way to get the path for absProxyBasePath? It seems to be persistent across multiple workspaces and only changed when I used a different repository as base. Any help will be greatly appreciated! For context this is my {
"name": "Devcontainer",
"image": "node:24-bookworm-slim",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
"ghcr.io/coder/devcontainer-features/code-server:1": {
"port": 13337,
"host": "0.0.0.0",
"disableTelemetry": true,
"disableUpdateCheck": true,
"disableFileUploads": true,
"disableFileDownloads": true,
"workspace": "/workspaces/${localWorkspaceFolderBasename}",
"absProxyBasePath": "/@${localEnv:CODER_WORKSPACE_OWNER_NAME}/${localEnv:CODER_WORKSPACE_NAME}.${localWorkspaceFolderBasename}/apps/edfpe135-code-server",
"auth": "none",
"appName": "AppName",
}
},
"containerEnv": {
"CODER_AGENT_URL": "${localEnv:CODER_AGENT_URL}",
"CODER_WORKSPACE_AGENT_NAME": "${localEnv:CODER_WORKSPACE_AGENT_NAME}",
"CODER_WORKSPACE_FOLDER_NAME": "${localWorkspaceFolderBasename}",
"CODER_WORKSPACE_NAME": "${localEnv:CODER_WORKSPACE_NAME}",
"CODER_WORKSPACE_OWNER_NAME": "${localEnv:CODER_WORKSPACE_OWNER_NAME}",
"CODER_AGENT_ID": "${localEnv:CODER_AGENT_ID}",
"RUNNING_IN_CONTAINER": "true",
"VSCODE_PROXY_URI": "${localEnv:VSCODE_PROXY_URI}",
"DEVCONTAINER_ID": "${devcontainerId}"
}
} |
Beta Was this translation helpful? Give feedback.
-
|
We should definitely aim to improve this in the future. At the moment we compute a hash for each app as apps have to have a unique name for a workspace (multiple agents using the same name for an app causes issues). To work around this we compute a hash, you can see this here: coder/coderd/agentapi/subagent.go Lines 170 to 177 in 6f86f67 We haven't got any backwards compatibility guarantees on this hash but there is currently nothing planned for changing it. |
Beta Was this translation helpful? Give feedback.
-
|
I should also add it is possible to ensure a stable |
Beta Was this translation helpful? Give feedback.
-
|
Thank you very much for your fast and detailed answers. Using the I've tried to calculate the slug within a terraform template to provide it as ENV variable and archive fully automatic process, but the lack of a working base32 encode function is an issue (tried few custom providers but all had problems, maybe I will write my own, but I have to learn more about Terraform). My idea was to use a part of workspace id as name to calculate unique slug within terraform and expose both as ENV. I could then use the slug in Suggetsions
It would be enough to provide only the part as the /@${localEnv:CODER_WORKSPACE_OWNER_NAME}/${localEnv:CODER_WORKSPACE_NAME}.${localWorkspaceFolderBasename}/apps/
resource "coder_app" "code-server" {
agent_id = coder_agent.main.id
slug = "code-server"
display_name = "code-server"
url = "http://localhost:13337/?folder=/home/${local.username}"
icon = "/icon/code.svg"
subdomain = false
share = "owner"
(...)
}I assume it does not affect the devcontainer feature tho, but maybe a similar approach would work. |
Beta Was this translation helpful? Give feedback.
I should also add it is possible to ensure a stable
subAgent.Nameby providing a name in thedevcontainer.jsonviacustomizations: