From 7d9b4aded3196c20f0b26434f0696398cca2d563 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Sat, 15 Mar 2025 09:42:06 -0700 Subject: [PATCH 1/2] Document Code Server --- 2025-03-13_Code-Server.md | 93 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 2025-03-13_Code-Server.md diff --git a/2025-03-13_Code-Server.md b/2025-03-13_Code-Server.md new file mode 100644 index 0000000..741480b --- /dev/null +++ b/2025-03-13_Code-Server.md @@ -0,0 +1,93 @@ +--- +date: 2025-03-13 +title: Code Server +tags: + - homelab + - development + - software + - code-assistant +--- + +I recently started using [Forgejo](https://forgejo.org/) for managing my personal projects (including this blog content). +Prior to this, I was using self-hosted [GitLab](https://about.gitlab.com/); maybe I'll write a full post about this +in the future, but basically I made the change because GitLab in Docker was a real memory hog and I much prefer +open source solutions where available. One thing I missed from GitLab (and GitHub) is the built-in web IDE for +making changes without having to clone the project locally. I found [Coder](https://coder.com/docs/code-server) +which provides a containerized VSCode PWA that I plan to use as an alternative to GitHub Codespaces and GitLab +workspaces. + +## What is Code Server +Code Server is an open source container distribution of VSCodium. VSCodium is the open source release of VSCode (think +Chromium and Google Chrome). I personally have more experience with PyCharm and other JetBrains IDEs, but VSCode +is another popular option and I've been making the transition at work from PyCharm to VSCode after comparing the +LLM integration between them. Long story short, VSCode is miles ahead of JetBrains IDEs for code writing and +LLM context management as of sometime last week when I tested them both. + +I haven't fully evaluated the differences between VSCode and Code Server yet, but in the context of a replacement for +what I had with GitLab and GitHub I am satisfied with what I see in Code Server. + + +## Deployment +Deployment is as simple as starting a Docker container. In addition to the documented setup process, I also mounted +a directory with my SSH configuration and keys so that I can easily connect to GitHub and my private Forgejo via SSH. + +I configured nginx ingress (for access from my LAN only). For most deployments, its probably easier to just use IP +addresses but I like using nginx so that its a little easier to move deployments around and just update Nginx to point at +the appropriate IP address. I've included my site config below in case anyone reading this wants to achieve something +similar. I don't know that this is optimal, but it is working. + +``` +server { + listen 80; + listen 443 ssl; + server_name code.*; + + include /config/nginx/ssl.conf; + add_header Front-End-Https on; + + + location / { + include /config/nginx/local_only.conf; + include /config/nginx/resolver.conf; + + # Advanced Proxy Config + send_timeout 5m; + proxy_read_timeout 240; + proxy_send_timeout 240; + proxy_connect_timeout 240; + + # Basic Proxy Config + proxy_set_header Host $host:$server_port; + proxy_set_header X-Client-IP $http_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_redirect http:// $scheme://; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection upgrade; + proxy_set_header Accept-Encoding gzip; + proxy_cache_bypass $cookie_session; + proxy_no_cache $cookie_session; + proxy_buffers 32 4k; + proxy_max_temp_file_size 2048m; + + proxy_set_header X-Forwarded-Host code.mcknight.tech; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Ssl on; + proxy_pass http://coder:8080/; + } +} +``` + +## Future Plans +I still have some work to do before I decide whether or not Code Server can be my regular IDE, but so far it is a +solid option for when I'm on my laptop doing things like writing this post. Compared to a VM, I appreciate being +able to just copy/paste from my local clipboard. I might check out Coder as a more complete reproducible workspace +in lieu of Code Server, or I might give in and go with VSCode in a VM so that I get Copilot integration. + +On a related node, I did try Cursor at work and was impressed with the LLM integration which does seem to outdo +what VSCode offers. I decided against adopting it for regular use since you do have to commit to a monthly +subscription and I'm not a big fan of the UI changes they applied on top of VSCode. My hope is that eventually +VSCode or some fork of it will enable local LLM integration, but then I would also want an open source LLM that +performs comparably to GPT-4o and Claude 3.7. From 9069ebe0d77c6f47c8f81b904f5a5d74782d5ff2 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Sun, 18 May 2025 21:04:36 -0700 Subject: [PATCH 2/2] Update Code Server post --- ...ode-Server.md => 2025-05-18_Code-Server.md | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) rename 2025-03-13_Code-Server.md => 2025-05-18_Code-Server.md (70%) diff --git a/2025-03-13_Code-Server.md b/2025-05-18_Code-Server.md similarity index 70% rename from 2025-03-13_Code-Server.md rename to 2025-05-18_Code-Server.md index 741480b..1391516 100644 --- a/2025-03-13_Code-Server.md +++ b/2025-05-18_Code-Server.md @@ -1,5 +1,5 @@ --- -date: 2025-03-13 +date: 2025-05-18 title: Code Server tags: - homelab @@ -11,7 +11,7 @@ tags: I recently started using [Forgejo](https://forgejo.org/) for managing my personal projects (including this blog content). Prior to this, I was using self-hosted [GitLab](https://about.gitlab.com/); maybe I'll write a full post about this in the future, but basically I made the change because GitLab in Docker was a real memory hog and I much prefer -open source solutions where available. One thing I missed from GitLab (and GitHub) is the built-in web IDE for +open source solutions where available anyway. One thing I missed from GitLab (and GitHub) is the built-in web IDE for making changes without having to clone the project locally. I found [Coder](https://coder.com/docs/code-server) which provides a containerized VSCode PWA that I plan to use as an alternative to GitHub Codespaces and GitLab workspaces. @@ -72,7 +72,7 @@ server { proxy_buffers 32 4k; proxy_max_temp_file_size 2048m; - proxy_set_header X-Forwarded-Host code.mcknight.tech; + proxy_set_header X-Forwarded-Host ; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Ssl on; proxy_pass http://coder:8080/; @@ -80,14 +80,19 @@ server { } ``` -## Future Plans -I still have some work to do before I decide whether or not Code Server can be my regular IDE, but so far it is a -solid option for when I'm on my laptop doing things like writing this post. Compared to a VM, I appreciate being -able to just copy/paste from my local clipboard. I might check out Coder as a more complete reproducible workspace -in lieu of Code Server, or I might give in and go with VSCode in a VM so that I get Copilot integration. +## First Impressions +I wrote the bulk of this post about 2 months ago and I admittedly have not found myself using Code Server for +anything other than this blog project. I have been using Copilot in VSCode more regularly in my day-to-day, and its +lack of support in Coder is probably a deal breaker for me. Even though I am unlikely to continue using Code Server, +I may check out Coder as a method for exposing a different IDE via web browser. -On a related node, I did try Cursor at work and was impressed with the LLM integration which does seem to outdo -what VSCode offers. I decided against adopting it for regular use since you do have to commit to a monthly -subscription and I'm not a big fan of the UI changes they applied on top of VSCode. My hope is that eventually -VSCode or some fork of it will enable local LLM integration, but then I would also want an open source LLM that -performs comparably to GPT-4o and Claude 3.7. +## Future Plans +As mentioned, I might check out Coder as a more complete reproducible workspace +in lieu of Code Server. Alternatively, I might just run VSCode in a VM as a simpler solution, though I would miss +having things like easy clipboard integration. + +I have also started looking into [Neovim](https://neovim.io/) for code management and might work that into my setup. +I don't expect to get any kind of LLM code assistant functionality in `nvim`, but it would be an easy way to have a +single dev system that I can just connect to from whatever client I have available. I will probably dedicate my next +post here to documenting my `nvim` configuration (along with some updates to my +[previously-documented shell customizations](https://blog.mcknight.tech/2024/03/27/Shell-Customizations/)).