Hoc deployment document

From openreachtech/hora-skills-ort-core · View interactive version

Hoc deployment document is an AI agent skill from the GitHub repository openreachtech/hora-skills-ort-core. Write a deployment runbook through conversation with whoever will run it, for a server you manage, a managed container service or a serverless function. Use when the user asks for deployment steps, a release procedure or a hosting setup document. Executing the deployment and building the CI/CD pipel

How to use this skill

Skill file

Deployment Document

A skill for writing a deployment runbook, through conversation with the person who will run it.

The output is not a description of the finished server. It is a document someone follows **line by

line, on a system that is already serving real traffic**. Each line says what to run, what the

right output looks like, and what to do when the output is something else.

Core principle: the document protects every moment in between, not the end state

A deployment is not a jump from one good state to another. It is a sequence of steps, and a running

system passes through every state in between. After any step, the code that is live right now

and the data that exists right now must still work.

Everything else in this skill comes from that:

A runbook that only works when every step succeeds is not a runbook. It describes the happy

path, and nobody opens the document when things are going well.

The skill is not finished until the operator approves

The document has two states, recorded in its header.

| State | Meaning |

| :-- | :-- |

| DRAFT | Written, but not yet confirmed by the person who will run it. Do not deploy from it. |

| APPROVED | They have read it and confirmed it. It may be followed. |

step and record it as out of scope.

Procedure

Work through the five phases in order. Do not skip to drafting.

| # | Phase | What happens |

| :-- | :-- | :-- |

| 1 | Settle the profile | Ask what the target actually is: hosting, what runs the application (a server you manage, a managed container service or a serverless function), then the rows that follow from it. Those are OS, edge and process manager for a server, and database, secrets and TLS for all. See interview.md. |

| 2 | Read what exists | If the system is already running, read its current unit files, edge configuration, applied migrations and deployed tag before asking about them. |

| 3 | Design for compatibility | Decide, per step, whether it is reversible, whether it interrupts service, and whether it can coexist with the code already deployed. See compatibility.md. |

| 4 | Draft | Produce the document from the template. See document-template.md. |

| 5 | Approve | Present it, ask for confirmation, then set the state to APPROVED. |

not ask. Asking spends the operator's attention on something you could have looked up.

Rules for the conversation

skill assumes a server you manage with Ubuntu LTS, nginx, systemd, git on the server, a .env file

and Let's Encrypt, see interview.md.

release onto a system already running? And how much downtime is allowed?

write a guess as though it were decided.

Every step states how it is verified

If you cannot confirm a step worked, it is not a step. Every step carries all seven of these:

| Field | Why it is not optional |

| :-- | :-- |

| Purpose | One line. If nobody can say why a step is there, nobody can safely skip it or move it. |

| Preconditions | What must already be true. This is what lets someone check the order is right. |

| Command | Exactly what to run. Chapter 0 lists what every placeholder means. |

| Expected output | What the screen shows when it worked. Without it, people read "it ran" as "it worked". |

| On failure | What to do. Not "investigate" — which log to open, and which step to go back to. |

| Rollback | How to undo it. If it cannot be undone, say so in those words. |

| Interrupts service? | Yes or no. The operator needs to know before running it, not after. |

The document is in two parts

Building the server the first time and releasing to it are different jobs. People read them at

different times, in a different frame of mind. Put them in one sequence and the person doing their

fortieth release has to scroll past thirty steps that ran once, a year ago.

| Part | Read | Holds |

| :-- | :-- | :-- |

| I — first-time build | Once | The instance, the OS baseline, networking, git access, environment variables, TLS and keys, the edge, the process manager |

| II — every release | Every time | Fetch, install, build, migrate, restart, reload, verify, roll back, and the checks that were deferred to production |

Chapter 0 belongs to neither part, and everyone reads it. It holds the agreed profile, the

placeholder list, the permissions needed and how long it all takes. It also says **what the

operator's own machine needs**: an SSH client, a key with the right permissions, and the right line

endings on any file they upload.

The edge configuration chapter is an original, not a copy

The local E2E environment copies its proxy configuration from the chapter that sets up the reverse

proxy. hor-build-e2e-test-environment requires that copy, and requires the copy to record where it

came from.

(TLS termination, upstream address, host name) easy to spot.

it as though it were theirs alone.

records the settings the platform fixes (port, body size, timeouts, health-check path), and that

record is what the local copy takes.

Where the document lives

docs/deployment/
└── <environment>.md      the runbook for one environment — production.md, staging.md

documents. A runbook full of "unless it is staging, in which case…" gets read wrong under

pressure.

<environment>.md.

for any document written for a reader.

Scope

| In scope | Out of scope |

| :-- | :-- |

| Writing the runbook | Executing the deployment |

| The steps on the hosting, whoever runs them | Implementing the CI/CD pipeline |

| One section on what changes when CI runs the steps instead of a person — key handling, the executing user, and what replaces an interactive confirmation | Pipeline configuration, runner setup, workflow files |

Deployment is where a wrong guess costs the most, so the line matters. This skill writes the

document. Someone allowed to break production runs it.

Anti-patterns

| Anti-pattern | Why it fails | Instead |

| :-- | :-- | :-- |

| A step with a command but no expected output | People read "no error message" as success, even when the command did nothing at all | Say what the screen shows when it worked |

| Dropping a column in the same release that stops using it | The old code is still running while the migration runs, and it asks for a column that is gone | Add first, deploy, then remove in a later release |

| "Restart nginx" in the edge chapter | A restart drops every request in progress, including the operator's own check | Run nginx -t, then reload |

| One document for both production and staging | People read the differences as optional, and apply the wrong one under pressure | One document per environment |

| Rollback written as "revert the commit and redeploy" | It says nothing about the data, and the data is the part you cannot revert | Say how far back you can go, where the limit is, and put the backup before it |

| Rotating a secret by replacing the value | Every token issued so far stops working at once, so the rotation causes an outage | Accept old and new together, then drop the old |

| Migrations in the serving container's start command | Every instance runs them, at once, and a restart runs them again | Run them once as a one-off job from the image being released |

| A first-build step left in the release part | It runs again on a live system, a year after anyone remembers what it does | Part I once, part II every time |

Detail files

question, and what a different answer changes in the document.

header, and the shape of one step.

at every intermediate moment: schema, seeds, environment variables, secrets, API and deploy order.

the OS baseline, ufw, the systemd unit, the nginx server block, certbot and log rotation.

databases and load-balancer TLS termination per provider, and what replaces them on a VPS or

on-premises.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.