我构建了 sbsh:支持发现、配置和 API 的持久化终端会话

2作者: eminwux7 个月前
为了更好地与团队分享如何访问 Kubernetes 和 Terraform 环境,并为每个环境设置清晰的提示以完全避免错误,我构建了 sbsh。 sbsh 提供了持久的终端会话,内置发现、环境配置文件和用于自动化的 API。 *问题:* - 访问多个 Kubernetes 集群和 Terraform 工作区需要复杂的配置,包括设置视觉提示以识别生产环境并避免错误 - 手动为每个环境设置环境变量和凭据 - 团队之间无法轻松、可共享地复制这些配置 - 缺乏对现有会话的结构化日志或可见性 - SSH 会话在调试或长时间任务中途死亡 *工作原理:* sbsh 将终端会话(您的 shell 和环境)与 supervisor(控制器)分离。即使 supervisor 停止或网络连接中断,终端也会继续运行。 *主要功能:* - 终端会话发现:sb get 列出所有会话,sb attach mysession 立即重新连接 - 配置文件:YAML 定义的 Kubernetes 上下文、Terraform 工作区或 Docker 容器的环境,在本地开发和 CI/CD 中完全相同 - 多重连接:多个用户可以连接到同一个实时会话 - API 访问:以编程方式控制和自动化会话 - 结构化日志:所有输入和输出都被记录下来,以便重放或分析 *用例:* - DevOps:持久的 kubectl 或 Terraform 会话 - 开发人员:通过不稳定的连接运行长时间的测试和构建;启动 Python 环境、npm 项目等 - CI/CD:在本地和管道环境中相同的配置文件 sbsh 是一个单一的 Go 二进制文件(busybox 风格),也可以用作登录 shell。它运行在 Linux、macOS 和 FreeBSD 上。 存储库:github.com/eminwux/sbsh 我已经使用它一段时间了,它彻底改变了我管理基础设施的方式。我很乐意听取反馈,并了解其他人如何使用它。
查看原文
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.<p>sbsh provides persistent terminal sessions with built-in discovery, environment profiles, and an API for automation.<p>*The problem:*<p>- Complex configuration required to access multiple Kubernetes clusters and Terraform workspaces, including setting visual prompts to identify production environments and avoid mistakes<p>- Manual setup of environment variables and credentials for each environment<p>- No easy, shareable way to reproduce those configurations across a team<p>- Lack of structured logs or visibility into existing sessions<p>- SSH sessions that die in the middle of debugging or long tasks<p>*How it works:*<p>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.<p>*Key features:*<p>- Terminal session discovery: sb get lists all sessions, sb attach mysession reconnects instantly<p>- Profiles: YAML-defined environments for Kubernetes contexts, Terraform workspaces, or Docker containers, identical in local dev and CI&#x2F;CD<p>- Multi-attach: Several users can connect to the same live session<p>- API access: Control and automate sessions programmatically<p>- Structured logs: All input and output are recorded for replay or analysis<p>*Use cases:*<p>- DevOps: Persistent kubectl or Terraform sessions<p>- Developers: Long-running tests and builds over unstable connections; launching Python environments, npm projects, and more<p>- CI&#x2F;CD: Identical profiles in local and pipeline environments<p>sbsh is a single Go binary (busybox-style) that can also be used as a login shell. It runs on Linux, macOS, and FreeBSD.<p>Repository: github.com&#x2F;eminwux&#x2F;sbsh<p>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.