我构建了 sbsh:具有发现功能、配置文件和 API 的持久终端会话。

2作者: eminwux大约 18 小时前原帖
为了更好地与我的团队分享如何访问Kubernetes和Terraform环境,并为每个环境设置明确的提示以避免错误,我开发了sbsh。 sbsh提供了持久的终端会话,内置发现功能、环境配置文件以及用于自动化的API。 **问题:** - 访问多个Kubernetes集群和Terraform工作区所需的复杂配置,包括设置可视化提示以识别生产环境并避免错误 - 每个环境的环境变量和凭证的手动设置 - 没有简单、可共享的方式在团队中重现这些配置 - 缺乏结构化日志或对现有会话的可见性 - 在调试或长时间任务中SSH会话意外中断 **工作原理:** sbsh将终端会话(你的shell和环境)与管理程序(控制器)分开。即使管理程序停止或网络连接中断,终端仍会继续运行。 **关键特性:** - 终端会话发现:`sb get` 列出所有会话,`sb attach mysession` 可立即重新连接 - 配置文件:为Kubernetes上下文、Terraform工作区或Docker容器定义的YAML环境,在本地开发和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.