Roll out an HTTP service on one VPS
Run two versions of a CoAkka HTTP Runtime service on one server. Check the new version before sending it traffic, let the old version finish requests in progress, and prepare a way back if errors rise.
Prepare two versions on the same server
This example assumes the service already runs behind a reverse proxy on a VPS. The proxy keeps the public HTTPS address. Run the new version B alongside the current version A on a different private port. Configure your process supervisor to start and stop each version independently.
Users → HTTPS reverse proxy
├─ A · 127.0.0.1:8081
└─ B · 127.0.0.1:8082
Keep application ports, Monitor, and Inspect on a private network or loopback. Two processes let you replace a version. A VPS failure can make both processes unreachable.
Who owns each step?
- The proxy accepts HTTPS and chooses a version for new requests.
- CoAkka HTTP Runtime reports whether each instance admits new requests and how its drain is progressing.
- The application checks databases, permissions, and business dependencies. It also decides how users resume SSE or WebSocket sessions.
Confirm the new version is ready
- Start B with the intended connector and Core. Keep A serving while you check B.
- Check CoAkka HTTP Runtime admission and the application's own readiness conditions. If the application exposes a readiness route, configure it to report success only when both checks pass.
- Send a representative request to B and check the response. For example, open a known order using a test account.
Example readiness check on the VPS
Replace /readyz with the route your application provides and
set the new version's port. This example expects 200
and exit status 0. Keep A serving if the connection fails,
the request times out, or the response is anything other than HTTP 200.
curl --fail --silent --show-error --max-time 3 \
--output /dev/null --write-out '%{http_code}\n' \
http://127.0.0.1:8082/readyz
Move new requests and let the old version finish
- Add B to the proxy configuration. Send a request through the public HTTPS address, confirm in the per-version logs that B served it, and check the error rate.
- Remove A from the destinations for new requests using your proxy's procedure. Check the logs to verify that new requests go to B, including when the proxy reuses connections. Open long-lived connections can still be on A.
- Begin draining A so accepted requests have time to finish. Set a deadline that fits the service's processing time. Check the drain result and confirm that the service closed before the process supervisor terminates A.
What happens to open SSE and WebSocket connections?
A connection carrying SSE events or WebSocket data stays on the version that accepted it. Prepare clients to reconnect through the same HTTPS address. Let them subscribe again or resume from the last event if your application supports it. Disconnect a client in staging and watch B accept the new connection.
Run the Go lab to see drain in action
The lab holds GET /held in a handler and starts closing the
service from outside that handler. Once draining begins, the service
refuses a fresh request. Let the held handler respond, then watch it
return HTTP 200 and the close complete. Try this on a development machine
before rehearsing on a VPS with your proxy.
Respond to rollout failures
| Signal | Action |
|---|---|
| B fails readiness or returns the wrong result | Keep A serving and inspect B's dependencies and configuration. |
| More 5xx responses or higher latency after the switch | Stop moving traffic to B. Check that A is still ready and can read current data before routing back. If A has started draining or stopped, start the previous version on a free port and verify it before adding it to the proxy. |
| A reports drain expiration | Log the request IDs and close result. Check which operations may already have written data before retrying them. |
| Current data is incompatible with the previous version | Use the rehearsed data recovery plan. A proxy rollback only changes the destination for requests. |
Rehearse with the same proxy settings in staging. Record the serving version, error rates before and after the switch, the drain result, and how you confirmed that clients reconnected.