Skip to content
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

Is it possible to use CODE server IDE with DEVPOD #1568

Open
yeldhomathew opened this issue Jan 16, 2025 · 5 comments
Open

Is it possible to use CODE server IDE with DEVPOD #1568

yeldhomathew opened this issue Jan 16, 2025 · 5 comments

Comments

@yeldhomathew
Copy link

yeldhomathew commented Jan 16, 2025

I am using Kubernetes provider. We would like to use IDE CODE server instead of openvscode (for port forwarding feature). Is it possible with devpod? if I customize a docker image (installing code server and expose in port 3000) Is it possible to the same image by devpod and can create a pod. Please suggest if any other work around to get code server with DEVPOD

@bkneis
Copy link
Contributor

bkneis commented Jan 20, 2025

Hi @yeldhomathew currently DevPod uses openvscode which is very similar to code server and offer like for like features, including port forwarding. Was this the only feature you wanted code server for? You could choose --ide none and then simply use the SSH provider to run code-server in your workspace manually. But unless you really need it, I would advice to stick with openvscode as there are nearly the same

@yeldhomathew
Copy link
Author

OpenVsCode is absolutely fine for me if I can do port forwarding. Unfortunately, port forwarding is not working while I am using OpenVsCode. I also saw that port forwarding is not possible while we using OpenVscode browser version (Pls refer gitpod-io/openvscode-server#260)

Do you have any suggestion to make port forwarding works in Openvscode.

@bkneis
Copy link
Contributor

bkneis commented Jan 21, 2025

Hi @yeldhomathew that's great. Sure, what you need to do is define the ports you want forwarded in your .devcontainer.json as forwardPorts. Here are the docs https://containers.dev/implementors/json_reference/ and here is an example of a workspace forwarding port 4000 - https://github.com/loft-sh/devpod-example-go/blob/main/.devcontainer/devcontainer.json

All you need to do is add that to your .devcontainer.json then run devpod up ... and you should have the port forwarded to your local machine. Let me know if that helps :)

@yeldhomathew
Copy link
Author

yeldhomathew commented Jan 22, 2025

Hello @bkneis ,
I have tested by using "forwardPorts" option, But no luck. below is my devcontainer.json for your reference.

{
"name": "DevContainer",
"image": "librespace/ansible",
"postCreateCommand": "echo 'Tasks setup complete.' && mkdir -p .vscode && echo '{ "version": "2.0.0", "tasks": [ { "label": "bash", "type": "process", "command": "bash", "args": [], "options": { "cwd": "${workspaceFolder}" }, "problemMatcher": [], "group": { "kind": "build", "isDefault": true }, "presentation": { "reveal": "silent", "focus": false, "panel": "dedicated" }, "runOptions": { "runOn": "folderOpen" } } ] }' > .vscode/tasks.json && echo 'tasks.json created.' && echo '{ "workbench.colorTheme": "Default Dark+", "terminal.integrated.defaultLocation": "editor" }' > .vscode/settings.json && echo 'settings.json created.'",
"containerEnv": {
"RESOURCE_LIMITS": "cpu=1,memory=512Mi"
},
"forwardPorts": [
80,
8080,
3003
]
}

@bkneis
Copy link
Contributor

bkneis commented Jan 23, 2025

Hi @yeldhomathew thanks for providing your .devcontainer.json, I was able to reproduce your problem. The issue seems to be your base image librespace/ansible, when I change the image for mcr.microsoft.com/devcontainers/go:1.23-bullseye the port forwarding works fine. I would suggest either running --debug with the up command and sshing into the workspace if possible and try to debug why the specific image is not able to port forward.

Failing that the next best thing would be to build up your own image, using something like ubuntu as a base and installing ansible on top. I hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants