fix: restore HOST override in zsh workspace services

Coolify injects HOST=0.0.0.0 and zsh's prompt reads $HOST instead of the
real hostname, so hostname: alone shows user@0. Set HOST=${SERVICE_HOSTNAME}
again in code-server, code-server-lsio and paseo.
This commit is contained in:
tiennm99 committed 2026-10-06 16:45:13 +07:00
1 parent 56111e9219
commit fc85962f45
10 files changed
+34 -9

No files matched your search

+1 -1
View File
@@ -151,7 +151,7 @@ collapse and the existing grouping stands.
`.env.example` follows its compose file's order. The names differ — one `.env.example` follows its compose file's order. The names differ — one
`PASSWORD` can feed several container variables, and `SERVICE_HOSTNAME` feeds `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. Reordering a compose file means reordering the `.env.example` with it.
## Deployment target ## Deployment target
+1 -1
View File
@@ -2,7 +2,7 @@
# #
# cp .env.example .env # cp .env.example .env
# Container hostname. # Container hostname, also passed in as HOST -- the name zsh's prompt shows.
SERVICE_HOSTNAME=code-server-lsio SERVICE_HOSTNAME=code-server-lsio
# Web UI login password. Required. # Web UI login password. Required.
+9 -1
View File
@@ -32,7 +32,7 @@ separate rootless daemon.
| Variable | Purpose | | 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. | | `PASSWORD` | Web UI login, also the in-container sudo password. Required. |
| `GIT_NAME` / `GIT_EMAIL` | Git author and committer identity | | `GIT_NAME` / `GIT_EMAIL` | Git author and committer identity |
| `PWA_APPNAME` | Optional. Name of the installed web app; defaults to `code-server`. | | `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 itself would start anyway and serve code-server with no authentication, on a
container that holds the Docker socket. 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 `PUID`/`PGID` are pinned to `1000` in `compose.yml`; the `Dockerfile` depends
on that (see [Storage](#storage)). on that (see [Storage](#storage)).
+1
View File
@@ -17,6 +17,7 @@ services:
- GIT_AUTHOR_EMAIL=${GIT_EMAIL} - GIT_AUTHOR_EMAIL=${GIT_EMAIL}
- GIT_COMMITTER_NAME=${GIT_NAME} - GIT_COMMITTER_NAME=${GIT_NAME}
- GIT_COMMITTER_EMAIL=${GIT_EMAIL} - GIT_COMMITTER_EMAIL=${GIT_EMAIL}
- HOST=${SERVICE_HOSTNAME}
# - PWA_APPNAME=${PWA_APPNAME:-code-server} # - PWA_APPNAME=${PWA_APPNAME:-code-server}
volumes: volumes:
- 'code-server-config:/config' - 'code-server-config:/config'
+1 -1
View File
@@ -2,7 +2,7 @@
# #
# cp .env.example .env # cp .env.example .env
# Container hostname. # Container hostname, also passed in as HOST -- the name zsh's prompt shows.
SERVICE_HOSTNAME=code-server SERVICE_HOSTNAME=code-server
# Web UI login password. Required. # Web UI login password. Required.
+8 -1
View File
@@ -149,7 +149,7 @@ sdk install java
| --- | --- | | --- | --- |
| `PASSWORD` | Web UI login. Required. | | `PASSWORD` | Web UI login. Required. |
| `GIT_NAME` / `GIT_EMAIL` | Git author and committer identity | | `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`. | | `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`. 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 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. 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 ## Docker access
The host's Docker socket is bind-mounted at `/var/run/docker.sock`. The image The host's Docker socket is bind-mounted at `/var/run/docker.sock`. The image
+1
View File
@@ -12,6 +12,7 @@ services:
- GIT_AUTHOR_EMAIL=${GIT_EMAIL} - GIT_AUTHOR_EMAIL=${GIT_EMAIL}
- GIT_COMMITTER_NAME=${GIT_NAME} - GIT_COMMITTER_NAME=${GIT_NAME}
- GIT_COMMITTER_EMAIL=${GIT_EMAIL} - GIT_COMMITTER_EMAIL=${GIT_EMAIL}
- HOST=${SERVICE_HOSTNAME}
# - CODE_SERVER_APP_NAME=${CODE_SERVER_APP_NAME:-code-server} # - CODE_SERVER_APP_NAME=${CODE_SERVER_APP_NAME:-code-server}
volumes: volumes:
- 'code-server-home:/home/coder' - 'code-server-home:/home/coder'
+2 -1
View File
@@ -2,7 +2,8 @@
# #
# cp .env.example .env # 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 SERVICE_HOSTNAME=paseo
# Password for the daemon API and web UI. Also the paseo user's login password, # Password for the daemon API and web UI. Also the paseo user's login password,
+9 -3
View File
@@ -35,7 +35,7 @@ your own machine.
| `PASEO_HOSTNAMES` | Domains allowed to reach the daemon, comma-separated. Your domain must be listed. | | `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. | | `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). | | `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. | | `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 `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 ranges Docker uses. An exact CIDR works too, but Coolify assigns a fresh subnet
per project. per project.
`SERVICE_HOSTNAME` sets the container's `hostname:`, which is where the daemon `SERVICE_HOSTNAME` is used twice: as the container's `hostname:`, which is
takes its host label from. 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` `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. directly rather than read from `.env`, which is why neither is in the table.
+1
View File
@@ -14,6 +14,7 @@ services:
- GIT_AUTHOR_EMAIL=${GIT_EMAIL} - GIT_AUTHOR_EMAIL=${GIT_EMAIL}
- GIT_COMMITTER_NAME=${GIT_NAME} - GIT_COMMITTER_NAME=${GIT_NAME}
- GIT_COMMITTER_EMAIL=${GIT_EMAIL} - GIT_COMMITTER_EMAIL=${GIT_EMAIL}
- HOST=${SERVICE_HOSTNAME}
volumes: volumes:
- 'paseo-home:/home/paseo' - 'paseo-home:/home/paseo'
- 'paseo-workspace:/workspace' - 'paseo-workspace:/workspace'