Work Everywhere: Build a Serverless Visual Studio Code in Browser using Railway


Often, I do the leetcoding at spare time such as watching kids running in soft play or other e.g. family events. Leetcoding is handy as long as you have a browser. But sometimes, I’d like to do some programming which is not easy as on iPad there is no proper IDE replacement for Visual Studio Code.

The only workaround is to install a SSH Terminal so that i can remote SSH to my VPS servers and coding using vi/vim editor.

keychron-wireless-keyboard-with-ipad-bluetooth Work Everywhere: Build a Serverless Visual Studio Code in Browser using Railway cloud console SSH visual studio online

Code-Server

Open Source Project: https://github.com/cdr/deploy-code-server
With this Open Source project, you can deploy to your VM (VPS Server) or serverless container such as Heroku or Railway the code server so that you can code in a browser via Visual Studio Code.

Railway.app

serverless application. With basic accounts, you can have $5 free credit monthly or $10 if you bind your credit card.

$10 is enough for running a Visual Studio Code.

Deploy web-base Serverless Visual Studio Code

First, you need to fork: https://github.com/cdr/deploy-code-server

Then, New a Project, select “Deploy from Repo”, wait for the Deployment to finish.

railway-deploy-from-repo Work Everywhere: Build a Serverless Visual Studio Code in Browser using Railway cloud console SSH visual studio online

Add an Environment variable aka “PASSWORD” which is the password you would need later to login to visual studio code.

railway-set-password-env Work Everywhere: Build a Serverless Visual Studio Code in Browser using Railway cloud console SSH visual studio online

Set a custom domain or a preferred Railway URL.

railway-deploy-production-domain Work Everywhere: Build a Serverless Visual Studio Code in Browser using Railway cloud console SSH visual studio online

The railyway charges per CPU and RAM usage. You can view the metrics on Railway Dashboard/Metrics.

railway-metrics Work Everywhere: Build a Serverless Visual Studio Code in Browser using Railway cloud console SSH visual studio online

Open the browser, type in the URL. Login with the password you’ve just configured in the environment variables – then you are good to go!

vscode-in-a-browser Work Everywhere: Build a Serverless Visual Studio Code in Browser using Railway cloud console SSH visual studio online

The monthly free credit $5 (cut from $10 per month) is enough for running a Code-Server. If you observe a high running cost, re-deploy may help since the RAM usage is accumulated, but be noted that the data will be lost unless you persist them on external hard disk such as Dropbox, S3 Object, Google Drive etc.

project-usage-railway Work Everywhere: Build a Serverless Visual Studio Code in Browser using Railway cloud console SSH visual studio online

You can Ctrl+J to open a Terminal in VS Code. The server seems very powerful: 64 cores, 1TB hard disk, more than 200GB RAM. But just remember: you pay for what you used.

Also, the harddisks will be totally wiped out (reset to a clean state) once the project is re-deployed. The project will be re-deployed on a new Pull Request, or a commit. You can sync your data to Dropbox or other cloud storage providers. Some may write a script to sync the data every 30 minutes. Just remember to git push/commit if you use this as the development.

I was going to install remote SSH plugin/extension in visual studio code, so that I can Remote SSH to any servers to do some serious/good work. However, the Microsoft Remote SSH plugin/extension is not supported in the code-server (maybe due to Copyright issues). However, you can SSH to other servers in the Terminal so at least I can use this as a portable web-based SSH Terminal.

I can also use the Code Server as a notebook – sometimes a handy place to take some notes. To use this as a full development environment, it is still not very convenient for example, the keys conflict with the browser: Ctrl+W, Ctrl+Shift+P etc. And also, we can’t redirect/remap the ports, so for front-end engineers, the debugging may become a big problem.

After all, the $5 free credit is not a bad thing. You can get a “Free” visual studio code that runs in the browser – which means you can work everywhere.

Register Railway.App and Get $10 Free Monthly Credit Now!

Multiple SSH Consoles in Browser

Apart from taking/saving a note everywhere (as long as you have access to Browser and internet), A Remote VS Code’s best usage to me is to have a few consistently running SSH consoles. I can install SSH plugins in Visual Studio Code Server, and have SSH connections opened and aligned horizontally. Then I don’t need to worry about my home PC internet connections dropping or aborting suddenly that causes SSH to abort e.g. PuTTY software. I can SSH everywhere (Cloud SSH Consoles).

run-ssh-shells-in-browser-via-railway-code-server-scaled Work Everywhere: Build a Serverless Visual Studio Code in Browser using Railway cloud console SSH visual studio online

Cloud SSH Consoles in the Browser

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
1192 words
Last Post: Teaching Kids Programming - Reverse Only Letters via Two Pointer Algorithm
Next Post: Teaching Kids Programming - Minimum Difference Between Highest and Lowest of K Scores

The Permanent URL is: Work Everywhere: Build a Serverless Visual Studio Code in Browser using Railway

Leave a Reply