Simple template for code-server

Hello, I'm new in this field. so forgive me if I'm misunderstanding. I wanted to provide a web based IDE for multiple developers on a remote server. so that each user could log in to the server and open his own instance of the IDE. from what I read in the docs coder could provide this solution for me. I followed the documentation instructions and now I have a workspace running from the following template: https://github.com/coder/coder/discussions/3466 However when I open the workspace in the web UI. there is no button for the IDE. it seems that no agent is running. am I doing anything wrong? Also I tried the docker-code-server template too. in that case there was an agent named main but again no IDE or Terminal button.
GitHub
Simple template for code-server · Discussion #3466 · coder/coder
Hello, I'm new in this field. so forgive me if I'm misunderstanding. I wanted to provide a web based IDE for multiple developers on a remote server. so that each user could log in t...
40 Replies
Phorcys
Phorcys3y ago
yes! that's normal you have to use a provider for the machine the IDE will run on currently you're asking it to run code-server on thin air a provider is docker, amazon aws, etc basically a place where you can deploy machines/containers @Mixture do you have docker on your machine? it's the simplest way imo
Mixture
MixtureOP3y ago
yes I do. I also tried the docker-code-server template but couldn't acces any IDE
Phorcys
Phorcys3y ago
let's use that template instead your current template is just invalid atm what happens when you use the docker-code-server template?
Mixture
MixtureOP3y ago
the workspace starts running and when I open the web UI and click on the workspace an agent named main is running but no Icon for IDE or Terminal is visible
Phorcys
Phorcys3y ago
can you screenshot?
Mixture
MixtureOP3y ago
sure, I'll try it again now
Mixture
MixtureOP3y ago
No description
Mixture
MixtureOP3y ago
@Phorcys In the logs I can also see a warning which I don't know if it's related or not: Warning: The access URL http://127.0.0.1:7080 isn't externally reachable, this may cause unexpected problems when creating workspaces. Generate a unique *.try.coder.app URL
Phorcys
Phorcys3y ago
it is that was my hypothesis hold on 1s can you send me your template well, docker-code-server
Mixture
MixtureOP3y ago
I haven't edited it. but ok I'll send it
Phorcys
Phorcys3y ago
yeh I'm on mobile atm so it's hard to find it
Mixture
MixtureOP3y ago
Mixture
MixtureOP3y ago
(previous file was wrong)
Phorcys
Phorcys3y ago
hmm it should be fine though @kyle any idea? it should be replaced to host.docker.internal properly i don't see what's wrong
Mixture
MixtureOP3y ago
Here is the /etc/coder.d/coder.env if it helps:
# Run "coder server --help" for flag information.
CODER_ACCESS_URL=
CODER_ADDRESS="localhost:7080"
CODER_PG_CONNECTION_URL=
CODER_TLS_CERT_FILE=
CODER_TLS_ENABLE=
CODER_TLS_KEY_FILE=
# Generate a unique *.try.coder.app access URL
CODER_TUNNEL=false
# Run "coder server --help" for flag information.
CODER_ACCESS_URL=
CODER_ADDRESS="localhost:7080"
CODER_PG_CONNECTION_URL=
CODER_TLS_CERT_FILE=
CODER_TLS_ENABLE=
CODER_TLS_KEY_FILE=
# Generate a unique *.try.coder.app access URL
CODER_TUNNEL=false
maf
maf3y ago
I don't think we resolve the address, so either changing the environment variable to CODER_ADDRESS=127.0.0.1:7080 or updating the template to replace localhost instead of 127.0.0.1 might work in this case.
Mixture
MixtureOP3y ago
@maf I'll try it. should I restart the coder service after changing the env variable?
maf
maf3y ago
Yup, that's needed for the change to become effective 👍 A stop/start on the workspace afterwards too (or delete/create).
Mixture
MixtureOP3y ago
one question, what is the difference between CODER_ACCESS_URL and CODER_ACCESS it quite confused me at the first place.
Phorcys
Phorcys3y ago
that shouldn't cause issues though the template replaces 127.0.0.1 with host.docker.internal
maf
maf3y ago
Oh right, mb, I misread (thought I was talking about CODER_ACCESS_URL. The difference between those two are: - CODER_ADDRESS tells coder server where to listen - CODER_ACCESS_URL lets coder server inform workspaces how to talk to it Are you running Coder on macOS or Linux (or Windows)? Or are you running Coder (server) inside Docker as well?
Mixture
MixtureOP3y ago
It's linux. the coder service itself is not ran by docker. by the way changing to CODER_ADDRESS="127.0.0.1:7080" caused the workspace to fail to run. Do I revert back to CODER_ADDRESS="localhost:7080" ? (Also this is a remote server and I'm using port forwarding to reach to localhost:7080)
maf
maf3y ago
Oh, that does change things.. hmm so in that case you can go ahead and revert, yeah. I honestly don't see why there would be a difference but if there is then go ahead. But wait, is Docker and Coder running on the same, or different servers?
Mixture
MixtureOP3y ago
The same
maf
maf3y ago
Ok Then you'll want a way for the Docker workspaces to talk to your server, listening only on localhost would prevent that (AFAIK). One option is to set CODER_ADDRESS=0.0.0.0:7080, another is to set it to the IP of e.g. the docker0 interface (something like 127.17.0.1), I'm not 100% sure tbh. Just know that if you set it to 0.0.0.0, then Coder will listen on all interfaces (also public IPs, if there are any).
Mixture
MixtureOP3y ago
I'm not an expert does this cause any security issues?
maf
maf3y ago
It depends. Is your server accessible to the outside world? If yes, then without blocking that port with a firewall, anyone could load up the Coder UI on your server.
Mixture
MixtureOP3y ago
there is a jump server in between. but the coder UI itself doesn't have authentication ? (Thanks for your replies by the way)
maf
maf3y ago
The Coder UI does have authentication, yeah. But even then some users won't feel comfortable exposing it to the outside world (risk mitigation).
Mixture
MixtureOP3y ago
@maf Changing to CODER_ADDRESS=0.0.0.0:7080 solved it! Thanks alot. In the first place I wanted to run code-server without docker. so I tried to create a simple template. Isn't there any other local provider option than docker?
maf
maf3y ago
Ben has some nice templates over at https://github.com/bpmct/coder-templates, I think at least the shared-mac template uses local user accounts, no Docker. You could take a look at that.
Mixture
MixtureOP3y ago
Great, I'll try them. The install section in the documentation (without docker) is not complete I guess. I had to figure out the CODER_ADDRESS and CODER_ACCESS_URL by myself. I suggest for more information about this situation there. Thanks for your time
maf
maf3y ago
Could you link the part of the documentation that was unclear? And thanks a lot for the feedback, it's very valuable to us, we want our documentation to be as clear and easy to understand as possible!
Mixture
MixtureOP3y ago
sure, https://coder.com/docs/coder-oss/latest/install#system-packages here it says # Set up an external access URL or enable CODER_TUNNEL sudo vim /etc/coder.d/coder.env but not exactly how to set the env variables or what the env variables actually are used for.
Installation - Coder OSS main docs
How to install and deploy Coder
Mixture
MixtureOP3y ago
I tried to figure out the difference between CODER_ADDRESS and CODER_ACCESS_URL but couldn't find it there. the docker-compose section only contained the CODER_ACCESS_URL and it miss-leaded me. after all my knowledge is limited but I just wanted to give a feedback on this.
maf
maf3y ago
Oh yeah I can totally see that happening, it's bits of information without really informing how it ties together. Thanks for pointing it out!
Mixture
MixtureOP3y ago
you're welcome
ericpaulsen
ericpaulsen3y ago
hi @Mixture - we heard your feedback and created a Configuration doc to define the primary env vars in /etc/coder.d/coder.env. Feel free to let us know if you have any thoughts on this page! https://coder.com/docs/coder-oss/latest/install/configure
Configuration - Coder OSS main docs
Learn how to configure Coder
Phorcys
Phorcys3y ago
AFAIK there's an issue about thisnalredy
Mixture
MixtureOP3y ago
that's great. The only thing I can add is using 127.0.0.1 instead of localhost which is recommended in that page failed in my case. (but maybe it just has to do with our servers configuration) the following issue is related too: https://github.com/coder/coder/issues/2874
GitHub
CODER_ACCESS_URL shouldn't require protocol · Issue #2874 · coder...
As a user, if the access URL is set to localhost:6080 instead of http://localhost:6080, workspaces will fail to build since "localhost" is assumed to be the protocol. We should ei...
Want results from more Discord servers?
Add your server