Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for code-server by coder
Greg, The JavaScript Whisperer
Greg, The JavaScript Whisperer

Posted on • Edited on

     

code-server by coder

code-server by coder

This project provides a version of VS Code that runs a server on a remote machine and allows access through a modern web browser.

Find the project repohere

What is it in my humble simple language? It’s been called a “runner” in GitLab; but essentially it running the code and terminal command on a remote machine. That can be in the cloud, ondocker ornatively install on your own machine.

Many people will not need this functionality, the costs of cloud hosting and processing might not be appealing. My use-case is I like to code on really underpowered machines. One of those is my beloved 2012 macbook air 11” with 2 cores. It light as a feather sits on my lap nice and looks like some sort of knife.

The Apple MacBook Air 11-inch (Mid-2012) gets a third-generation Intel processor and USB 3.0. But ultrabooks have caught up, and surpassed the MacBook on some features (like screens) and price points. - Apple MacBook Air 11-inch (Mid 2012)

*Sidebar: this has to be the thinest apple product to date, I don’t care what they say about the iPad! 05.3cm vs 1.7cm-0.3cm with keyboard and monitor 🕵️‍♀️ ….and my other goto coding machine is a Raspberry Pi.

## Running code-server on your host machine

So however you get it installed start the server, I'll be quoting macos and homebrew but see all the example setups on the same page. Withhomebrew it would be

brew install code-serverbrew services start code-server# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
Enter fullscreen modeExit fullscreen mode

and opening the config.yaml would look something like this:

bind-addr: localhost:8080auth: passwordpassword: passwordcert: false
Enter fullscreen modeExit fullscreen mode

At this point you could navigate tohttp://localhost:8080 and see a vscode instance in your browser! you will be prompted for the password.

Image description

What's missing so far, is the SSL cert and https:// hosting, this is important / cool because firstly you shouldn't have a tunnel to your local machine unencrypted and cool because they provide a PWA

Image description

Even better and what I opted for is areverse proxy with Caddy if you are on the homebrew path you can \
brew install caddy then you will find the config here on macos/opt/homebrew/etc/Caddyfile

For a quick start you can edit your hosts filesudo nano /etc/hosts/ and append a url you would like such as \
127.0.0.1 coder.localhost the .localhost holds special meaning to caddy and certs.

Now to the reverse proxy we can create one in the Caddyfile like so

coder.localhost, mbp.local {    reverse_proxy 0.0.0.0:8080}
Enter fullscreen modeExit fullscreen mode

I've added my mac host name also to be served on my LAN with https. Repeat this proxy and /hosts setup on your remote machine (minus mbp.local) you can now access and run you host instance on your remote machines.

You can even code on you mobile phone or ipad etc through "https://mbp.local" or your hostname.

You can take this one step further and access from anywhere in the world with something likeducksdns if you go down this route, you should implement some security, Caddy has all you need JWT protection IP allowlisting and more.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Specialist in performance oriented javascript architecture for web, mobile, client and server side. Passionate about realtime web.
  • Location
    London, UK
  • Work
    Web Developer
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp