revised code-server doc
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
**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 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 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
|
||||
|
||||
I use Portainer to setup my docker-compose yaml:
|
||||
|
||||
```
|
||||
services:
|
||||
code-server:
|
||||
image: code-server-dev:latest #note this is a custom image generated later (docs Preparation folder)
|
||||
container_name: code-server
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Europe/Vienna
|
||||
# - PASSWORD= #optional
|
||||
# - HASHED_PASSWORD= #optional
|
||||
# - SUDO_PASSWORD=password #optional
|
||||
# - SUDO_PASSWORD_HASH= #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
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
Check if the keys are there:
|
||||
|
||||
```
|
||||
ls -l /config/.ssh/id_ed25519
|
||||
```
|
||||
|
||||
Copy the public key and paste it into the SSH-keys of the git instance
|
||||
Connect the ssh keys of code-server to the git instance (here the -p flag is necessary because I defined a separate SSH port since it is running in docker and I need to avoid using the docker SSH port):
|
||||
|
||||
```
|
||||
ssh -T -p 222 git@192.168.1.208
|
||||
```
|
||||
|
||||
Add the key and make the initial git commit in code-server:
|
||||
|
||||
```
|
||||
mkdir project-name-folder
|
||||
cd project-name-folder
|
||||
touch README.md
|
||||
git init
|
||||
git config --global init.defaultBranch main
|
||||
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 "user"
|
||||
git commit -m "initial commit"
|
||||
git remote add origin ssh://git@192.168.1.208:222/user/project-name-folder.git
|
||||
git push -u origin main
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user