revised code-server doc
This commit is contained in:
+13
-40
@@ -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:
|
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.
|
* 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.
|
* 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
|
# Code-Server docker container deployment
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ I use Portainer to setup my docker-compose yaml:
|
|||||||
```
|
```
|
||||||
services:
|
services:
|
||||||
code-server:
|
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
|
container_name: code-server
|
||||||
environment:
|
environment:
|
||||||
- PUID=1000
|
- PUID=1000
|
||||||
@@ -24,55 +25,27 @@ services:
|
|||||||
# - HASHED_PASSWORD= #optional
|
# - HASHED_PASSWORD= #optional
|
||||||
# - SUDO_PASSWORD=password #optional
|
# - SUDO_PASSWORD=password #optional
|
||||||
# - SUDO_PASSWORD_HASH= #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
|
- DEFAULT_WORKSPACE=/config/workspace #optional
|
||||||
volumes:
|
volumes:
|
||||||
- /home/pi/docker/vscode:/config
|
- /home/pi/docker/vscode:/config
|
||||||
ports:
|
ports:
|
||||||
- 8443:8443
|
- 8443:8443
|
||||||
|
- 8124:8080 #spring port
|
||||||
|
- 3124:3000 #react port
|
||||||
restart: unless-stopped
|
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:
|
Generate ssh keys within the code server folder to connect to my Gitea instance. Navigate to the volume and execute:
|
||||||
|
|
||||||
```
|
```
|
||||||
ssh-keygen -t ed25519
|
ssh-keygen -t ed25519
|
||||||
```
|
```
|
||||||
|
|
||||||
Save the keys to the .ssh folder.
|
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
|
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:
|
Add the key and make the initial git commit in code-server:
|
||||||
|
|
||||||
```
|
```
|
||||||
mkdir where-is-my-stuff
|
mkdir project-name-folder
|
||||||
cd where-is-my-stuff
|
cd project-name-folder
|
||||||
touch README.md
|
touch README.md
|
||||||
git init
|
git init
|
||||||
git config --global init.defaultBranch main
|
git config --global init.defaultBranch main
|
||||||
@@ -95,9 +68,9 @@ git branch -m main
|
|||||||
git checkout -b main
|
git checkout -b main
|
||||||
git add .
|
git add .
|
||||||
git commit -m "initial commit"git config --global user.email "email@email.com"
|
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 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
|
git push -u origin main
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
**Vaessl: code-server adjustments**
|
||||||
|
|
||||||
|
Before developing on code-server I configure a Dockerfile to install all packages needed for Spring Boot, Java and Next.js. I install openjdk, npm, nodejs and yarn and set the environment variables for Java. Since the linuxserver code-server image doesn't come with root access for its default user abc out of the box every privileged action will be baked in 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 name it something like code-server-dev:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t code-server-dev .
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure to add code-server-dev:latest to the image env in the docker-compose file.
|
||||||
|
|
||||||
|
Now deploy the docker-compose and check all the configurations:
|
||||||
|
|
||||||
|
```
|
||||||
|
java --version
|
||||||
|
mvn --version
|
||||||
|
npm --version
|
||||||
|
yarn --version
|
||||||
|
nodejs --version
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user