# AI Made Self-Hosting Fun Again. Don't Give the Agent SSH

URL: https://www.devopsness.com/blog/ai-agents-self-hosting-gitops-guardrails
Author: Kiril Urbonas
Published: 2026-11-28
Updated: 2026-11-28
Categories: DevOps
Tags: Self-Hosting, AI Agents, GitOps, Docker Compose, DevOps

Summary: The self-hosting setups that get better with AI keep the whole server in Git. The agent edits the repo, CI deploys, and the agent never holds a shell on the box.

---
# AI Made Self-Hosting Fun Again. Don't Give the Agent SSH

AI coding agents make self-hosting cheap again, but only if the agent works on a repo, not on the server. Keep every service, config and OS definition in Git, let the agent open pull requests, and let CI deploy. Give the agent a root shell instead and you have rebuilt the fragile pet server, with a faster typist.

> [!VERIFIED]
> Basis: case-study
> Jan-Lukas Else's "AI made self-hosting fun again" (November 26, 2026) and its Hacker News thread, the Renovate docs (docker-compose manager, automerge, minimumReleaseAge) and the Docker Compose CLI reference. Checked November 2026.

## Why this post hit a nerve

Jan-Lukas Else's post reached the top of Hacker News on November 26, 2026, with more than 1,100 points and 500 comments. His point is narrow: AI "removed a lot of the friction". His home server runs NixOS, his VPS runs a Debian-based bootc image, services are Docker Compose files, Renovate opens update PRs he merges from his phone, and Forgejo and GitHub Actions deploy. He puts the bootc setup at half a day with AI, against "at least a week" without.

The detail people skimmed: everything he describes lives in Git. The agent works on files like any software project, and deployment is "a single Git push", run by CI.

## The agent's blast radius is the whole design

There are three ways people wire an agent into a homelab, and they differ in what a bad change can do.

| Setup | Credentials the agent holds | A bad change looks like | Rollback | Audit trail |
| --- | --- | --- | --- | --- |
| Agent with SSH or root on the host | Host shell, often every secret on it | Live edits to `/etc`, deleted volumes, a firewall rule that locks you out | Whatever you remember doing | Shell history, if it survived |
| Agent edits the repo, CI deploys | None, only repo write | A pull request you didn't merge | `git revert`, redeploy | Every diff, reviewed |
| Agent calls fixed wrappers (`make deploy`) | None; the wrapper holds them | A wrapper target that fails safe | Redeploy the previous commit | Diffs plus CI logs |

![Agent with SSH edits the live server with no diff, review or rollback; agent in the repo opens pull requests that make check validates and CI deploys with credentials the agent never holds, so git revert rolls back](/images/diagrams/ai-agent-repo-vs-ssh.svg)

The first row feels magical in a demo and hurts on a Sunday. A typical case: a model that reads `docker compose down -v` as harmless cleanup removes the named volumes it was told to keep. One HN commenter gave the third row in a sentence: they have the AI write Makefiles that wrap Terraform, Ansible and scripts, so it never needs SSH or credentials. If you also isolate the agent's own runtime, [sandboxing AI coding agents](/blog/docker-cloud-sandboxes-ai-agent-isolation) covers the container side.

## The repo layout that makes this work

Put the server in one repository. A typical layout:

```bash
$ tree -L 2 homelab/
homelab/
├── Makefile            # the only entry points CI and the agent may call
├── renovate.json       # update policy
├── hosts/
│   └── nas/            # NixOS config, or a bootc Containerfile
└── stacks/
    ├── immich/compose.yaml
    ├── vaultwarden/compose.yaml
    └── caddy/compose.yaml
```

The Makefile is the contract. The agent can read it and can propose changes to it, but CI is the only thing that runs `deploy` with real credentials:

```makefile
# Makefile
STACKS := $(wildcard stacks/*)

check:  ## validate every compose file, no output on success
	@for s in $(STACKS); do docker compose -f $$s/compose.yaml config -q || exit 1; done

deploy: check  ## run by CI on the server, never by the agent
	@for s in $(STACKS); do docker compose -f $$s/compose.yaml up -d --remove-orphans; done
```

`docker compose config -q` resolves variables, merges files and validates the model without printing it, so a broken edit fails in the PR, not on the server. Run `make check` as a required status check.

## Updates: let Renovate propose, let time vet

Patching was the most common complaint in the thread: self-hosting now means keeping up with a steady stream of security fixes. Renovate's docker-compose manager finds `compose.yaml` and `docker-compose.yml` files on its own and opens a PR per image bump:

```json
{
  "extends": ["config:recommended"],
  "minimumReleaseAge": "3 days",
  "packageRules": [
    { "matchUpdateTypes": ["patch", "digest"], "automerge": true },
    { "matchUpdateTypes": ["major"], "automerge": false, "labels": ["needs-human"] }
  ]
}
```

`minimumReleaseAge` holds a release back until it has been public for three days, which gives a broken or pulled release time to be noticed before it reaches your server. Renovate automerges only after the required checks pass, so `make check` gates every merge. Major versions wait for you; that is where the agent earns its keep, reading the changelog and drafting the migration in the same PR.

## What AI doesn't fix

The author says it himself: "AI-generated software isn't exempt from bugs, security issues, or technical debt." Three gaps from the thread stay open whatever the tooling:

- **Exposure.** The most repeated advice was to keep services behind a VPN (WireGuard, Tailscale or a Cloudflare Tunnel with Access). An agent that ships a new app in ten minutes also ships a new attack surface in ten minutes. Make "not on a public port" a rule in the repo's agent instructions.
- **Flaky runs.** One commenter found agent-written Ansible often succeeds only on the second or third try. Idempotent, declarative config (Compose, NixOS, bootc) plus a validation step beats imperative scripts here.
- **Skill atrophy.** If you can't explain a diff, don't merge it. Responsibility for the change stays with the person who clicks merge, and the general rules for [securing AI agents](/blog/ai-agent-security) still apply.

## Questions people ask

### Is it safe to give an AI agent root on my home server?

It works until the first destructive misread, and then there is no diff to revert. Keep the agent on the repository: it opens pull requests, CI applies them with credentials the agent never sees, and every change is reviewable and revertable. Give it read-only logs for debugging.

### How do I auto-update self-hosted Docker containers safely?

Pin image tags in Compose, let Renovate open update PRs, require a validation check such as `docker compose config -q`, and automerge only patch and digest bumps after a few days of release age. Keep major versions manual. That replaces Watchtower-style live updates with changes you can see and revert.

## The decision, concretely

- **Agent wants to change a service?** Through a PR on the repo, never a live edit on the host.
- **Agent needs credentials to deploy?** No. CI holds them and calls a fixed `make deploy`.
- **Routine image updates?** Renovate with `minimumReleaseAge` and patch-only automerge.
- **Something needs a public port?** A human decides, in review, with the tunnel or VPN alternative written down.

## The call we'd make

Let the agent write everything and run nothing. Put the server in Git, give the agent repo access and a Makefile it can't bypass, and let CI deploy. You keep the speed and lose the failure mode where nobody knows what changed. The caveat: this needs declarative config. If your stack is hand-edited files on a box, the first job for the agent is moving it into a repo.

## Sources

- [Jan-Lukas Else, "AI made self-hosting fun again"](https://janlukas.blog/posts/ai-self-hosting)
- [Hacker News discussion of the post](https://news.ycombinator.com/item?id=50660180)
- [Renovate docs: automerge](https://docs.renovatebot.com/key-concepts/automerge/)
- [Docker docs: docker compose config](https://docs.docker.com/reference/cli/docker/compose/config/)

