我的家庭实验室 AI 开发平台
My Homelab AI Dev Platform

原始链接: https://rsgm.dev/post/ai-dev-platform/

作者通过将 **OpenCode**(一种与供应商无关的 AI 编程环境)与 **GitOps** 工作流程集成,简化了家庭实验室的管理。作者将 OpenCode 部署在专用虚拟机上,从而创建了一个可从任何设备访问的安全且持久的开发环境。 该工作流程利用 AI 处理日常任务,例如查看容器发布说明、执行更新以及添加健康检查。一旦 OpenCode 生成更改,它会将代码推送到功能分支;作者随后审核并合并合并请求(PR),从而通过 Arcane 等工具触发自动部署。这种职责分离确保了 AI 无法直接访问生产服务,在保持“爆炸半径”可控的同时,让作者能够轻松管理复杂的 Docker 堆栈和配置,甚至可以通过移动设备进行操作。 尽管目前的设置由于 Forgejo API 的限制而缺少自动 CI 反馈,但该系统显著减少了手动维护时间。通过将基于 Git 的基础设施与 AI 辅助编程相结合,作者构建了一个便携、安全且高效的家庭服务管理平台。

近期一篇名为《我的家庭实验室 AI 开发平台》的 Hacker News 文章迅速走红,引发了关于本地 AI 开发实用性的讨论。 尽管读者最初期待看到关于本地 GPU 基础设施的技术深度解析,但作者澄清说,他们的项目重点在于 AI 驱动的开发工作流,而非硬件优化。作者指出,他们目前使用外部服务进行推理,因为本地模型在处理复杂的“智能体”工具调用工作流时,尚不具备足够的性价比或能力。关于平台安全性,作者解释称,他们在合并代码前会手动审查所有 AI 生成的拉取请求(Pull Request),以确保必要的人工检查。 这次交流凸显了开发者社区当前的矛盾:对稳健的本地 AI 基础设施有高需求,但现有开源模型却存在局限性。作者表示有兴趣在未来的文章中详述其具体的家庭实验室硬件,并提到其网站因“HN 拥抱效应”(即短时间内流量激增)而访问量陡增。
相关文章

原文

I set up OpenCode Web UI with Git access to make my homelab easier to manage. OpenCode pushes to Git, I approve the PRs, GitOps deploys the changes. Best of all, OpenCode runs as a server with persistent coding sessions synced across devices.

I’ll share my homelab setup soon. There are about a dozen docker compose stacks for the services that I manage. I recently moved them to Arcane so I can manage/deploy them with GitOps. The next logical step was using AI tooling to help maintain my services.

The first use that came to mind was using AI to help with container updates. Previously, I would spend time looking up the release notes for each of the services, checking for any breaking changes, running the updates, and manually checking each of the services for issues. I would spend a few hours on this. Now I can read a summary of the release notes in a few minutes, making version upgrades easier and safer. On top of that, I’ve used AI to add healthchecks to most of the containers to make it faster to spot issues.

OpenCode

I mainly used Claude Code, but AI providers have been really squeezing the value out of customers recently through token limits, so I took the opportunity to look into other options. I wanted something that was vendor agnostic and supported by the major plugins. I ended on OpenCode. There are probably other decent coding environments, but this was my favorite of the ones I tried.

Then I found it ships with a built in webserver and web UI, which gave me an idea.

AI Dev Platform

OpenCode Platform

I set up a simple VM on the Truenas host with basic dev tooling and added OpenCode webserver as a systemd unit. It’s a solid environment with a built in terminal, file browser, and git diffs, as well as git worktree support for managing multiple coding sessions at the same time. Plus, OpenCode had the best the question/answer popups in the mobile web UI that I’ve seen.

I gave OpenCode its own user on my Git server with dedicated SSH keys. It can clone projects and push branches, but it cannot push straight to the deploy branch.

My workflow keeps the AI behind PR review. OpenCode writes the change and I merge it myself in a PR. I think it’s cute, but more importantly, it keeps unreviewed code from getting deployed.

The VM has internet access and access to my Git server, but it cannot reach my actual services. Because the blast radius is small, I am comfortable giving OpenCode root on the VM when it needs to install build tools or test dependencies.

I could see building this into a production developer platform. Ephemeral containers available to developers with preinstalled tooling, access guardrails, and audit logs. But for me, it does what I need it to without too many moving parts.

Workflow

AI PR 2

My basic workflow is:

  1. Plan out a feature or improvement in OpenCode (spec, implementation plan, and self-reviews)
  2. I’ll test or verify changes if possible
  3. Iterate with OpenCode on things I don’t like
  4. OpenCode pushes changes to a feature branch
  5. I’ll open a PR for this branch
  6. I’ll merge the PR once I’m happy
  7. GitOps takes over from there - Arcane for docker service changes, GitOps plugin for Home Assistant config changes, Cloudflare Pages worker for blog changes

I migrated my services from Truenas to Arcane GitOps projects. This was mainly to have git-backed storage for all the docker compose stacks I was running in Truenas previously. I was surprised how well this worked in conjunction with adding OpenCode. Being able to update the networking across all containers, for example, from my phone makes the sprawl much easier to manage. Before it would take hours to comb through all of the compose stacks, tracing out network connectivity. Now I can point OpenCode at the codebase with a goal, check the resulting PR changes, and merge.

The main missing piece is CI feedback. On GitHub, I like pointing a coding agent at Actions logs so it can diagnose failing tests, linter errors, stack traces, and IaC plan changes. This helps maintain a fast feedback loop for changes that unit tests don’t cover.

Forgejo makes that harder. Forgejo Actions does not expose job logs through the public API. There are undocumented APIs, but I would rather not build around those.

This setup lets me make home infra changes from any device without giving AI direct access to the services it’s changing. I can start a change from my computer, review the PR from my phone, and let GitOps handle the deploy.

AI PR 3

联系我们 contact @ memedata.com