DEV Community

Cover image for Migrating GPU broker from compose to Octopus Deploy
dragonhound
dragonhound

Posted on Edited on Originally published at dragonhound.dev AI-assisted

Migrating GPU broker from compose to Octopus Deploy

I stubbed my toe early on this one. The first release I pushed through Octopus Deploy failed in Staging after 24 seconds. The deploy scripts had arrived on the target without their execute bits, so the first step could not run. Production kept running the old release, and the fix was one line in the deployment process: call the scripts through bash.

That failure is the best evidence for the move. argus-iris, the GPU broker for my Argus suite, now deploys through Octopus Deploy instead of me running docker compose by hand on each of my three GPU worker servers. A policy that does not load now fails in Staging in 7 seconds, a change to what production enforces waits for an approval, and a rollback is redeploying an older release. For three hosts and one operator, the time savings and ease of tracing the Octupus UI offered convinced me of its utility, despite stumbling over a few snags along the way.

For background, Argus-Iris was created to help me avoid OOM crashes when testing a variety of VMEM hungry services (voice, image, chat, moderation) while working on updates to the rest of the Argus suite. Iris decides which GPU job may start, on which server, and what has to be unloaded first. Its rules live in a policy file: which models stay loaded, when idle ones are unloaded, and on what schedule. A wrong policy can unload a model another service depends on, which is why a change to it deserves a second look. Iris runs as one broker plus an agent on each of three GPU hosts, each with its own settings, which makes it the most awkward of the Argus services to deploy by hand and so the one where a pipeline had the most to prove. Check the guided demo if you want to see what it does.

Building and publishing a release is a separate job, done by a shared pipeline that releases all of the suite's packages (written up in One release pipeline for sixteen packages). This post starts where that one ends, with an image in the registry.

The pipeline

Each stage can stop a release. Nothing on a production host changes before the approval.

  1. Release. A trigger creates it; it carries the image and the deploy scripts.
  2. Staging. A report-only broker. A bad policy stops here.
  3. Approval. Only if the policy changed. A rejection changes nothing.
  4. Production. The broker and three GPU hosts. A verify step must pass.
  5. Rollback. Redeploy an older release through the same stages.

Before and after

Task Before With Octopus
Deploy a release SSH to each host and run docker compose One release, promoted from Staging to Production; agents update one host at a time
Which image runs A hand-built image; nothing recorded which build was running The release pins the image and the deploy scripts at the same version
Check before restart None; a bad config showed when the live broker failed to start The release's own image validates config and policy before anything restarts
Try it first No staging A staging broker watches the real GPUs but cannot act on them
Change the policy Edit the file on the host A new release; a change that alters what the broker would do waits for approval
History and rollback 27 backup files in the deploy directory Each release carries its own config and policy; rollback is redeploying an older one
Unload or preload a model, restart an agent curl with a token, no record Runbooks (Octopus's audited one-off operations) with prompted variables
Health Noticed when something broke A verify script after every deploy, and hourly on a schedule

The staging broker is the part that needed new code. There is only one set of GPUs, so a second broker reading them would also act on them, unloading and preloading real models. iris therefore gained IRIS_REPORT_ONLY: a broker in that mode reports what it would do and does nothing. It is also given no tokens.

The approval is Octopus's manual intervention step. It runs in Production only, and only when the new config or policy differs from the deployed one as the broker reads it; a new image alone does not trigger it. With only me operating it, the approval is a pause.

What was tested

Everything below ran against the live system on 28 November. The image and the deploy scripts were 0.2.3 throughout; the deployment process and the runbooks are code on the repository's default branch.

Case Result
Release creation Passed. An Octopus trigger created the release about ten minutes after the tag, once the image reached the registry.
First release Caught. First attempt failed in Staging in 24 s and never reached Production. Second: Staging 30 s, Production 3 min with approval.
Nothing changed Passed. No approval asked. Staging 23 s, Production 44 s.
Comment-only policy edit Passed. No approval asked.
Policy that does not load Caught. Failed in Staging in 7 s; the lifecycle would not let it into Production.
Policy change, rejected Passed. The approval named the changed rule. Nothing on the hosts changed.
Policy change, approved Passed. Broker restarted on the new policy; verify passed.
Policy rollback Passed. Redeployed an older release. The approval showed the change reversed; afterwards the policy matched the original byte for byte.
Deploy while a job holds a GPU Passed. Broker unreachable for under 4 s, and back with no memory of the lease. The client re-attached under the same id on its next heartbeat and the job finished.
Runbooks Passed. Health check, restart agent, warm and evict each succeeded against Production. The hourly check fired on schedule.

Two limits on that table. Every release carried the same image, so rolling back the image itself is untested. And the lease recovery is the client's doing: the broker keeps leases in memory.

What it cost

  • Time and money. About four hours on the first day and a few more on the second, alongside work on other repositories. Octopus Cloud is on a 30-day trial, so nothing has been paid yet and the ongoing price is not part of this verdict.
  • Code. Five pull requests and about 1,500 added lines: about 250 of iris code and tests, about 1,050 of step scripts, Terraform for the Octopus space and the deployment process as code, and the rest documentation. See .octopus/ and issue 65.
  • A second root-level path into each host. Every GPU host now runs a polling Tentacle, Octopus's agent, which by default runs as root and executes what its Octopus Server sends. It could run as another user, but it needs Docker, which is root-equivalent anyway. The iris agent was already root-equivalent, so this doubles an exposure that was already there.
  • Secrets off the LAN. The broker's tokens and its live config now also sit in Octopus Cloud, along with a GitHub token that can write to the repository.
  • What a script would not give. A shell script wrapping check, compose and verify would cover validation and pinning. It would not give the approval, per-release snapshots, audit trail or runbooks.

Leaving would be cheap, so testing the integration is low risk, and didn't take much time. The deploy scripts read plain environment variables and run the same by hand. Two of the gains do not depend on Octopus at all: argus-iris check, which validates a config and policy without starting anything, and the report-only mode.

Snags for a first-time user

None of these blocked the work, but each cost time.

  • Config as Code. Octopus keeps the deployment process in the repo, in its own OCL format. OCL has no comment syntax: a # line outside a script body fails to parse, although the format page's own sample shows # lines. By design, a save in the Octopus UI is a Git commit authored by the signed-in user and pushed straight to the branch; the docs do not say that the author email is the Octopus login email, so set that before pointing it at a public repository. I could not find a documented example of a runbook's OCL file, so I got the format by pushing a branch and asking the API to parse it.
  • Source packages lose their execute bits. The deploy scripts come from a GitHub feed, pinned to the release tag. GitHub's archive of the tag records the scripts as executable; the package that reached the target had every file at mode 0644.
  • Working outside the Default space. A space is Octopus's unit of separation inside one instance. The Terraform provider's octopusdeploy_external_feed_create_release_trigger resource ignores its own space_id when it reads or deletes, so every plan after the first fails. The cause and a workaround are in my comment on the provider issue. The Octopus Web Portal showed something similar: the audit log's link to a manual intervention has no space in it, and shows "Resource is not found" for an intervention that succeeded. That one is fixed in Octopus 2027.0.13565.
  • Guided failure. It is on for Production, so a failed deployment step waits for a person. Runbooks inherit the environment's setting, which I found when a test run that failed sat waiting for me. A failed hourly check would wait too, so it is switched off per runbook.
  • Release numbers. A version template takes version, date and project variables, but not a package version. Octopus can instead take the release number from a step's package, but iris cuts several releases per image, for config and policy changes, so the numbers would collide. Releases are numbered separately from the image they carry.
  • Feeds. Octopus's feed check asks GitHub's container registry for a token without naming a repository, which the registry refuses anonymously. So even a public image needs a GitHub token on the feed.

Final Outcome

Iris 0.2.4, released the same day, carries two fixes from this exercise: Docker's progress output no longer marks healthy steps as warnings, and a release that changes neither config nor policy no longer restarts the broker. Octopus created its release two minutes after the image was published. In Staging every step finished clean, and redeploying the same release left the broker running. Production took it with no approval, since the policy had not changed. One warning remains there, where the broker and its agent share a compose project, and that fix waits for the next release. Octopus stays.


Originally published on dragonhound.dev.

Top comments (0)