Web Based VSCode with code server

Published: 08 October 2020
on channel: i12bretro
555
7

#VSCode #BrowserBasedTools #DeveloperTools

Full steps can be found at https://i12bretro.github.io/tutorials...

--------------------------------------------------------------------
Installing code-server
--------------------------------------------------------------------
   01. Log into the Linux device
   02. Run the following commands in a terminal:
         download the code-server install.sh
         wget https://code-server.dev/install.sh
         make it executable
         chmod +x ./install.sh
         run the installer
         sudo ./install.sh --prefix=/usr/local
         start the service as root
         sudo su
         sudo systemctl enable --now code-server@$USER
         exit
         edit the config.yaml
         sudo nano /root/.config/code-server/config.yaml
   03. Edit the password, or change the authentication type to none and change the bind-addr to bind-addr: 127.0.0.1:8888
   04. Continue with the following command in terminal:
         restart code-server service
         sudo systemctl restart code-server@root.service
   05. Launch on web browser on the host running code-server and navigate to http://DNSorIP:8888
   06. Browser based VS Code......pretty nice
 
Out of the box, code-server is only reachable from the host that it is installed on. An easy to configure workaround is to setup a proxy server to allow requests to Apache/NGINX to be routed to code-server.
 
--------------------------------------------------------------------
Apache Proxy Server (optional, but recommended)
--------------------------------------------------------------------
   01. Run the following commands in terminal:
         install apache httpd
         sudo apt install apache2
         enable headers, rewrite, proxy and proxy_http modules
         sudo a2enmod proxy proxy_http rewrite headers proxy_wstunnel
         edit the default site
         sudo nano /etc/apache2/sites-available/000-default.conf
   02. Paste the following configuration into the existing VirtualHost
         ≪location /code≫
         RewriteEngine On
         RewriteCond %{REQUEST_FILENAME} !-f
         RewriteCond %{REQUEST_URI} !(.*)/$
         RewriteRule ^(.*)$ http://%{HTTP_HOST}/code/ [L,R=301]
         ≪/location≫
         ≪location /code/≫
         Header set X-Frame-Options ALLOWALL
         RewriteEngine On
         RewriteCond %{HTTP:Upgrade} =websocket [NC]
         RewriteRule /(.*) ws://127.0.0.1:8888/$1 [P,L]
         ProxyPreserveHost on
         ProxyPass http://127.0.0.1:8888/
         ProxyPassReverse http://127.0.0.1:8888/
         ≪/location≫
   03. Press CTRL+O, Enter, CTRL+X to write the changes to code-server.conf
   04. Continue with the following commands in terminal:
         restart the apache service
         sudo systemctl restart apache2
   05. Back in the web browser, navigate to http://DNSorIP/vscode
   06. Enjoy your web based VS Code
 
Source:  https://github.com/cdr/code-server
Proxy resource:  https://github.com/cdr/code-server/is...
 


Connect with me and others ###
★ Discord:   / discord  
★ Reddit:   / i12bretro  
★ Twitter:   / i12bretro  


On this page of the site you can watch the video online Web Based VSCode with code server with a duration of hours minute second in good quality, which was uploaded by the user i12bretro 08 October 2020, share the link with friends and acquaintances, this video has already been watched 555 times on youtube and it was liked by 7 viewers. Enjoy your viewing!