hacker news Hacker News
  1. new
  2. show
  3. ask
  4. jobs

I built sbsh: Persistent terminal sessions with discovery, profiles, and an API

3 points

by eminwux

11 hours ago

4 comments

story

Needing a better way to share how to access Kubernetes and Terraform environments with my team, and to set clear prompts for each environment so that I completely avoid mistakes, I built sbsh.

sbsh provides persistent terminal sessions with built-in discovery, environment profiles, and an API for automation.

*The problem:*

- Complex configuration required to access multiple Kubernetes clusters and Terraform workspaces, including setting visual prompts to identify production environments and avoid mistakes

- Manual setup of environment variables and credentials for each environment

- No easy, shareable way to reproduce those configurations across a team

- Lack of structured logs or visibility into existing sessions

- SSH sessions that die in the middle of debugging or long tasks

*How it works:*

sbsh separates the terminal session (your shell and environment) from the supervisor (the controller). Terminals continue running even if the supervisor stops or the network connection drops.

*Key features:*

- Terminal session discovery: sb get lists all sessions, sb attach mysession reconnects instantly

- Profiles: YAML-defined environments for Kubernetes contexts, Terraform workspaces, or Docker containers, identical in local dev and CI/CD

- Multi-attach: Several users can connect to the same live session

- API access: Control and automate sessions programmatically

- Structured logs: All input and output are recorded for replay or analysis

*Use cases:*

- DevOps: Persistent kubectl or Terraform sessions

- Developers: Long-running tests and builds over unstable connections; launching Python environments, npm projects, and more

- CI/CD: Identical profiles in local and pipeline environments

sbsh is a single Go binary (busybox-style) that can also be used as a login shell. It runs on Linux, macOS, and FreeBSD.

Repository: github.com/eminwux/sbsh

I have been using it for some time now, and it completely changed how I manage infrastructure. I would love to hear feedback and see how others might use it.

loading...