Container endpoint progress; nginx proxying; websocket error.

Today, I'll further test the container endpoint and try and get it to work in production. I will be very surprised if it works in the state I left it yesterday, but who knows.

My approach has proven to be wrong. The websocket router is irrelevant. The only thing I need to serve is the http endpoint, and the served files will do the rest. However, the served files are now trying to reach other files thinking they're server from the root. However, I'm serving them from /container. So that won't work. I'm exploring other options, namely subdomains with nginx and docker swarm.

Some guy solved this and wrote about it extensively on https://github.com/coder/code-server/pull/1115. There's mentions of detecting idleness as well, which I'm going to need later on. Some useful info here as well: https://github.com/coder/code-server/issues/1636

Here's what I decided to do:

  • the orchestrator will be dockerized along with an nginx server
  • the orchestrator will modify and reload nginx config whenever needed
  • subdomains will be used to route to users' containers, eg. user123.be.codeinteractive.dev/

I've made a lot of progress, but a lot still has to be done. I've set up the nginx and the proxying seems to work. I didn't need to modify the nginx config in the end, I guess nginx is more powerful than I thought.

I can run docker commands on the host from the orchestrator container, and the containers can spin up normally. I can open the code-server, but still can't use it. I get a weird error telling me websocket closed with code 1006.

Tommorrow, I will get it ready for deployment. I need to make the server_name configurable, and fix whatever is making the websocket connection fail.