diff --git a/CLAUDE.md b/CLAUDE.md index 2153ef2..1b0550a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -151,7 +151,7 @@ collapse and the existing grouping stands. `.env.example` follows its compose file's order. The names differ — one `PASSWORD` can feed several container variables, and `SERVICE_HOSTNAME` feeds -`hostname:` — so each entry sits where the first compose entry that reads it sits. +`hostname:` and `HOST` — so each entry sits where the first compose entry that reads it sits. Reordering a compose file means reordering the `.env.example` with it. ## Deployment target diff --git a/code-server-lsio/.env.example b/code-server-lsio/.env.example index 338184d..6738d00 100644 --- a/code-server-lsio/.env.example +++ b/code-server-lsio/.env.example @@ -2,7 +2,7 @@ # # cp .env.example .env -# Container hostname. +# Container hostname, also passed in as HOST -- the name zsh's prompt shows. SERVICE_HOSTNAME=code-server-lsio # Web UI login password. Required. diff --git a/code-server-lsio/README.md b/code-server-lsio/README.md index 8ed0930..564bad9 100644 --- a/code-server-lsio/README.md +++ b/code-server-lsio/README.md @@ -32,7 +32,7 @@ separate rootless daemon. | Variable | Purpose | | --- | --- | -| `SERVICE_HOSTNAME` | Container hostname. | +| `SERVICE_HOSTNAME` | Container hostname, and the name the shell prompt shows. | | `PASSWORD` | Web UI login, also the in-container sudo password. Required. | | `GIT_NAME` / `GIT_EMAIL` | Git author and committer identity | | `PWA_APPNAME` | Optional. Name of the installed web app; defaults to `code-server`. | @@ -43,6 +43,14 @@ The compose file refuses to start when `PASSWORD` is unset or blank. The image itself would start anyway and serve code-server with no authentication, on a container that holds the Docker socket. +`SERVICE_HOSTNAME` is used twice: as the container's `hostname:` and as the +`HOST` variable inside it. Coolify injects `HOST=0.0.0.0` into every compose +app, and zsh seeds `$HOST` and the `%m`/`%M` prompt escapes from that variable +rather than calling `gethostname()` — so the prompt reads `0`, the first +dot-separated field of `0.0.0.0`. code-server itself never reads `HOST` — it +binds `[::]:8443` — so overriding it only affects the prompt. bash is +unaffected; its `\h` uses the real hostname. + `PUID`/`PGID` are pinned to `1000` in `compose.yml`; the `Dockerfile` depends on that (see [Storage](#storage)). diff --git a/code-server-lsio/compose.yml b/code-server-lsio/compose.yml index 401d15d..d6a9279 100644 --- a/code-server-lsio/compose.yml +++ b/code-server-lsio/compose.yml @@ -17,6 +17,7 @@ services: - GIT_AUTHOR_EMAIL=${GIT_EMAIL} - GIT_COMMITTER_NAME=${GIT_NAME} - GIT_COMMITTER_EMAIL=${GIT_EMAIL} + - HOST=${SERVICE_HOSTNAME} # - PWA_APPNAME=${PWA_APPNAME:-code-server} volumes: - 'code-server-config:/config' diff --git a/code-server/.env.example b/code-server/.env.example index 2740a59..5139180 100644 --- a/code-server/.env.example +++ b/code-server/.env.example @@ -2,7 +2,7 @@ # # cp .env.example .env -# Container hostname. +# Container hostname, also passed in as HOST -- the name zsh's prompt shows. SERVICE_HOSTNAME=code-server # Web UI login password. Required. diff --git a/code-server/README.md b/code-server/README.md index f7c1ebd..651a262 100644 --- a/code-server/README.md +++ b/code-server/README.md @@ -149,7 +149,7 @@ sdk install java | --- | --- | | `PASSWORD` | Web UI login. Required. | | `GIT_NAME` / `GIT_EMAIL` | Git author and committer identity | -| `SERVICE_HOSTNAME` | Container hostname | +| `SERVICE_HOSTNAME` | Container hostname, and the name the shell prompt shows (also passed as `HOST`) | | `CODE_SERVER_APP_NAME` | Optional. Name in the title bar and welcome page; defaults to `code-server`. | Generate a password with `openssl rand -base64 24`. @@ -161,6 +161,13 @@ can only read from inside the container. The `coder` user has passwordless `sudo`, as the image sets it up. Anyone who can log in to the editor is root in the container. +`SERVICE_HOSTNAME` is used twice: as the container's `hostname:` and as the +`HOST` variable inside it. Coolify injects `HOST=0.0.0.0` into every compose +app, and zsh seeds `$HOST` and the `%m`/`%M` prompt escapes from that variable +rather than calling `gethostname()`, so a zsh prompt reads `0`. code-server +itself never reads `HOST`; it binds through `--bind-addr`. bash is unaffected; +its `\h` uses the real hostname. + ## Docker access The host's Docker socket is bind-mounted at `/var/run/docker.sock`. The image diff --git a/code-server/compose.yml b/code-server/compose.yml index 962d6a7..83ee647 100644 --- a/code-server/compose.yml +++ b/code-server/compose.yml @@ -12,6 +12,7 @@ services: - GIT_AUTHOR_EMAIL=${GIT_EMAIL} - GIT_COMMITTER_NAME=${GIT_NAME} - GIT_COMMITTER_EMAIL=${GIT_EMAIL} + - HOST=${SERVICE_HOSTNAME} # - CODE_SERVER_APP_NAME=${CODE_SERVER_APP_NAME:-code-server} volumes: - 'code-server-home:/home/coder' diff --git a/paseo/.env.example b/paseo/.env.example index 08209d5..dec5552 100644 --- a/paseo/.env.example +++ b/paseo/.env.example @@ -2,7 +2,8 @@ # # cp .env.example .env -# Container hostname, shown as the host label in the web UI. +# Container hostname, shown as the host label in the web UI. Also passed in as +# HOST -- the name zsh's prompt shows. SERVICE_HOSTNAME=paseo # Password for the daemon API and web UI. Also the paseo user's login password, diff --git a/paseo/README.md b/paseo/README.md index 079099b..87f38da 100644 --- a/paseo/README.md +++ b/paseo/README.md @@ -35,7 +35,7 @@ your own machine. | `PASEO_HOSTNAMES` | Domains allowed to reach the daemon, comma-separated. Your domain must be listed. | | `PASEO_TRUSTED_PROXIES` | Set to `uniquelocal`, or the UI loads but never connects. | | `AGENTS` | Agent CLIs to install on start if missing, space- or comma-separated. Empty installs none. See [Agents](#agents). | -| `SERVICE_HOSTNAME` | Container hostname, shown as the host label in the UI. Without it the label is a random container ID. | +| `SERVICE_HOSTNAME` | Container hostname, shown as the host label in the UI and in the shell prompt. Without it the label is a random container ID. | | `GIT_NAME` / `GIT_EMAIL` | Git author and committer identity for agents and terminals. | `PASEO_TRUSTED_PROXIES` matches the proxy's *source IP*, so hostnames are @@ -46,8 +46,14 @@ the browser blocks that as mixed content. `uniquelocal` covers the private ranges Docker uses. An exact CIDR works too, but Coolify assigns a fresh subnet per project. -`SERVICE_HOSTNAME` sets the container's `hostname:`, which is where the daemon -takes its host label from. +`SERVICE_HOSTNAME` is used twice: as the container's `hostname:`, which is +where the daemon takes its host label from, and as the `HOST` variable inside +it. Coolify injects `HOST=0.0.0.0` into every compose app, and zsh seeds `$HOST` +and the `%m`/`%M` prompt escapes from that variable rather than calling +`gethostname()` — so the prompt would read `0`, the first dot-separated field +of `0.0.0.0`. Paseo itself never reads `HOST` — it binds `PASEO_LISTEN` — so +overriding it only affects the prompt. bash is unaffected; its `\h` uses the +real hostname. `SHELL=/bin/zsh` and `TZ=Asia/Ho_Chi_Minh` are written into `compose.yml` directly rather than read from `.env`, which is why neither is in the table. diff --git a/paseo/compose.yml b/paseo/compose.yml index e432a8c..84543e7 100644 --- a/paseo/compose.yml +++ b/paseo/compose.yml @@ -14,6 +14,7 @@ services: - GIT_AUTHOR_EMAIL=${GIT_EMAIL} - GIT_COMMITTER_NAME=${GIT_NAME} - GIT_COMMITTER_EMAIL=${GIT_EMAIL} + - HOST=${SERVICE_HOSTNAME} volumes: - 'paseo-home:/home/paseo' - 'paseo-workspace:/workspace'