feat: surface Coder access URL in terminals via /tmp/coder-access-url - #62
Merged
Conversation
coder-redirect now caches the live *.try.coder.app tunnel URL to /tmp/coder-access-url (cleared on every service (re)start) instead of writing /etc/motd. A new environment.interactiveShellInit prints the URL on interactive shells, so a local desktop terminal shows it too, not just PAM logins. The banner only reads the file and never touches the network.
…cess (local)" Instead of clearing /tmp/coder-access-url on coder-redirect (re)start, seed it with $CODER_LOCAL so a terminal opened before the tunnel is up still shows a reachable URL. Once the tunnel URL is known the file is upgraded to "<access URL> (<local URL>)". The login banner now just prints the file, so the local URL is no longer hardcoded in two places.
Introduce a coderPort let-binding (3000) that drives CODER_HTTP_ADDRESS and every in-box URL targeting the server (coder-redirect CODER_LOCAL, agent URL, bootstrap, reset, template sync, reaper, logstream) instead of hardcoding the port at 14 sites.
…redirect Replace the two inline printf/chmod writes to /tmp/coder-access-url with a single write_accessUrl shell function; the seed and upgrade paths just call it.
phorcys420
marked this pull request as ready for review
August 24, 2026 20:21
📀 ISO build artifacts
↻ Updated for |
…rl-tmpfile # Conflicts: # README.md # configuration.nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #61.
What
Surface the live Coder access URL (
*.try.coder.apptunnel) in any terminal on login, not just PAM sessions.Previously
coder-redirect.servicewrote the URL to/etc/motd, which only shows on SSH/console logins viapam_motd— a local desktop terminal never saw it.How
coder-redirect.servicenow caches the discovered tunnel URL to/tmp/coder-access-url(chmod 0644) instead of writing/etc/motd. Itrm -fs the file at the top ofExecStart, so the stale URL is cleared on every boot and on every service restart until the live URL is rediscovered. Both the cleanup and the write are best-effort (|| true) so a/tmphiccup can't tripset -euo pipefailand restart-loop the redirect.environment.interactiveShellInitprints anAccess URL/Local/Redirectbanner by reading that file — no network access. An exportedCODER_ACCESS_URL_SHOWNguard keeps nested shells from reprinting it within a session. This covers local GNOME terminals, console TTYs, and SSH from one place.README.md,hosts/incus-vm/README.md,install.sh) to point at the terminal banner //tmp/coder-access-urlinstead of/etc/motd.The large
configuration.nixdiff is mostlynixfmtrenormalizing thecoder-redirectscript: removing the heredoc left the block uniformly indented, so the formatter re-based it to the canonical column.Verification
Ran in a workspace with the repo's own toolchain (
nix fmt= treefmt: nixfmt/statix/deadnix/shfmt/shellcheck):nix fmtidempotent (0 changed)shellcheck install.shcleannixosConfigurations._appliance-isoevaluates; builtcoder-redirectscript and renderedinteractiveShellInitinspected — escaping and|| trueguards land correctlyNot build/boot-tested on real hardware (needs a box).
Implementation notes / decisions
/etc/motdentirely rather than keeping it alongside the banner. Keeping both would double-print on SSH/console (pam_motd + shell banner); consolidating on the shell banner gives one source of truth that also works in desktop terminals. Console TTY and SSH still get the URL because their login shell sources the init.interactiveShellInitvsloginShellInit: GNOME Terminal opens a non-login interactive shell by default, sologinShellInit/profile.dwouldn't fire there.interactiveShellInitcovers it; the exported guard prevents subshell spam./proc/sys/kernel/hostname(always present) to match the previous runtimehostnamebehavior rather than bakingnetworking.hostNameat eval time./tmpwipe: relying on tmpfs-on-boot isn't guaranteed here, so the explicitrm -finExecStart(which runs on every boot and restart) is what satisfies "wipes on boot or restart of coder-redirect".🤖 Opened by Coder Agents on behalf of @phorcys420.