The deployment was simple, but operating it was not
If you still deploy to long-lived servers over SSH and want each release safer without a new platform, this is for you. It starts with the system Audience Republic already had: 17 long-lived production hosts, with no Terraform plan or disposable infrastructure between us and them.
I made that old-school Java deployment reasonable by putting an AI operator on top of it. We connected over SSH, applied PostgreSQL migrations, pulled JARs from S3, changed symlinks, restarted systemd services and watched the result.
Rather than asking the AI to pretend this was a modern platform, I taught it how the platform actually worked, including the parts that could hurt us. The basic operation was still one command:
ssh "$host" "~/bin/deploy.sh 16.4"None of that is fashionable, but it is wonderfully legible. You can SSH to a box, inspect the symlink, ask systemd whether the service is active and curl its health endpoint without passing through seven control planes on the way to the process.
Old deployment systems are awkward to talk about because the expected ending is a replatforming. Mention SSH and someone will ask why it is not Kubernetes. Mention JARs and the proposed fix quickly becomes a new delivery platform, even when the immediate problem is the risk around each release.
That was not the useful move here because the mechanics were simple and well understood. The expensive part was the operational judgement wrapped around them, and rebuilding all of it would have been a large project, while making the next deployment safer was a problem we had today.
Wrap the deploy you have instead of replacing it
Kubernetes would have shifted the work, not removed it. I knew from experience what the alternative cost. With a small team, managing a Kubernetes cluster is not an abstraction you buy once, because it quickly becomes another production system in its own right.
An AI safety layer addressed that risk without giving the team another platform to babysit. Before you replatform, check whether your risk is in the mechanics or in the sequence and memory around them.
Give the agent typed actions, never a shell
One early version exposed a general remote-command method that accepted a host and an arbitrary command string. That is convenient until a version tag becomes part of the command and the remote shell interprets it.
# Too much authority in one interface
transport.run_command(host, command)The replacement exposed typed actions instead, validating hosts, services and version tags at the boundary, quoting remote values and running local subprocesses without a shell.
runner.run_deploy_script(
host=host,
version_tag=version,
)That boundary matters more when an AI is driving, because the model can choose a deployment action but it cannot invent a new remote shell action that the interface does not provide. So give your own agent the list of actions you are willing to run, and no shell.
Gate every host, and stop on a missing check
A production restart could interrupt a CSV import or an outbound message send by removing the JVM while work was in flight. A message that reached RabbitMQ’s dead-letter queue could be replayed manually, but often it simply disappeared with no delivery callback and no automatic retry.
So the deployment agent checks database health and counts active imports and sends before a rollout. It repeats those gates between hosts, because production state can change while a 17-host deployment is running.
The gate code preserves an important distinction between blocked and broken:
if error_results:
can_deploy = False
elif blocked_results and not force:
can_deploy = FalseA gate that can’t run is not a pass. Treat a missing check as a stop, and keep the override for conditions a person has looked at.
Deploy one host, prove it, then the next
The deployment tool had no production --single-host flag. The canary mechanism was more direct: temporarily narrow the YAML inventory to one host.
production:
campaign:
- worker-1 # canaryThe agent deploys that host, waits for the result and verifies it before restoring a larger wave. Customer-facing hosts, HA pairs and the message senders still move one at a time.
A completed command on its own was never enough. After the restart, the next host does not become eligible until this evidence is present.
The rollout gets one live message
The agent also needed a readable operational surface, so it kept one rolling message in the deployment channel and edited that message as the fleet changed.

Every host had a line, and completed hosts gained a Sydney timestamp. The current host had a spinner that changed every 15 seconds, which mattered when one restart sat there for more than two minutes. Canary, HA, load-balanced and message-sender hosts carried their own annotations.
The progress bar was only 20 characters wide, but it showed enough to tell what had deployed, what was moving and what had not been touched. That small interface changed the character of the system: although the deployment was still SSH and JARs underneath, it now behaved like an observable rollout rather than a sequence of private terminal commands.
If your rollouts happen in terminals nobody else sees, do the same: keep one message in the deployment channel and edit it as each host changes.
Roll back the JAR, never the database
Rolling a JAR back is straightforward once the operator chooses the exact previous version. The agent deploys it through the same one-host sequence and verifies the symlink and health checks again.
Rolling a database backwards carries a different class of risk, because a down migration can drop data, change constraints or leave stored procedures in a state the old application does not understand.
So roll back JARs only, leave the schema where it is, and have a person confirm the exact previous version.
How far to trust it
Sylvain Kalache recently wrote about AI incident tools creating comprehension debt. When software handles every routine incident, engineers lose the repetitions that taught them how their systems behave. They return only for the rare failure the AI could not solve.
I think that risk is real, and this agent only helps if it keeps its reasoning visible. The operator still chooses the rollout shape and confirms an exact rollback target.
The agent can preserve the incident memory, but we still need to exercise our own.
What to copy
Here are the checks above as one list you can hand to your own deploy agent.
Before every host
- Check database health and count active imports and sends.
- If a check errors, stop. Do not use --force, because the check never ran.
- If a known condition blocks the deploy, an operator investigates first.
- Message senders deploy alone, never bypass an active send, and must be
reattached to RabbitMQ before the next host starts.
Deploy
- Start with one canary host.
- Let in-flight work drain before the restart (mine waits 120 seconds).
Verify before the next host
- The JAR symlink points at the expected commit.
- systemd reports the service as active.
- /system/status returns {"ok":true}.
- The application's file log shows no new errors.
- On queue workers, consumers are back.
Rollback
- Roll back JARs only, through the same one-host sequence.
- Leave the database forward-migrated.
- Ask a human before rolling back past a dropped column, a new required
field or a changed stored procedure.How it works
The agent did not replace the deployment. It made explicit a sequence that had previously lived across scripts, documentation, production incidents and the operator’s memory.
- 01Migrateschema first
- 02Gateproduction clear
- 03Canaryone host
- 04Verifyhealth + logs
- 05Expandone wave
- 06Report17 hosts
What changed was the way we operated it. We kept a deployment architecture that everybody could inspect rather than adding Terraform or moving the fleet to Kubernetes, then put a more disciplined operator over it.
That is the retro appeal for me: the machinery remains boring and direct, while the AI adds the memory, refusal and visibility that made operating it reasonable.
You do not have to replace a system before AI can improve it, but you do have to teach the AI how the existing system really works and exactly when it should stop.