Code-server: How do you get a website to auto deploy the code server?

Created on 9 Apr 2019  路  22Comments  路  Source: cdr/code-server

I was wondering if there was some way to basically do what you guys did on coder.com. I want to be able to use the same password every time, and start it from a website. I do not really know how to do this, but I have root access to a Ubuntu 16.04 VPS so any help would be really cool.

question waiting-for-info

All 22 comments

Hey @crazytaj, you can self host! We provided examples written in docs/, you just need to expose it to the internet.

We provide two ways to host your instance: Docker or manual install.

@crazytaj You can write a Unit File in Systemd service for the code server to start and restart even after a VPS restart.

Part 1

[Unit]
Description=Code Server AutoStart
After=http://network.target 

[Service]
Type=simple
User=$USER
WorkingDirectory=/path/to/start/your/working/directory/inside/vscode
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
Restart=on-failure

ExecStart=/path/to/codeserver/binary --allow-http --password=xxxxxxx

[Install]
WantedBy=http://multi-user.target 

Then run the below commands

sudo systemctl daemon-reload
sudo systemctl start code-server.service
sudo systemctl enable code-server.service

This will start your code-server at theport 8443 and test this by directly going to your IP:8443 in the browser and the password you mentioned above will be the same untill you edit your Unit File.

Learn more about systemctl


Part 2

Do the Prerequisites Part and Step 4 in the below link to proxy your port 8443 to your own domain using nginx.

Digital Ocean Tutorial

I tried starting the code server, but I got a JSON error. It says unexpected end of file in some bootstrap directory. I can paste it in here if you want.

@crazytaj Just ignore the JSON error.

I cant because it causes the page to not load and fail

@crazytaj Did you try the docker file.?

I dont have docker installed, it is a vps with 1 gb of ram

I think if you use the docker file and increase the RAM to 2gb things should work just fine.

I dont have enough for a 2gb vps, thats all I have. But I dont think that is the issue. The error it gives when I try to connect is about an unexpected end to a JSON file and was left hanging. If you need me to I can record me trying to install it.

the JSON error is minor, and we鈥檙e figuring out how to run code-server in Raspberry Pi Zero

Alright. Is there a way to get it to run successfully, or is it just a wait until it is fixed kind of deal?

Feel free to check it out at #140 for progress.

You could always add swap. Works well for me on a 600mb VM

what is swap?

never mind, it is just 'RAM' on the HD. Do you think more ram is needed for it to run? I thought I had successfully run it before but after I setup my web server, it isn't running. I tried doing it on a clean install of Ubuntu 16.04 but it didn't work either.

here is a video of the problem if it helps:
https://www.youtube.com/watch?v=3jMiHl0Pqjc
ignore the background sounds. I was in class

Are you running the server behind nginx as a reverse proxy?

no, my server is running apache. I just moved into that folder for the editing part.

@crazytaj Have you had a chance to try out v2? It might solve the problem. It's also possible Apache needs to be configured according to this: https://github.com/cdr/code-server/blob/master/doc/quickstart.md#apache-reverse-proxy

I haven't gotten a chance to check out v2 yet. Kinda got demoralized after my failed attempt at customizing the server. Might pick it up again.

Requesting further information. Failure to reply means it was fixed in your end and I'll close this automatically after 3 days.

If this is still a problem, please feel free to reopen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oonqt picture oonqt  路  3Comments

KSXGitHub picture KSXGitHub  路  3Comments

balazssoltesz picture balazssoltesz  路  3Comments

justmao945 picture justmao945  路  3Comments

broady picture broady  路  3Comments