diff --git a/code-server/.env.example b/code-server/.env.example index 87e38c4..27f8390 100644 --- a/code-server/.env.example +++ b/code-server/.env.example @@ -10,6 +10,6 @@ PASSWORD= GIT_NAME= GIT_EMAIL= -# Container hostname, shown in the shell prompt. +# Container hostname, also passed in as HOST -- the name zsh's prompt shows. # Not named HOSTNAME: the deploying shell's own HOSTNAME would override it. SERVICE_HOSTNAME=code-server diff --git a/code-server/README.md b/code-server/README.md index bc50818..1c1e0e6 100644 --- a/code-server/README.md +++ b/code-server/README.md @@ -98,7 +98,7 @@ new binary overwrites the old one. | --- | --- | | `PASSWORD` | Web UI login. Required. | | `GIT_NAME` / `GIT_EMAIL` | Git author and committer identity | -| `SERVICE_HOSTNAME` | Container hostname, and the name the shell prompt shows | +| `SERVICE_HOSTNAME` | Container hostname, and the name the shell prompt shows (also passed as `HOST`) | Generate a password with `openssl rand -base64 24`. @@ -109,6 +109,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 62ccbe1..cc44bf3 100644 --- a/code-server/compose.yml +++ b/code-server/compose.yml @@ -11,6 +11,7 @@ services: - GIT_AUTHOR_EMAIL=${GIT_EMAIL} - GIT_COMMITTER_NAME=${GIT_NAME} - GIT_COMMITTER_EMAIL=${GIT_EMAIL} + - HOST=${SERVICE_HOSTNAME} volumes: - 'code-server-home:/home/coder' - 'code-server-workspace:/workspace'