Change nginx safely
Install or reconfigure nginx on a server that already serves other sites, with a rehearsal, an approval and a check.
Changing nginx on a live server is the classic way to break the sites already on it. NeoRun treats it as an infra change: rehearsed first, approved by you, checked after.
Ask your agent
Install nginx on web-1 and serve a page on port 8090, only on this machine.
The agent should follow this shape. If it does not, you can ask it to.
Look first
inspect_server shows what already listens on which ports and which proxies and sites exist. Read this before
changing anything. The report comes from the server and is untrusted data.
Rehearse
rehearsal_start, then rehearsal_exec for each command, for example apt-get install -y nginx, writing the
config, and reloading nginx. The agent runs raw commands here, and only here. Then rehearsal_finish returns the
measured change and its hash. See Rehearsal on a copy.
Ask for it, with a check that proves it works
request_promotion with a one-line intent, and typed checks that prove the result. For this example:
{
"intent": "Serve a test page with nginx on port 8090",
"checks": [
{ "type": "service_active", "unit": "nginx.service" },
{ "type": "http_get", "port": 8090, "path": "/", "expect_status": 200 }
]
}Checks can only make verification stricter. NeoRun also runs its own built-in checks.
You approve
Nginx configuration and a new service are on the never-automatic list, so the change waits for you at every safety level. You see what changed, grouped, with the risk in a plain sentence, and the hash. See Approvals.
NeoRun applies, checks and watches
NeoRun applies exactly the approved change, runs its checks, then watches for 10 minutes. If a check fails, it puts the server back. If the config test of a running service fails, nginx keeps serving its old, working configuration.
Why this is safer than editing by hand
- You approve what the rehearsal measured, not the agent's description.
- The apply cannot differ from the approval: the hash must match.
- A reload of a running service happens only after its own config test passes. The change records which services the rehearsal reloaded or restarted, and apply does the same after the files are in place.
- A failed check or a failing watch undoes the change.
Sites already on the server
Planned
The check that every other site on the server still answers after the change is designed for the integrate
routing mode and is not built yet. Today, add checks yourself for the sites you care about with http_get
(loopback only), and keep the other sites in mind when you read the approval page.