Is it possible to run VSCode on a remote server and access it via a browser? What are the benefits/drawbacks to running a Web IDE this way? What kind of server specs do I need? What are the steps to setting it up? How do I make sure the server is secure?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
Thanks for the great question!
Yes this is definitely possible thanks to a company called Coder. They recently open sourced a project called Coder Server. It basically allows you to run VScode on a remote server and access it via your browser.
Benefits:
This allows you access your IDE from any machine (even your phone if you needed to)
You could have multiple people working on the same project from the same editor
And of course if you run it on DigitalOcean you could easily add more resources to the server that you are running the VScode on at any time
Even though you would be working from your browser it actually feels just as you were to work on your desktop
Drawbacks:
I’ve noticed that when saving files there’s some delay as the files have to actually be saved on the remote server, though to be honest when writing code you can’t notice the lag
You would have to pay for the resources that you use, though again if the laptop that you use is not very powerful it would be quite handy for you. For example I have an old MacBook Air with only 4GB of RAM so running my IDE on a DigitalOcean server saves me a lot of local resources
Another downside is that you would always need internet access to be able to work on your project
Server Specs:
As far as I know it is recommended to start with at least 2 CPUs and 7-8GB of Memory
I’ve tested it on Ubuntu but it should work on any other major Linux Distributions
Installation and Configuration:
Before you start you would need to create a droplet via the DigitalOcean control panel with the recommended 2 CPUs and 8GB of RAM. Then you would have to SSH to the droplet. If you are not sure how to do that you could follow the step here:
https://www.digitalocean.com/docs/droplets/how-to/connect-with-ssh/putty/
Once you’ve created and accessed your VM, you need to get a copy of the latest release of Code Server and deploy it on the droplet.
https://github.com/codercom/code-server/releases/latest
wget
command:Note: Change the URL with the latest Code server release to make sure that you are running the latest version!
https://my.ip.goes.here:80/
As by default code server uses a self signed SSL, you would get an SSL warning in your browser that you could accept and ignore.
That is pretty much it, now you would have your IDE running on DigitalOcean and it would work and feel just like the on your desktop!
Security
What I would suggest is the following:
https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-web-server-and-reverse-proxy-for-apache-on-one-ubuntu-18-04-server
https://github.com/cdr/code-server/blob/master/doc/security/code-server.fail2ban.conf
And
https://github.com/cdr/code-server/blob/master/doc/security/fail2ban.md
https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04
Hope that this helps! Regards, Bobby