AI让自我托管重获乐趣:工程实践与自动化复盘
AI made self-hosting fun again
AI made self-hosting fun again
AI 让自建服务再次变得有趣
2026-11-26 · ✍️ Posts · AI · Selfhosting · Thoughts
2026-11-26 · ✍️ 文章 · AI · 自建服务 · 思考
Short link: https://b.jlel.se/s/8fb
短链接: https://b.jlel.se/s/8fb
Share online
在线分享
Share this post×
分享此文章×
Use your browser's share dialogCopy share text
使用浏览器的分享对话框复制分享文本
I’ve been self-hosting things for many years. There were times when I was quite enthusiastic about it, constantly trying out new software and tinkering with my infrastructure. But at some point, that enthusiasm faded a bit.
多年来我一直从事自建服务(self-hosting)。曾经有一段时间我对它充满热情,不断尝试新软件并摆弄我的基础设施。但到了某个阶段,那种热情逐渐消退了一些。
I never really stopped self-hosting, but I became less inclined to experiment with new things. Maintaining what I already had running was enough for me.
我从未真正停止过自建服务,但我对尝试新事物的倾向减少了。维持现有运行的服务对我来说已经足够了。
Over the last few months, however, I’ve found myself getting increasingly excited about self-hosting again. And, somewhat ironically, AI is a big reason for that.
然而在过去几个月里,我发现自己重新对自建服务感到越来越兴奋。颇具讽刺意味的是,AI 是其中的一个重要原因。
Less friction
更少的摩擦
Most of my infrastructure configuration lives in Git repositories, mainly in the form of Docker Compose files, scripts, and other configuration files. This makes it possible to use AI coding agents to work on my infrastructure in much the same way as they would work on any other software project.
我的大部分基础设施配置都保存在 Git 仓库中,主要以 Docker Compose 文件、脚本和其他配置文件的形式存在。这使得我能够像对待任何其他软件项目一样,利用 AI 编码代理来操作我的基础设施。
Whenever I want to try a new service, adjust an existing configuration, or automate something, I can now do so with considerably less effort.
现在,每当我想要尝试一项新服务、调整现有配置或自动化某些任务时,我都可以用少得多的精力来完成。
In the past, I would sometimes put off certain changes simply because I didn’t feel like spending an evening reading changelogs and documentation or troubleshooting issues. It’s not that I couldn’t have done these things before. But often, the amount of effort required just wasn’t worth it to me.
过去,有时我会推迟某些更改,仅仅是因为我不想花一个晚上去阅读变更日志和文档,或者排查问题。这并不是说我以前做不到这些。但往往,所需付出的努力在我看来并不值得。
Now, even relatively spontaneous ideas often end up becoming reality.
现在,即使是相对自发的想法也常常最终成为现实。
Trying things I always found interesting
尝试那些我一直感兴趣的事物
There are also technologies that I’ve always found interesting but never felt knowledgeable enough about to really make use of them.
还有一些技术,我一直觉得很有趣,但从未觉得自己足够了解以真正利用它们。
NixOS is a good example. I’ve always liked the idea of declaratively configuring an entire system; I even used it on my laptop during my Linux honeymoon phase. But getting everything configured the way I wanted was quite a hurdle. With the help of AI, I’m now making much more extensive use of NixOS on my home server.
NixOS 就是一个很好的例子。我一直喜欢声明式配置整个系统的理念;在我的 Linux 蜜月期,我甚至在我的笔记本电脑上使用过它。但要按照我想要的方式配置一切相当困难。在 AI 的帮助下,我现在在家用服务器上更广泛地使用 NixOS。
For my VPS infrastructure, I’ve also started building my own Debian-based bootc image (after thinking about it for some time).
对于我的 VPS 基础设施,我也开始构建自己的基于 Debian 的 bootc 镜像(经过一段时间的思考后)。
Having my entire operating system configuration defined in a Git repository and automatically building a bootable container image from it is something I find really cool. But it’s also something I probably wouldn’t have invested enough time in to get working on my own before. Even with the help of AI, it still took me half a day when I set it up a few months ago. Without AI, it would probably have taken me at least a week.
将我的整个操作系统配置定义在 Git 仓库中,并从中自动构建可启动的容器镜像,这对我来说非常酷。但在此之前,我可能不会投入足够的时间去让它在我的环境中运行起来。即使有 AI 的帮助,几个月前我搭建它时也花了半天时间。如果没有 AI,我可能至少需要一周时间。
AI makes experimenting with unfamiliar technologies much more approachable. I don’t necessarily need to understand every little detail before I can get started. I can learn about things along the way, ask questions, and gradually improve my configurations.
AI 让尝试不熟悉的技术变得更加容易上手。我不一定需要在开始之前理解每一个细节。我可以边做边学,提出问题,并逐步改进我的配置。
Automating almost everything
自动化几乎一切
Something I’ve also finally managed to do is automate most of the build, update, and deployment processes for my infrastructure.
我还终于做到的一件事是,自动化了我基础设施的大多数构建、更新和部署流程。
A lot of the work involved in self-hosting isn’t particularly exciting. Keeping track of new releases, updating container image tags, building images, and deploying configuration changes are all things that need to be done regularly.
自托管工作中有很多部分并不特别令人兴奋。跟踪新版本、更新容器镜像标签、构建镜像以及部署配置更改,都是需要定期完成的任务。
I still remember what updating a service used to look like: bumping the version and adjusting the Docker Compose file on my laptop, pushing the changes to the Git remote, SSHing into the server, pulling the changes, and finally deploying them. Now, a single Git push is enough. If a push is even necessary.
我仍然记得以前更新服务是什么样子的:在笔记本电脑上提升版本号并调整 Docker Compose 文件,将更改推送到 Git 远程仓库,SSH 登录到服务器,拉取更改,最后进行部署。现在,只需一次 Git push 就足够了。甚至可能连 push 都不需要。
With Renovate, I no longer need to actively keep track of most software updates. It creates pull requests for me, and often, all I need to do is review and merge them. I can even do that on my phone while sitting on the sofa.
有了 Renovate,我不再需要主动跟踪大多数软件更新。它会为我创建拉取请求(Pull Request),通常我只需要审查并合并它们。我甚至可以坐在沙发上用手机完成这些操作。
Pushing changes or merging a pull request triggers the corresponding GitHub Actions or Forgejo Actions workflows, which take care of building and deploying everything.
推送更改或合并拉取请求会触发相应的 GitHub Actions 或 Forgejo Actions 工作流,由它们负责构建和部署所有内容。
Of course, there’s nothing particularly groundbreaking about any of this. DevOps has been around for a long time, and none of these automation tools require AI. But AI has helped me put all these pieces together in a way that I previously never quite got around to doing.
当然,这一切都没有什么特别突破性的。DevOps 已经存在很长时间了,这些自动化工具都不需要 AI。但 AI 帮助我将所有这些组件整合在一起,而以前我从未真正抽出时间去做这件事。
And the nice thing about automating these tasks is that the benefits extend well beyond the initial setup. I now have less tedious work to do every time I want to change something or update a service.
自动化这些任务的好处在于,其收益远远超出了初始设置阶段。现在,每次我想更改内容或更新服务时,我需要做的繁琐工作都减少了。
Back to more powerful hardware
回归更强大的硬件
As I’ve started hosting more things again, I’ve also moved more of my services from my VPS to my home server.
随着我开始重新托管更多服务,我也将更多的服务从我的 VPS 迁移到了家庭服务器。
For a while, I was using an HP t640 thin client as my home server. However, with more things I wanted to run, I decided to switch back to my ASRock DeskMini A300, which had been sitting unused for some time. I’m thinking about repurposing the t640 as a “router on a stick”, though.
有一段时间,我使用 HP t640 瘦客户机作为我的家庭服务器。然而,随着我想运行的服务越来越多,我决定换回闲置已久的 ASRock DeskMini A300。不过,我在考虑将 t640 重新用作“单臂路由器”(router on a stick)。
I even took the opportunity to upgrade its CPU from an AMD Ryzen 5 2400G to a Ryzen 5 PRO 4650G and replaced the stock AMD cooler with a quieter Noctua cooler. Noise was the main reason I switched to the t640 in the first place.
我还趁机将其 CPU 从 AMD Ryzen 5 2400G 升级到了 Ryzen 5 PRO 4650G,并将原装的 AMD 散热器替换为更安静的 Noctua 散热器。噪音是我最初转向 t640 的主要原因。
It’s nice to put some hardware I already owned back to use rather than buying an entirely new machine. I also managed to get both the CPU and the cooler for a good price through a classifieds site.
能够重新利用手头已有的硬件,而不是购买全新机器,感觉很不错。此外,我还通过分类信息网站以优惠的价格搞定了 CPU 和散热器。
Having some additional computing power available gives me more room to experiment. And there’s something quite satisfying about having a small box at home running a growing collection of services that I use in my everyday life.
拥有额外的计算能力让我有了更多的实验空间。而且,在家里有一个小盒子运行着我日常生活中使用的、不断增多的服务,这种感觉相当令人满足。
Building my own tools
构建自己的工具
But it’s not just about self-hosting existing software. AI has also changed how I approach problems for which there isn’t an existing piece of software that does exactly what I want.
但问题不仅仅在于自托管现有软件。AI 也改变了我处理那些没有现成软件能完全满足需求的问题的方式。
Previously, I would often spend quite some time searching for a suitable open-source project, comparing different alternatives, and figuring out how to make one of them work for my particular use case.
以前,我经常需要花大量时间寻找合适的开源项目,比较不同的替代方案,并研究如何让其中一个适用于我的特定用例。
These days, for smaller problems, building my own solution has become a much more attractive option.
如今,对于较小的问题,构建自己的解决方案变成了一个更具吸引力的选择。
I’ve recently built tools to automatically download invoices, e-papers or Linux ISOs.
我最近构建了自动下载发票、电子报纸或 Linux ISO 镜像的工具。
I can build (or have AI build) these tools in Go, my preferred programming language, and tailor them to my exact needs.
我可以使用我最喜欢的编程语言 Go 来构建(或让 AI 构建)这些工具,并根据我的确切需求进行定制。
They don’t need to support every possible use case, have an elaborate user interface, or be particularly interesting to anyone other than me. I don’t need to turn every little tool into a proper open-source project with extensive documentation and support for other people’s use cases. They just need to solve my problem.
它们不需要支持所有可能的用例,不需要精美的用户界面,也不需要对我之外的人有任何吸引力。我不需要把每个小工具都变成一个带有详尽文档和支持他人用例的正式开源项目。它们只需要解决我的问题即可。
What I particularly enjoy is how well this complements my increasingly automated infrastructure. Building a small tool has become easier, and so has building a container image for it, deploying it, and keeping it running.
我特别享受的是,这与我的日益自动化的基础设施完美互补。构建一个小工具变得更容易了,为其构建容器镜像、部署它并保持其运行也变得更容易了。
The entire process, from having an idea to having something actually running on my home server, requires much less effort than it used to.
整个过程,从产生想法到在我的家庭服务器上实际运行起来,所需的精力比过去少得多。
Just because I can doesn’t mean I should
能做并不意味着应该做
Of course, there are downsides to all of this.
当然,这一切也有不利的一面。
Every additional service is another thing that needs to be maintained. AI-generated software isn’t exempt from bugs, security issues, or technical debt. And having an AI agent make changes to my infrastructure doesn’t absolve me of the responsibility of understanding those changes.
每增加一项服务,就意味着又多了一项需要维护的内容。AI 生成的软件并不能免于出现 bug、安全问题或技术债务。而且,让 AI 代理对我的基础设施进行修改,并不能免除我理解这些变更的责任。
There’s also the temptation to build or deploy things simply because I can. When implementing an idea becomes so easy, it’s perhaps more important than ever to occasionally ask myself whether it’s actually worth implementing in the first place.
此外,还存在一种诱惑,即仅仅因为我能做到就构建或部署某些东西。当实现一个想法变得如此容易时,或许比以往任何时候都更需要偶尔问自己:这个想法是否真的值得去实现。
On the other hand, self-hosting is a hobby for me. Not everything I do needs to be economically sensible or particularly useful. Sometimes, experimenting with something new is the whole point.
另一方面,自托管对我来说是一种爱好。我所做的每一件事都不一定需要符合经济理性或具有特别大的实用性。有时,尝试新事物本身就是目的所在。
And with much of the routine maintenance automated, adding another service doesn’t necessarily mean adding as much recurring work as it used to.
随着大部分例行维护工作实现了自动化,增加另一项服务并不一定意味着像过去那样增加同样多的重复性工作。
A somewhat ironic development?
这算是一种颇具讽刺意味的发展吗?
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力