diff --git a/README.md b/README.md index 29a6a87..cb45e0e 100644 --- a/README.md +++ b/README.md @@ -75,19 +75,34 @@ A Chrome browser window will open inside VNC for the Claude Max OAuth login. Cre |-------|---------|-------------| | `name` | `""` | Instance name — used in all resource names (`devcontainer-{name}`) | | `githubRepo` | `""` | Repository to clone into `/workspace` on startup | -| `ide` | `vscode` | IDE to launch — `vscode`, `antigravity`, or `ssh` (see below) | +| `ide` | `vscode` | IDE to launch — `vscode`, `antigravity`, or `none` (see below) | +| `ssh` | `false` | Also start an OpenSSH server on port 22 (additive, any `ide`) | | `image.repository` | `ghcr.io/cpfarhood/devcontainer` | Container image | | `image.tag` | `latest` | Image tag | ### IDE choice +`ide` controls what GUI is launched in the VNC session: + | Value | Port | Description | |-------|------|-------------| | `vscode` (default) | 5800 (VNC) | VSCode desktop via browser-based VNC | | `antigravity` | 5800 (VNC) | Google Antigravity (VSCode fork with AI) via VNC | -| `ssh` | 22 (SSH) | OpenSSH server — no VNC GUI, connect via SSH | +| `none` | — | No IDE; container stays alive (useful when `ssh: true`) | -For `ssh` mode, add your public key to the env secret: +### SSH access + +`ssh: true` starts OpenSSH on port 22 **in addition to** the IDE. It works with any `ide` value: + +```bash +# SSH-only (no VNC) +helm install mydev ./chart --set name=mydev --set ide=none --set ssh=true + +# VSCode in VNC + SSH access at the same time +helm install mydev ./chart --set name=mydev --set ssh=true +``` + +Add your public key to the env secret: ```bash kubectl create secret generic devcontainer-mydev-secrets-env \ @@ -95,7 +110,7 @@ kubectl create secret generic devcontainer-mydev-secrets-env \ --from-literal=SSH_AUTHORIZED_KEYS='ssh-ed25519 AAAA...' ``` -Then connect with: +Then connect: ```bash kubectl port-forward deployment/devcontainer-mydev 2222:22 @@ -159,7 +174,7 @@ With any non-`none` value, a `ServiceAccount` named `devcontainer-{name}` is cre ``` Container start → cont-init.d/20-fix-user-shell.sh — fix shell/home on baseimage-gui app user - → cont-init.d/25-start-sshd.sh — start sshd if IDE=ssh + → cont-init.d/25-start-sshd.sh — start sshd if SSH=true → /startapp.sh (runs as app user, UID 1000) → init-repo.sh → clone / pull GITHUB_REPO into /workspace/{repo} @@ -167,7 +182,8 @@ Container start → happy daemon start — starts Happy Coder background daemon → IDE=vscode: code --new-window --wait /workspace/{repo} IDE=antigravity: antigravity --new-window --wait /workspace/{repo} - IDE=ssh: sleep infinity (sshd already running as root) + IDE=none: sleep infinity + (SSH=true: sshd also running as root on port 22) ``` ### Storage diff --git a/chart/Chart.yaml b/chart/Chart.yaml index a7ab285..4c19673 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: devcontainer description: Antigravity Dev Container with Happy Coder AI assistant type: application -version: 0.1.5 +version: 0.1.6 appVersion: "latest" diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 77bd7ef..0afd5a4 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -25,18 +25,21 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - {{- if eq (.Values.ide | default "vscode") "ssh" }} - - containerPort: 22 - name: ssh - protocol: TCP - {{- else }} + {{- if ne (.Values.ide | default "vscode") "none" }} - containerPort: 5800 name: vnc-web protocol: TCP {{- end }} + {{- if .Values.ssh }} + - containerPort: 22 + name: ssh + protocol: TCP + {{- end }} env: - name: IDE value: {{ .Values.ide | default "vscode" | quote }} + - name: SSH + value: {{ .Values.ssh | toString | quote }} - name: USER_ID value: {{ .Values.userId | quote }} - name: GROUP_ID @@ -68,7 +71,7 @@ spec: mountPath: /home - name: workspace mountPath: /workspace - {{- if ne (.Values.ide | default "vscode") "ssh" }} + {{- if ne (.Values.ide | default "vscode") "none" }} livenessProbe: httpGet: path: / @@ -81,7 +84,7 @@ spec: port: 5800 initialDelaySeconds: 10 periodSeconds: 5 - {{- else }} + {{- else if .Values.ssh }} livenessProbe: tcpSocket: port: 22 diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml index 3620c47..3e571ba 100644 --- a/chart/templates/service.yaml +++ b/chart/templates/service.yaml @@ -6,16 +6,17 @@ metadata: {{- include "antigravity.labels" . | nindent 4 }} spec: ports: - {{- if eq (.Values.ide | default "vscode") "ssh" }} - - port: 22 - name: ssh - protocol: TCP - targetPort: ssh - {{- else }} + {{- if ne (.Values.ide | default "vscode") "none" }} - port: 5800 name: vnc-web protocol: TCP targetPort: vnc-web {{- end }} + {{- if .Values.ssh }} + - port: 22 + name: ssh + protocol: TCP + targetPort: ssh + {{- end }} selector: {{- include "antigravity.labels" . | nindent 4 }} diff --git a/chart/values.yaml b/chart/values.yaml index 6092977..680d068 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -13,10 +13,13 @@ githubRepo: "" # Options: # vscode — VSCode via VNC browser UI on port 5800 (default) # antigravity — Google Antigravity (VSCode fork) via VNC on port 5800 -# ssh — OpenSSH server on port 22 (no VNC GUI) -# Requires SSH_AUTHORIZED_KEYS in the env secret. +# none — no IDE; useful when ssh: true is the sole access method ide: vscode +# Start an OpenSSH server on port 22 in addition to the IDE. +# Set SSH_AUTHORIZED_KEYS in the env secret to allow key-based login. +ssh: false + # Happy Coder endpoints happyServerUrl: "https://happy.farh.net" happyWebappUrl: "https://happy-coder.farh.net" diff --git a/scripts/cont-init-sshd.sh b/scripts/cont-init-sshd.sh index ec0d7af..efe69f2 100644 --- a/scripts/cont-init-sshd.sh +++ b/scripts/cont-init-sshd.sh @@ -1,9 +1,9 @@ #!/bin/sh -# Start OpenSSH server for SSH IDE mode. +# Start OpenSSH server when SSH=true. # Runs as root during container initialisation (cont-init.d). -[ "${IDE:-vscode}" = "ssh" ] || exit 0 +[ "${SSH:-false}" = "true" ] || exit 0 -echo "=== SSH IDE mode: starting sshd ===" +echo "=== SSH enabled: starting sshd ===" # Generate host keys if missing (first boot or ephemeral /etc/ssh) ssh-keygen -A 2>/dev/null || true diff --git a/scripts/startapp.sh b/scripts/startapp.sh index 07afe7a..7a781d4 100644 --- a/scripts/startapp.sh +++ b/scripts/startapp.sh @@ -23,8 +23,8 @@ case "$IDE" in echo "Opening Google Antigravity in: $WORKSPACE_DIR" exec antigravity --new-window --wait "$WORKSPACE_DIR" ;; - ssh) - echo "SSH mode: sshd started by cont-init. Keeping container alive." + none) + echo "IDE=none: no IDE launched, keeping container alive." exec sleep infinity ;; *)