revised code-server doc

This commit is contained in:
2026-03-20 02:24:13 +01:00
parent 15831aefd7
commit 71d5f23e5f
2 changed files with 50 additions and 40 deletions
@@ -1,11 +1,12 @@
**Vaessl: Technical preparation for adding documentation**
**Vaessl: Initial code-server setup**
Before documenting all my research for the planning phase of the app there are several technical preparations to arrange:
* I will be coding in a [code-server](https://github.com/coder/code-server) docker instance so that I can develop and build my app in a central location. This way I'm not dependent on building the project on every machine I work from.
* I will be coding and documenting in a [code-server](https://github.com/coder/code-server) docker instance so that I can develop and build my app in a central location. This way I'm not dependent on building the project on every machine I work from.
* I will be using a locally hosted docker instance on my Proxmox server to deploy the code-server container.
* After preparing the container I will connect it to my self hosted Git(ea) repository to ensure a git flow from the very beginning.
* To ensure SSL which is recommended for code-server I will use a tunnel with my Pangolin instance and Cloudflare as DNS resolver. This is a temporary solution later it will be changed to a self signed cert with Caddy.
* To ensure SSL which is recommended for code-server I will use a tunnel with my Pangolin instance and Cloudflare as DNS resolver. This is a temporary solution later it will be changed to a self signed cert with Caddy so that is not truly publicly available. If I need to access code-server remotely I will do it via Wireguard tunnel.
* While I'm at it I will set up all the ports for backend and frontend
# Code-Server docker container deployment
@@ -14,7 +15,7 @@ I use Portainer to setup my docker-compose yaml:
```
services:
code-server:
image: code-server-dev
image: code-server-dev:latest #note this is a custom image generated later (docs Preparation folder)
container_name: code-server
environment:
- PUID=1000
@@ -24,55 +25,27 @@ services:
# - HASHED_PASSWORD= #optional
# - SUDO_PASSWORD=password #optional
# - SUDO_PASSWORD_HASH= #optional
# - PROXY_DOMAIN=code-server.my.domain #optional
- PROXY_DOMAIN=code-server.my.domain #this is important to generate a proper forward address for ports 8080 and 3000
- DEFAULT_WORKSPACE=/config/workspace #optional
volumes:
- /home/pi/docker/vscode:/config
ports:
- 8443:8443
- 8124:8080 #spring port
- 3124:3000 #react port
restart: unless-stopped
```
Before deploying the container I configure a Dockerfile to install openjdk, maven, npm, nodejs and yarn and set the environment variables for Java to ensure the Java and React development. Since the code-server container doesn't come with root access for its default user abc out of the box every root action will be configured here:
```
FROM lscr.io/linuxserver/code-server:latest
USER root
RUN apt update && apt install -y \
openjdk-25-jdk maven \
nodejs npm \
&& npm install -g yarn \
&& rm -rf /var/lib/apt/lists/*
ENV JAVA_HOME=/usr/lib/jvm/java-25-openjdk-amd64
ENV PATH="$JAVA_HOME/bin:${PATH}"
```
Build the custom image and name it code-server-dev which is referenced in the docker-compose image above:
```
docker build -t code-server-dev .
```
Generate ssh keys within the code server folder to connect to my Gitea instance. Navigate to the volume and execute:
```
ssh-keygen -t ed25519
```
Save the keys to the .ssh folder.
Now deploy the docker-compose and check all the configurations:
Check if the keys are there:
```
java --version
mvn --version
npm --version
yarn --version
nodejs --version
ls -l /config/.ssh/id_ed25519
```
@@ -86,8 +59,8 @@ ssh -T -p 222 git@192.168.1.208
Add the key and make the initial git commit in code-server:
```
mkdir where-is-my-stuff
cd where-is-my-stuff
mkdir project-name-folder
cd project-name-folder
touch README.md
git init
git config --global init.defaultBranch main
@@ -95,9 +68,9 @@ git branch -m main
git checkout -b main
git add .
git commit -m "initial commit"git config --global user.email "email@email.com"
git config --global user.name "kasun"
git config --global user.name "user"
git commit -m "initial commit"
git remote add origin ssh://git@192.168.1.208:222/kasun/Where-is-my-stuff.git
git remote add origin ssh://git@192.168.1.208:222/user/project-name-folder.git
git push -u origin main
```