From 146b9a2fe8168f5467bebaf65a7f7cc2c1a24050 Mon Sep 17 00:00:00 2001 From: Inga Date: Tue, 6 Sep 2022 20:02:23 +0200 Subject: [PATCH] VSCode Remote: it works! --- README.md | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 4b70501..77d821f 100644 --- a/README.md +++ b/README.md @@ -267,6 +267,10 @@ It should also be wayland by default, but you can check it by `doas apk add xeye In order for screen sharing to work, go to `chrome://flags/#enable-webrtc-pipewire-capturer` and enable it. Note though that every time you screenshare, there will be two promps from xdg-desktop-portal, one for picking a source, and another for actually sharing. +### Archives + +`apk install ouch` to avoid having to remember `tar` flags etc, and instead do `ouch decompress archive.tar.gz` (for any archive format). + ### Git ``` @@ -677,33 +681,40 @@ doas rc-service squid start In host, create new FF profile (`about:profiles`) for that purpose, and configure it to use squid proxy running inside of container. -#### VS Code Remote (does not work) +#### VS Code Remote -Connects to host successfully, but does not let to do anything (not even to open a folder): -produces "Connection error: Client refused: version mismatch" error, -presumably due to code-oss being used on VS client (system host) and vscodium being used on host (LXC container). -(Only code-oss is present in alpine packages, and only vscodium has remote-host binaries). +Note that VS Code (and all related products) has a protection intended to prevent OSS variants from connecting to proprietary versions of VS code. +However, apparently, it is implemented in such a way that it prevents even different OSS products from connecting to each other. +Only "Code OSS" is packaged for Alpine; and only VSCodium has server-side builds, so you'll need to patch Code OSS to make it pretend to be VSCodium. -Steps to get to that stage (one of the sources: https://github.com/microsoft/vscode-remote-release/issues/6347), -assuming that you already have keyring and key-based SSH auth (with non-RSA key) configured: +Steps to get it running, assuming that you already have keyring and key-based SSH auth (with non-RSA key) configured: -In container: +In container (one of the sources: https://github.com/microsoft/vscode-remote-release/issues/6347): ``` doas apk add gcompat libstdc++ curl bash git procps ``` and enable `AllowTcpForwarding` and `PermitTunnel` in `/etc/ssh/sshd_config`. -In host: +On host (where you intend to run IDE client): `doas apk add code-oss` -Edit `/usr/lib/code-oss/resources/app/package.json`: at the root level, add `"release": "22245",` -(replace 22245 with an actual value for your version from https://github.com/VSCodium/vscodium/releases). +Using e.g. Firefox, download `vscodium-reh-linux-x64-...` for a relevant build (with a version matching to code-oss) +from https://github.com/VSCodium/vscodium/releases + +Unpack it: `cd Downloads && ouch decompress vscodium-reh-... --dir vscodium` + +Edit `/usr/lib/code-oss/resources/app/package.json` to make it mimic VSCodium (looking at `package.json` from unpacked VSCodium). +In my experience, changing `name`, removing `distro`, and adding `release` fields was enough. +(Make sure that `version` fields are identical between installed Code OSS and downloaded VSCodium package.) -Edit `/usr/lib/code-oss/resources/app/package.json`: at the root level, add `"commit": "COMMIT_ID", "quality": "stable",` -(replace COMMIT_ID with an actual commit id from the same source). -Replace "serverApplicationName" with "codium-server", and "serverDataFolderName" with ".vscodium-server". +Edit `/usr/lib/code-oss/resources/app/product.json` to make it mimic VSCodium (looking at `product.json` from unpacked VSCodium). +In my experience, changing `nameShort`, `nameLong`, `applicationName`, `dataFolderName`, `win32MutexName`, +`licenseUrl`, `serverApplicationName`, `serverDataFolderName`, `win32DirName`, `win32NameVersion`, `win32RegValueName`, +`linuxIconName`, `reportIssueUrl` and `date` fields, +and adding `updateUrl`, `quality` and `commit` fields was enough. +But most of these fields are probably irrelevant and can be left as is. Run `code-oss`, add "Open Remote - SSH" extension by jeanp413, exit. @@ -712,7 +723,9 @@ Add `"enable-proposed-api": ["jeanp413.open-remote-ssh"]` at the root level of ` Run `code-oss` again, you'll get remote button under the marketplace button. Go there, add your host, right-click it, connect. Connection should be successful, and you should see "connected to remote" on Code OSS main screen. -But "Open file" / "Open folder" will still list local directory structure, and in debug output for "Window" there will be an error message about "version mismatch". +"Open folder" should take you to the remote directory structure, allowing you to open projects hosted in container. +All code-related extensions will also work in remote context, isolated from the parent system and unable to affect it, +no matter what malicious npm packages get installed into container. ### Docker @@ -744,7 +757,6 @@ and restart container (`doas lxc restart CONTAINERNAME`). * Fix internal mic * Docker in containers ran by unprivileged users -* IDE (code-oss?) * Make river usable * Make waybar usable (+waybar fonts) * nushell + starship instead of ash