Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Missing steps after installing via script #5564

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

Closed
svallory opened this issue Jan 4, 2023 · 5 comments · Fixed by #5626
Closed

Missing steps after installing via script #5564

svallory opened this issue Jan 4, 2023 · 5 comments · Fixed by #5626
Assignees

Comments

@svallory
Copy link

svallory commented Jan 4, 2023

!!!!!!! NOTE: !!!!!!!
Please don't take anything I say here too seriously.
The only reason I have to report this reeeeealy bad experience
is that I think you guys have an AMAZING product (I've tried v1) and I really want you guys to succeed!

Here is my experience so far...

  • Created a new droplet on Digital Ocean with ubuntu 22.04
  • The docs say I should follow the instructions at the end, so I tried to
  • Started the server without issues but then "coder login " got me confused
  • First question: do I do that from the server or my machine?
    • Looked for a CLI, found it inside administration/automation, plus...
    • The page says "We recommend automating Coder deployments through the CLI."
    • I'm assuming I don't need that to use coder (if I'm a dev)
    • So I should I'll try running login running that command in the server via SSH
  • Second question: but what URL is that?
    • which URL? I didn't pick one!
    • Ok, maybe Coder will pick it up automatically so I won't try the server's IP so I don't have to reconfigure it
  • Configured a new subdomain pointing to the coder server
  • Tried to login using the new domain and got a cryptic message (for one who doesn't know Coder's login flow)
    build info: unexpected status code 521: unexpected non-JSON response ""
    	Error: no response body
    unexpected non-JSON response "".
    Run 'coder login --help' for usage.
    
  • Ok, let's try the IP then...
    Failed to check server "https://161.35.116.193" for first user, is the URL correct and is coder accessible from your browser? 
    Error - has initial user: do: Get "https://161.35.116.193/api/v2/users/first": dial tcp 161.35.116.193:443: connect: connection refused
    Run 'coder login --help' for usage.
    
  • I see there is a "connection refused" on port 443
    • I have no firewall setup yet
  • Maybe it isn't running?
    • journalctl -u coder.service -b shows no message (btw, why do you ask users to run this after script completion?)
    • systemctl says it is active
  • Coder must be listening to the wrong port then, where is its configuration?
    • Next step from docs says I should go to Quick Start
      image
    • I decided to check there and it is another installation instruction using docker. There's in the "Installation" section and another (which looks way nicer) in the Quickstart
    • That makes me think: did I follow the right instructions? Maybe the whole "Installation" section is deprecated
  • I decided to go Rambo and do it myself, no manuals, let's find the configs!
  • systemctl status shows:
    image
    • That's gotta be it! /home/coder/.config/coderv2
  • There I found /home/coder/.config/coderv2 and the content is http://127.0.0.1:3000 (AHA!)
  • Stopped Coder, updated the file with https://sub.domain.com (let's use 80 instead of 3000), Started coder again
  • Trying to login again using the domain and got the "connection refused" error again
    • Oh... it has to be port 443!
  • Went to updated it again and, to my surprise, http://127.0.0.1:3000 was back!
  • Checked the docs again going straight to configuration section which states:
    Coder server's primary configuration is done via environment variables
    
    • Ok, my bad. I'm not Rambo after all, should have checked
  • Let's check how to configure the URL

    CODER_ACCESS_URL is required if you are not using the tunnel. Set this to the external URL that users and workspaces use to connect to Coder (e.g. https://coder.example.com/). This should not be localhost.

    • Wait, "This should not be localhost" ? Why is the default 127.0.0.1 then?
    • Maybe because the default is to use a tunnel? But that's the first time I'm hearing about it
    • Let's check the value of CODER_ACCESS_URL... no value set
    • Let's set it then...
  • Getting info about the variables with coder server --help shows two *_URL variables:
      --access-url string                            External URL to access your deployment.
                                                This must be accessible by all
                                                provisioned workspaces.
                                                Consumes $CODER_ACCESS_URL
      --url string            URL to a deployment.
                              Consumes $CODER_URL
    
    • Couldn't find any reference to $CODER_URL in the docs so let's go with $CODER_ACCESS_URL
    • Aaaand this too:
         --global-config coder   Path to the global coder config directory.
                              Consumes $CODER_CONFIG_DIR (default
                              "/root/.config/coderv2")
    
    • Now I'm REALLY confused!
    • But let's go looking because I REEEEALLY wanna test coder out!
  • Found another config file by chance at /etc/coder.d/coder.env which has the variable I want \o/
  • Set it to my domain, making sure I'm using httpS and restarted Coder
  • Still no answer on :443 and content of url file is still http://127.0.0.1:3000
  • So, just 'cause I had nothing to loose, I try coder login http://127.0.0.1:3000
  • And Coder nicely asks...
    image

YES!!!! I stopped to write this issue and I Goshh I really hope I don't have to come back here hahahaha


Do not edit this section. It is required for GitHub issue linking.

@BrunoQuaresma
Copy link
Collaborator

I'm sorry you had a bad experience, but thanks for taking time to write this feedback and share it with us. I'm bringing it to the team and we will see what are the next steps to improve the experience. I would love to have you testing it again in a near future to validate the improvements if you are up to it.

@svallory
Copy link
Author

svallory commented Jan 4, 2023

@BrunoQuaresma sure! Just ping me when it's updated.

I think most of the issues I had could be avoided by a few changes in the docs:

  • After script installations, take users to administration/configure/system-packages
  • Explain that code IS NOT listening to 80 or 443
    took me a long time to even think about checking that due to instructions like "run code login <deployment URL>
  • Add the output of coder server --help to the documentation so it is searchable (reading all that over an ssh connection is crazy! I download it and opened it in vs code)
  • The only mention of CODER_ADDRESS is in "administration/configure" and it is not clear if that is the property for binding since it does not show up in coder server options. Instead, there are CODER_HTTP_ADDRESS and CODER_TLS_ADDRESS

And this is probably a bug, but coder is working anyway... I set both CODER_ADDRESS and CODER_HTTP_ADDRESS to 0.0.0.0:80 but coderv2/url has http://127.0.0.1:80 as it's content

@svallory
Copy link
Author

svallory commented Jan 4, 2023

Btw, (in case anyone sees this before the docs are fixed), Here's a summary of what I had to do:

Explanation: Coder runs by default binded to the port 3000 on localhost, so it won't answer to outside requests. So you have 2 options. Bind coder to the external IP on ports 80 or 443 (will require setting up certificates), or setup something like an Nginx proxy to forward requests to Coder (there are Let's Encrypt tools that could be very helpful here).

To do the easiest one, after Coder is installed:

  1. Login to coder with coder login http://127.0.0.1:3000
  2. Follow the instructions to create the first user
  3. edit /etc/coder.d/coder.env and set the values of
    • CODER_ACCESS_URL to the URL you've pointed to Coder's server
    • both CODER_ADDRESS and CODER_HTTP_ADDRESS to 0.0.0.0:80
  4. restart coder (sudo systemctl restart coder in linux)
  5. You should now be able to connect to Coder from your machine
  6. If you are using Docker for the workspaces, follow the Quickstart but start from step 5

note: pick a folder to save the workspace templates and cd there before you run coder templates init. That command will create a folder for the template you choose in the current directory

I think that's all for now. In the end, I was able to get Coder running but my vscode-docker workspace never finished booting up :/ Bummer. Honestly, I would love to pay you guys a (small) monthly fee to be able to use workspaces on demand. I only need it for Live Sharing when I'm teaching anyways and Gitpod hasn't been handling that well.

Let me know when I can test the install again. Cheers!

@bpmct
Copy link
Member

bpmct commented Jan 9, 2023

Hey @svallory - sorry you ran into trouble here. I've made some changes in #5626 which should clarify the main points around the default access URL. Feel free to take a look and leave comments, if I missed something.

Listing all of the coder server config options in our documentation is also an excellent idea. I've created #5627 for this.

--

I think you've already figured this out with a lot of head-banging, but by default, Coder will listen on http://127.0.0.1 as well as on a public tunnel URL, which makes it reachable from external workspaces (e.g. containers, AWS VMs). I can totally see how CODER_HTTP_ADDRESS and CODER_ACCESS_URL can be confusing as well.

--

note: pick a folder to save the workspace templates and cd there before you run coder templates init. That command will create a folder for the template you choose in the current directory

We've added the "create template" experience in the UI in the next version, so you'll be able to set up templates without installing the CLI locally.

--

First question: do I [install the Coder CLI] from the server or my machine?

You can do either, honestly, I changed the install.sh copy a bit to clarify this a bit more.

@ElliotG
Copy link
Contributor

ElliotG commented Jan 9, 2023

@svallory I ended up using Helm to deploy on Digital Ocean's managed k8s cluster. I found the helm chart much easier than trying to install Coder directly on a droplet: https://github.com/ElliotG/coder-oss-tf/tree/main/digitalocean-k8s

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

Successfully merging a pull request may close this issue.

4 participants