<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: khaerul anwar</title>
    <description>The latest articles on DEV Community by khaerul anwar (@eidosstack).</description>
    <link>https://dev.to/eidosstack</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4100810%2Ff310efaa-82f4-4539-82ac-ff45914a96d2.jpeg</url>
      <title>DEV Community: khaerul anwar</title>
      <link>https://dev.to/eidosstack</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eidosstack"/>
    <language>en</language>
    <item>
      <title>Build a Docker CI/CD Pipeline with GitHub Actions and Octopus Deploy</title>
      <dc:creator>khaerul anwar</dc:creator>
      <pubDate>Tue, 10 Nov 2026 12:51:11 +0000</pubDate>
      <link>https://dev.to/eidosstack/build-a-docker-cicd-pipeline-with-github-actions-and-octopus-deploy-548o</link>
      <guid>https://dev.to/eidosstack/build-a-docker-cicd-pipeline-with-github-actions-and-octopus-deploy-548o</guid>
      <description>&lt;p&gt;A green build doesn't tell you which image is running on your server. It also doesn't tell you whether a background worker started, or whether your rollback image still exists.&lt;/p&gt;

&lt;p&gt;Those are the questions I want a deployment pipeline to answer for me.&lt;/p&gt;

&lt;p&gt;I use GitHub Actions and Octopus Deploy across parts of Meldport, EidosStack, and LumenOTP. The applications differ, but the useful habit is the same: record what passed CI, deploy that artifact, then check what actually started.&lt;/p&gt;

&lt;p&gt;This tutorial builds a small Node application and takes it through that whole path. You get the files, setup steps, expected results, and failure checks. The example uses a disposable Linux server and a Development environment. It doesn't change any of the three products.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Commit -&amp;gt; tests -&amp;gt; Docker image -&amp;gt; versioned package
       -&amp;gt; Octopus release -&amp;gt; Linux target -&amp;gt; revision check
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What this borrows from the three projects
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://meldport.com" rel="noopener noreferrer"&gt;Meldport&lt;/a&gt; is an AI API gateway with a web dashboard. Its frontend pipeline builds an image in CI and exports it into a versioned deployment package. Octopus loads that image on the target. The server doesn't rebuild the frontend from source.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://eidosstack.com" rel="noopener noreferrer"&gt;EidosStack&lt;/a&gt; backend uses GHCR image digests in its Octopus release packages. That's a different delivery method for the same idea: the deployment should identify the exact image. EidosStack's frontend has its own deployment path, so this is specifically a backend example.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://lumenotp.com" rel="noopener noreferrer"&gt;LumenOTP&lt;/a&gt; has separate web, worker, and migration images. Keeping their references together helps explain a release when the website is healthy but a worker isn't doing its job.&lt;/p&gt;

&lt;p&gt;We'll use Meldport's archive-style delivery for the walkthrough. It lets you follow the artifact without setting up registry pull access on the target. I'll cover the GHCR variation and worker checks near the end.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you start
&lt;/h2&gt;

&lt;p&gt;You'll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A GitHub repository where you can configure Actions secrets and variables.&lt;/li&gt;
&lt;li&gt;An Octopus instance with permission to create a project, environment, account, and target.&lt;/li&gt;
&lt;li&gt;A disposable Linux server reachable from your Octopus deployment infrastructure.&lt;/li&gt;
&lt;li&gt;Docker Engine, the Compose plugin, Bash, curl, jq, gzip, and flock on that server.&lt;/li&gt;
&lt;li&gt;A development machine with Node 24 and Git. Docker is needed for the local image check.&lt;/li&gt;
&lt;li&gt;A domain and HTTPS reverse proxy if you want the final public-URL check to pass.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use a test server rather than a machine already running customer applications. The example binds the app to a loopback port, but it still creates containers and writes deployment files.&lt;/p&gt;

&lt;p&gt;The sample app has no database or external API. That keeps the first deployment small enough to understand. Real applications need their own readiness checks, fixtures, and migration process.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Create an app whose revision you can check
&lt;/h2&gt;

&lt;p&gt;Make a directory with this layout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;example-web/
  server.mjs
  package.json
  package-lock.json
  Dockerfile
  .dockerignore
  .gitignore
  test/
    server.test.mjs
  deploy/
    compose.yaml
    deploy.sh
  .github/
    workflows/
      release.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add this package file. The lint command deliberately uses Node's syntax checker, so the example doesn't need a linter dependency. An existing application should keep its normal lint and type checks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"example-web"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"private"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"module"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"engines"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&amp;gt;=24 &amp;lt;25"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"node server.mjs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"lint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"node --check server.mjs &amp;amp;&amp;amp; node --check test/server.test.mjs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"test"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"node --test"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;server.mjs&lt;/code&gt;. The health response reports the revision passed at runtime. It doesn't return environment variables or application configuration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;createServer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:http'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;fileURLToPath&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:url'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;createApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;revision&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;APP_REVISION&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;'local'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'/api/health'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeHead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'content-type'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'application/json'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'ok'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;revision&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeHead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s1"&gt;'content-type'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'text/plain; charset=utf-8'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s1"&gt;'Example web is running.\n'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Not found\n'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nf"&gt;fileURLToPath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;createApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;PORT&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'0.0.0.0'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server binds to &lt;code&gt;0.0.0.0&lt;/code&gt; inside its container. Binding only to container-local &lt;code&gt;127.0.0.1&lt;/code&gt; would make the published Docker port unable to reach it.&lt;/p&gt;

&lt;p&gt;For a real service, separate a basic liveness endpoint from readiness that checks required dependencies. A web process can answer HTTP while its database connection is broken.&lt;/p&gt;

&lt;p&gt;Add &lt;code&gt;test/server.test.mjs&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;assert&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:assert/strict'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;once&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:events'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;test&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:test'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;createApp&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'../server.mjs'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'web routes and the expected revision'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'test-revision'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'127.0.0.1'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;once&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'listening'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;after&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;origin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`http://127.0.0.1:${app.address().port}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;health&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${origin}/api/health`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;health&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;deepEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;health&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'ok'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;revision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'test-revision'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${origin}/missing`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generate the lockfile and run the checks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --package-lock-only --ignore-scripts
npm ci
npm run lint
npm test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should get one passing test that exercises health, the root route, and a missing route. Commit &lt;code&gt;package-lock.json&lt;/code&gt; with the application. CI will use &lt;code&gt;npm ci&lt;/code&gt;, which expects the package file and lockfile to agree.&lt;/p&gt;

&lt;p&gt;To try the app manually in a Unix shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;APP_REVISION=local-check npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In another terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -fsS http://127.0.0.1:3000/api/health
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The expected response is &lt;code&gt;{"status":"ok","revision":"local-check"}&lt;/code&gt;. Stop the local process before moving on.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Build an image before involving Octopus
&lt;/h2&gt;

&lt;p&gt;Create &lt;code&gt;Dockerfile&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt; node:24-alpine
&lt;span class="k"&gt;WORKDIR&lt;/span&gt; /app
&lt;span class="k"&gt;ENV&lt;/span&gt; &lt;span class="nv"&gt;NODE_ENV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;production &lt;span class="nv"&gt;PORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3000
&lt;span class="k"&gt;COPY&lt;/span&gt; --chown=node:node server.mjs ./
&lt;span class="k"&gt;USER&lt;/span&gt; node
&lt;span class="k"&gt;EXPOSE&lt;/span&gt; 3000
&lt;span class="k"&gt;CMD&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"node"&lt;/span&gt;, &lt;span class="s2"&gt;"server.mjs"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This app has no runtime dependencies, so it only copies the server file. A real Next.js or API service will have a different Dockerfile, often with a separate build stage.&lt;/p&gt;

&lt;p&gt;The container runs as the image's non-root &lt;code&gt;node&lt;/code&gt; user. The base-image tag is readable but mutable; pin a reviewed base-image digest when making a controlled production build.&lt;/p&gt;

&lt;p&gt;Create &lt;code&gt;.dockerignore&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules
.git
.env*
*.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also add &lt;code&gt;.gitignore&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules/
.env*
runtime.env
health.json
package/
*.zip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the image locally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build --tag example-web:local .
docker run --rm --name example-web-local \
  -e APP_REVISION=local-image \
  -p 127.0.0.1:3180:3000 example-web:local
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In another terminal, request &lt;code&gt;http://127.0.0.1:3180/api/health&lt;/code&gt;. Its revision should be &lt;code&gt;local-image&lt;/code&gt;. Stop the foreground container with Ctrl+C when you're finished.&lt;/p&gt;

&lt;p&gt;This step catches container problems before you spend time configuring deployment permissions. A test passing on your laptop doesn't prove the image contains the files needed at runtime.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Prepare the Linux target once
&lt;/h2&gt;

&lt;p&gt;Install Docker Engine and the Compose plugin using the &lt;a href="https://docs.docker.com/engine/install/" rel="noopener noreferrer"&gt;official Docker instructions&lt;/a&gt; for your distribution. Check the remaining tools with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker version
docker compose version
bash --version
curl --version
jq --version
command -v flock
command -v gzip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a dedicated Linux deployment account through your normal server-administration process. The example below calls it &lt;code&gt;deploy&lt;/code&gt;; that is a placeholder, not an account from our infrastructure.&lt;/p&gt;

&lt;p&gt;As a server administrator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo install -d -m 750 -o deploy -g deploy /opt/example-web
sudo install -m 600 -o deploy -g deploy /dev/null /opt/example-web/runtime.env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the second command only for a new tutorial directory. It creates an empty file for this dependency-free demo and would replace an existing file.&lt;/p&gt;

&lt;p&gt;The deploy account must be able to use Docker. Docker-daemon access is powerful, often equivalent to root access on the host, so limit who can use that account and where its SSH key is accepted. Don't solve permissions with &lt;code&gt;chmod 777&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For an application with secrets, populate &lt;code&gt;runtime.env&lt;/code&gt; securely on the target or inject sensitive values through Octopus. Keep that file out of Git, Docker build contexts, and deployment packages.&lt;/p&gt;

&lt;p&gt;For the final URL check, configure your existing HTTPS reverse proxy to send the tutorial hostname to &lt;code&gt;127.0.0.1:3180&lt;/code&gt;. DNS, certificates, and proxy installation are outside this walkthrough. If that route isn't ready, the final pipeline check will fail even when local container readiness passes.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Add the target and project in Octopus
&lt;/h2&gt;

&lt;p&gt;Create a Development environment for this exercise.&lt;/p&gt;

&lt;p&gt;Then add a Linux SSH target under &lt;strong&gt;Infrastructure &amp;gt; Deployment Targets&lt;/strong&gt;. Select the SSH connection type, enter your tutorial server address, and verify its host-key fingerprint through a trusted server-administration channel before accepting it. Choose the deployment account you prepared.&lt;/p&gt;

&lt;p&gt;Assign the target to Development and give it a target tag such as &lt;code&gt;example-web&lt;/code&gt;. Run its health check. If Octopus cannot connect, fix that connection before creating a release.&lt;/p&gt;

&lt;p&gt;Octopus documents the &lt;a href="https://octopus.com/docs/infrastructure/deployment-targets/linux/ssh-target" rel="noopener noreferrer"&gt;SSH target setup and requirements&lt;/a&gt;. An SSH target does not require the Tentacle agent, but it still needs the tooling required by Octopus's target implementation.&lt;/p&gt;

&lt;p&gt;Create a project named &lt;code&gt;ExampleWeb&lt;/code&gt;. Add a &lt;strong&gt;Run a Script&lt;/strong&gt; step:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setting&lt;/th&gt;
&lt;th&gt;Value for this tutorial&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Execution location&lt;/td&gt;
&lt;td&gt;Each deployment target&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Target tag&lt;/td&gt;
&lt;td&gt;&lt;code&gt;example-web&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Script source&lt;/td&gt;
&lt;td&gt;File inside a package&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Package feed&lt;/td&gt;
&lt;td&gt;Octopus built-in package repository&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Package ID&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Example.Web.Deploy&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Script&lt;/td&gt;
&lt;td&gt;&lt;code&gt;deploy.sh&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Script language&lt;/td&gt;
&lt;td&gt;Bash&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5ooxr3gquj5u3iyy3efb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5ooxr3gquj5u3iyy3efb.png" alt="An Octopus script step with a referenced package selected for acquisition and extraction." width="800" height="606"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Package-reference UI example from the &lt;a href="https://octopus.com/docs/deployments/custom-scripts/run-a-script-step" rel="noopener noreferrer"&gt;Octopus script-step documentation&lt;/a&gt;. This is a vendor documentation screenshot, not our private deployment process. Labels may differ by version.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Make sure the package is acquired and extracted before the script runs. Script-source names vary slightly by Octopus version; the intended result is a target-side Bash script loaded from the selected ZIP. See the &lt;a href="https://octopus.com/docs/deployments/custom-scripts/run-a-script-step" rel="noopener noreferrer"&gt;script-step documentation&lt;/a&gt; for those options.&lt;/p&gt;

&lt;p&gt;Use a lifecycle that allows the Development environment, with no automatic deployment on release creation. Our workflow explicitly queues the deployment. Enabling both paths can result in an unintended duplicate deployment.&lt;/p&gt;

&lt;p&gt;At this point you have a target and a process, but nothing to deploy yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Decide what belongs in the package
&lt;/h2&gt;

&lt;p&gt;The ZIP will contain four files:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;File&lt;/th&gt;
&lt;th&gt;Why it travels&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;image.tar.gz&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The image built and smoke-tested by CI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;revision.txt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The source commit expected inside that image&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;compose.yaml&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The service definition for this release&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;deploy.sh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The target-side deployment and recovery script&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The filename follows &lt;code&gt;Example.Web.Deploy.&amp;lt;version&amp;gt;.zip&lt;/code&gt;. The package ID must match the ID selected in your Octopus step.&lt;/p&gt;

&lt;p&gt;We use a release number based on the GitHub run number and attempt. A rerun gets a different package version. Don't overwrite an earlier package and make an old release refer to new contents.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Add Compose and a deployment script
&lt;/h2&gt;

&lt;p&gt;Put this in &lt;code&gt;deploy/compose.yaml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;web&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${APP_IMAGE:?APP_IMAGE is required}&lt;/span&gt;
    &lt;span class="na"&gt;restart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;unless-stopped&lt;/span&gt;
    &lt;span class="na"&gt;env_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;runtime.env&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;APP_REVISION&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${APP_REVISION:?APP_REVISION is required}&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"127.0.0.1:3180:3000"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The port is published only on the host's loopback interface. Your HTTPS reverse proxy can reach it; it isn't a direct public Docker port.&lt;/p&gt;

&lt;p&gt;The script below imports the packaged image and checks its revision label. It then retains the current release files, starts the candidate, and probes the running revision. If the candidate fails, it restores the previous files and probes that revision too.&lt;/p&gt;

&lt;p&gt;Keep shell scripts in LF format, especially if you edit on Windows. A repository rule such as &lt;code&gt;*.sh text eol=lf&lt;/code&gt; in &lt;code&gt;.gitattributes&lt;/code&gt; helps. The script changes into its own package directory so it doesn't depend on Octopus choosing a particular initial working directory.&lt;/p&gt;

&lt;p&gt;Save it as &lt;code&gt;deploy/deploy.sh&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/usr/bin/env bash
set -euo pipefail

cd -- "$(dirname -- "${BASH_SOURCE[0]}")"

root=/opt/example-web
mkdir -p "$root"
exec 9&amp;gt;"$root/deploy.lock"
flock -n 9 || { echo "Another deployment is running"; exit 1; }

revision=$(cat revision.txt)
[[ "$revision" =~ ^[0-9a-f]{40}$ ]] || exit 1
image="app:$revision"

gzip -dc image.tar.gz | docker image load
label=$(docker image inspect "$image" \
  --format '{{index .Config.Labels "org.opencontainers.image.revision"}}')
[[ "$label" == "$revision" ]] || exit 1

if [[ -f "$root/release.env" ]]; then
  cp "$root/release.env" "$root/previous-release.env"
  cp "$root/compose.yaml" "$root/previous-compose.yaml"
fi

install -m 640 compose.yaml "$root/compose.yaml"
printf 'APP_IMAGE=%s\nAPP_REVISION=%s\n' "$image" "$revision" \
  &amp;gt; "$root/release.env"

compose() {
  docker compose --project-name example-web \
    --project-directory "$root" \
    --env-file "$root/release.env" \
    -f "$root/compose.yaml" "$@"
}

if compose up -d; then
  for attempt in $(seq 1 30); do
    if curl --connect-timeout 2 --max-time 5 -fsS http://127.0.0.1:3180/api/health |
      jq -e --arg expected "$revision" '.revision == $expected' &amp;gt;/dev/null; then
      echo "Ready: $revision"
      exit 0
    fi
    sleep 2
  done
fi

echo "Deployment failed its readiness check" &amp;gt;&amp;amp;2
if [[ -f "$root/previous-release.env" ]]; then
  cp "$root/previous-release.env" "$root/release.env"
  cp "$root/previous-compose.yaml" "$root/compose.yaml"
  compose up -d
  previous=$(sed -n 's/^APP_REVISION=//p' "$root/release.env")
  restored=false
  for attempt in $(seq 1 30); do
    if curl --connect-timeout 2 --max-time 5 -fsS http://127.0.0.1:3180/api/health |
      jq -e --arg expected "$previous" '.revision == $expected' &amp;gt;/dev/null; then
      restored=true
      break
    fi
    sleep 2
  done
  [[ "$restored" == true ]] || echo "Rollback also needs attention" &amp;gt;&amp;amp;2
fi
exit 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few details are easy to miss here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The deployment lock is per application directory. Two releases must not rewrite the same Compose state at once.&lt;/li&gt;
&lt;li&gt;Compose uses a fixed project name so successive releases update the same service.&lt;/li&gt;
&lt;li&gt;The script copies both the old image reference and Compose file. An image reference alone isn't the full previous service definition.&lt;/li&gt;
&lt;li&gt;A failed candidate still exits with a failure code after recovery. Octopus should report that release as failed, even if the previous app is serving traffic again.&lt;/li&gt;
&lt;li&gt;The label check catches an artifact mix-up. It is not a signature or proof that an untrusted package is safe.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This script doesn't version &lt;code&gt;runtime.env&lt;/code&gt;. An operator changing that file must consider compatibility with the previous app. On a first deployment there is no previous release to restore.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Connect GitHub to the Octopus project
&lt;/h2&gt;

&lt;p&gt;Create these repository variables under &lt;strong&gt;Settings &amp;gt; Secrets and variables &amp;gt; Actions&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;What to enter&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;OCTOPUS_URL&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Your Octopus instance URL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;OCTOPUS_SPACE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The space containing ExampleWeb&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;OCTOPUS_PROJECT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ExampleWeb&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;APP_PUBLIC_URL&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Your tutorial app's HTTPS origin, without a trailing slash&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Create &lt;code&gt;OCTOPUS_API_KEY&lt;/code&gt; as a repository secret. Use a deployment service account with the permissions needed to upload this package and create/deploy this project's releases. Keep its project, environment, and feed access as narrow as your Octopus setup permits. A key alone doesn't define its scope; the service account's roles and teams do.&lt;/p&gt;

&lt;p&gt;Octopus also provides an &lt;a href="https://github.com/OctopusDeploy/login" rel="noopener noreferrer"&gt;OIDC login action&lt;/a&gt;. This tutorial uses the API-key route to keep the setup visible in one workflow, not because long-lived credentials are required.&lt;/p&gt;

&lt;p&gt;Create &lt;code&gt;.github/workflows/release.yml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Release web&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;main&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

&lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;

&lt;span class="na"&gt;concurrency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;example-web-development&lt;/span&gt;
  &lt;span class="na"&gt;cancel-in-progress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;release&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;github.ref == 'refs/heads/main'&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-24.04&lt;/span&gt;
    &lt;span class="na"&gt;timeout-minutes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
    &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;OCTOPUS_URL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ vars.OCTOPUS_URL }}&lt;/span&gt;
      &lt;span class="na"&gt;OCTOPUS_SPACE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ vars.OCTOPUS_SPACE }}&lt;/span&gt;
      &lt;span class="na"&gt;OCTOPUS_API_KEY&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.OCTOPUS_API_KEY }}&lt;/span&gt;

    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;node-version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;
          &lt;span class="na"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Verify&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;npm ci&lt;/span&gt;
          &lt;span class="s"&gt;npm run lint&lt;/span&gt;
          &lt;span class="s"&gt;npm test&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;docker build \&lt;/span&gt;
            &lt;span class="s"&gt;--label "org.opencontainers.image.revision=$GITHUB_SHA" \&lt;/span&gt;
            &lt;span class="s"&gt;--tag "app:$GITHUB_SHA" .&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Smoke test the image&lt;/span&gt;
        &lt;span class="na"&gt;shell&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bash&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;set -euo pipefail&lt;/span&gt;
          &lt;span class="s"&gt;trap 'docker rm -f smoke &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || true' EXIT&lt;/span&gt;
          &lt;span class="s"&gt;docker run -d --name smoke \&lt;/span&gt;
            &lt;span class="s"&gt;-e APP_REVISION="$GITHUB_SHA" \&lt;/span&gt;
            &lt;span class="s"&gt;-p 127.0.0.1:3180:3000 "app:$GITHUB_SHA"&lt;/span&gt;
          &lt;span class="s"&gt;for attempt in $(seq 1 30); do&lt;/span&gt;
            &lt;span class="s"&gt;if curl --connect-timeout 2 --max-time 5 -fsS http://127.0.0.1:3180/api/health &amp;gt; health.json; then&lt;/span&gt;
              &lt;span class="s"&gt;break&lt;/span&gt;
            &lt;span class="s"&gt;fi&lt;/span&gt;
            &lt;span class="s"&gt;sleep 2&lt;/span&gt;
          &lt;span class="s"&gt;done&lt;/span&gt;
          &lt;span class="s"&gt;jq -e --arg expected "$GITHUB_SHA" \&lt;/span&gt;
            &lt;span class="s1"&gt;'.revision == $expected'&lt;/span&gt; &lt;span class="s"&gt;health.json&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Package&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;package&lt;/span&gt;
        &lt;span class="na"&gt;shell&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bash&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;set -euo pipefail&lt;/span&gt;
          &lt;span class="s"&gt;version="1.0.${GITHUB_RUN_NUMBER}-${GITHUB_RUN_ATTEMPT}"&lt;/span&gt;
          &lt;span class="s"&gt;mkdir -p package&lt;/span&gt;
          &lt;span class="s"&gt;cp deploy/compose.yaml deploy/deploy.sh package/&lt;/span&gt;
          &lt;span class="s"&gt;printf '%s\n' "$GITHUB_SHA" &amp;gt; package/revision.txt&lt;/span&gt;
          &lt;span class="s"&gt;docker save "app:$GITHUB_SHA" | gzip -1 &amp;gt; package/image.tar.gz&lt;/span&gt;
          &lt;span class="s"&gt;(cd package &amp;amp;&amp;amp; zip -q "../Example.Web.Deploy.$version.zip" *)&lt;/span&gt;
          &lt;span class="s"&gt;echo "version=$version" &amp;gt;&amp;gt; "$GITHUB_OUTPUT"&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Upload package&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;OctopusDeploy/push-package-action@3c77d39c57b633b369ed19b560fecd2e10dc0403&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;api_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.OCTOPUS_API_KEY }}&lt;/span&gt;
          &lt;span class="na"&gt;server&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ vars.OCTOPUS_URL }}&lt;/span&gt;
          &lt;span class="na"&gt;space&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ vars.OCTOPUS_SPACE }}&lt;/span&gt;
          &lt;span class="na"&gt;packages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Example.Web.Deploy.${{ steps.package.outputs.version }}.zip&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Create release&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;OctopusDeploy/create-release-action@62df9f2a0e9198f4b4e4b7fd333e212b162215cd&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;project&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ vars.OCTOPUS_PROJECT }}&lt;/span&gt;
          &lt;span class="na"&gt;release_number&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ steps.package.outputs.version }}&lt;/span&gt;
          &lt;span class="na"&gt;package_version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ steps.package.outputs.version }}&lt;/span&gt;
          &lt;span class="na"&gt;release_notes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Commit ${{ github.sha }}, run ${{ github.run_id }}"&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;OctopusDeploy/deploy-release-action@74c748ccbf1962c1e66c4a8c1206fbf4c5ab07a5&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;project&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ vars.OCTOPUS_PROJECT }}&lt;/span&gt;
          &lt;span class="na"&gt;release_number&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ steps.package.outputs.version }}&lt;/span&gt;
          &lt;span class="na"&gt;environments&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Development&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Wait for deployment&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;OctopusDeploy/await-task-action@cd2af689649c4bec7ee87f3ee22291a3376a187b&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;server_task_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ fromJson(steps.deploy.outputs.server_tasks)[0].serverTaskId }}&lt;/span&gt;
          &lt;span class="na"&gt;timeout_after&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"900"&lt;/span&gt;

      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Verify public revision&lt;/span&gt;
        &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;APP_PUBLIC_URL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ vars.APP_PUBLIC_URL }}&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;curl --connect-timeout 2 --max-time 5 -fsS "$APP_PUBLIC_URL/api/health" |&lt;/span&gt;
            &lt;span class="s"&gt;jq -e --arg expected "$GITHUB_SHA" '.revision == $expected'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The action references are full commit SHAs. They're public dependency versions, not secrets. Review and update them as dependencies change.&lt;/p&gt;

&lt;p&gt;The workflow only deploys from &lt;code&gt;main&lt;/code&gt;. A manual run on another branch won't pass the job's branch condition. If your repository uses a different default branch, change both the event filter and condition.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Read the workflow as a series of checks
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Verify&lt;/strong&gt; installs the committed dependency tree and runs the project's checks. In a real app, add integration tests against disposable databases. Don't give a pull-request test your production database URL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build&lt;/strong&gt; produces an image tagged with the source commit. That name is useful for tracking the build. The label records the expected revision too.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Smoke test&lt;/strong&gt; starts that image on the runner, requests its health endpoint, and compares the returned revision. The cleanup trap removes the test container even when the check fails. Our demo requires no external service; a real app may need temporary dependencies or a dedicated smoke-test configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Package&lt;/strong&gt; exports the same built image. It doesn't build another one for deployment. The ZIP also captures the Compose file and script used by that release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Upload, release, and deploy&lt;/strong&gt; are separate operations. Uploading a package does not start a container. Creating a release records the selected package version and deployment process. Deploying queues its execution for Development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wait for deployment&lt;/strong&gt; matters because the deploy action returns task IDs. A queued task can still fail while downloading or running its script. This workflow targets one environment and waits for its single returned task. If you add several environments, wait for all returned tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verify public revision&lt;/strong&gt; checks the HTTPS route after Octopus finishes. It can catch an old reverse-proxy route, stale instance, or wrong hostname. A failure here does not automatically invoke the target-side rollback script. Investigate the route before deciding whether to redeploy the previous release.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://octopus.com/docs/packaging-applications/build-servers/github-actions" rel="noopener noreferrer"&gt;Octopus GitHub Actions reference&lt;/a&gt; describes the release actions and their inputs.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Run the first deployment and inspect the result
&lt;/h2&gt;

&lt;p&gt;Commit the example files and push them through your repository's normal review process to &lt;code&gt;main&lt;/code&gt;. Alternatively, trigger the workflow manually from that branch.&lt;/p&gt;

&lt;p&gt;In GitHub Actions, check the stages in order. If Verify fails, no package should be deployed. If the image smoke test fails, fix the image rather than bypassing that check.&lt;/p&gt;

&lt;p&gt;In Octopus, open the new release. Confirm that its package version matches the version printed by the workflow, its environment is Development, and its target is the tutorial server.&lt;/p&gt;

&lt;p&gt;After a successful deployment, the target-side check should return the same commit as the workflow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -fsS http://127.0.0.1:3180/api/health | jq .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The expected shape is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ok"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"revision"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;the-full-commit-from-your-workflow&amp;gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From your own machine, request the tutorial hostname as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -fsS https://app.example.com/api/health | jq .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;app.example.com&lt;/code&gt; with your domain. It is an illustrative hostname, not a service you should expect to exist.&lt;/p&gt;

&lt;p&gt;For local diagnosis on the target, use the same Compose arguments as the deployment script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker compose --project-name example-web \
  --project-directory /opt/example-web \
  --env-file /opt/example-web/release.env \
  -f /opt/example-web/compose.yaml ps

docker compose --project-name example-web \
  --project-directory /opt/example-web \
  --env-file /opt/example-web/release.env \
  -f /opt/example-web/compose.yaml logs --tail=80 web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep logs out of public posts if they contain customer data or credentials. For a deployment problem, the release number, expected revision, and redacted error are usually better starting points than dumping an environment file.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Understand recovery before testing a failure
&lt;/h2&gt;

&lt;p&gt;On a disposable environment, first establish a healthy release A. For a recovery exercise, create a candidate whose health response intentionally returns a wrong revision. The CI smoke test should reject that candidate before it reaches Octopus.&lt;/p&gt;

&lt;p&gt;That is a useful first result: the earlier check prevented the broken release.&lt;/p&gt;

&lt;p&gt;To exercise target-side recovery, use a separate test harness with a candidate that passes the CI contract but fails its target-specific readiness check. Don't weaken the production workflow to force a failure through. A target dependency or fixture-controlled health response can model that case in isolation.&lt;/p&gt;

&lt;p&gt;After recovery, check that the previous revision answers again and that Octopus marks the candidate deployment failed. Don't accept a log line saying “restored” as the only proof.&lt;/p&gt;

&lt;p&gt;This single-instance Compose deployment can interrupt requests during replacement and recovery. For uninterrupted traffic, run a second instance, verify it, and switch the proxy. That needs a different deployment script; this one doesn't pretend to provide it.&lt;/p&gt;

&lt;h2&gt;
  
  
  11. Adjust the pattern for APIs, workers, and registries
&lt;/h2&gt;

&lt;p&gt;For the EidosStack backend-style approach, push the tested image to GHCR and capture the digest from the build/push operation. Put that digest in the release manifest, then pull it on the target. A commit-based tag is a label people can read; a digest identifies image content.&lt;/p&gt;

&lt;p&gt;The server needs its own authorized registry access. CI successfully pushing a package doesn't prove the target can pull it. Test package permissions and the exact digest before changing deployment logic.&lt;/p&gt;

&lt;p&gt;For LumenOTP-style services, include the web, worker, and migration image references together. Check worker readiness or a recent heartbeat separately from web health. An idle worker may be healthy; a process existing is not proof it can reach its queue. Pick a signal that matches the worker's actual job.&lt;/p&gt;

&lt;p&gt;For database-backed applications, take a verified backup before schema changes and favor backward-compatible migrations. Restoring yesterday's image doesn't undo today's schema. A destructive migration needs its own recovery decision.&lt;/p&gt;

&lt;p&gt;For frontend applications, watch build-time public configuration. If a framework bakes API origins into the browser bundle, moving the same image between environments won't replace those values. Either make those settings runtime-configurable or build explicitly environment-specific artifacts and label them honestly.&lt;/p&gt;

&lt;h2&gt;
  
  
  12. Troubleshoot the stage that actually failed
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Check first&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Octopus reports missing package&lt;/td&gt;
&lt;td&gt;Package ID, uploaded version, selected feed, release package selection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SSH target health fails&lt;/td&gt;
&lt;td&gt;Network reachability, host-key verification, SSH account, Octopus target prerequisites&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Compose can't read runtime.env&lt;/td&gt;
&lt;td&gt;File location, owner, permissions, deployment account&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Container starts but health is unreachable&lt;/td&gt;
&lt;td&gt;App binds to 0.0.0.0 inside container; correct ports; startup logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Health returns the wrong revision&lt;/td&gt;
&lt;td&gt;Image reference, runtime variable, target selection, stale proxy route&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GitHub finishes while deployment is still running&lt;/td&gt;
&lt;td&gt;Whether the workflow waits for the returned Octopus task&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Registry pull fails&lt;/td&gt;
&lt;td&gt;Exact digest exists; target credential can read that package&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local health passes but public check fails&lt;/td&gt;
&lt;td&gt;DNS, TLS, reverse proxy, cache behavior, wrong host route&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Worker is stale but website works&lt;/td&gt;
&lt;td&gt;Worker image reference, queue connection, heartbeat, worker logs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When you clean disk space, retain the running artifact and a known previous release. Avoid broad cleanup commands that remove volumes or every image on a shared host. A build cache is replaceable; an untested backup deletion isn't part of normal deployment housekeeping.&lt;/p&gt;

&lt;h2&gt;
  
  
  Moving from the tutorial to production
&lt;/h2&gt;

&lt;p&gt;Add Production as a separate lifecycle phase once Development is reliable. Promote the already-reviewed release when its environment configuration allows that. Octopus &lt;a href="https://octopus.com/docs/releases/lifecycles" rel="noopener noreferrer"&gt;lifecycles&lt;/a&gt; can control promotion order and retention.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj794j4h937v52wkv3sai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj794j4h937v52wkv3sai.png" alt="An example Octopus lifecycle adds a Development phase and environment." width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Lifecycle UI example from the &lt;a href="https://octopus.com/docs/releases/lifecycles" rel="noopener noreferrer"&gt;Octopus lifecycle documentation&lt;/a&gt;. This is a documentation example, not one of our project accounts.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Put approval at a deliberate point. That might be an Octopus intervention step or a protected deployment job, depending on your team. Don't copy a workflow that automatically deploys to Production and assume the environment name itself adds approval.&lt;/p&gt;

&lt;p&gt;Keep the CI runner away from your production application host where possible. A runner executes repository code, including build scripts. Restrict self-hosted runners to trusted jobs and keep untrusted pull requests on appropriately isolated infrastructure. GitHub explains the maintenance responsibilities in its &lt;a href="https://docs.github.com/en/actions/concepts/runners/self-hosted-runners" rel="noopener noreferrer"&gt;self-hosted runner documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The test I want at the end is straightforward: I can identify the artifact, see what is running, and explain how recovery works. That is useful for a small dashboard, an API backend, or a service with workers. Extra deployment machinery can wait until there's a specific failure it needs to prevent.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Disclosure: AI tools helped draft this tutorial from project workflows and documentation. The UI screenshots are from the linked Octopus documentation. The demo's local checks are reported separately from a real Octopus deployment; the tutorial has not been deployed to our production services.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>githubactions</category>
      <category>cicd</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Moving EidosStack AI Gateway Into Meldport</title>
      <dc:creator>khaerul anwar</dc:creator>
      <pubDate>Sun, 01 Nov 2026 17:07:28 +0000</pubDate>
      <link>https://dev.to/eidosstack/moving-eidosstack-ai-gateway-into-meldport-4i5f</link>
      <guid>https://dev.to/eidosstack/moving-eidosstack-ai-gateway-into-meldport-4i5f</guid>
      <description>&lt;p&gt;I retired EidosStack AI Gateway as a standalone product and moved its API work into Meldport.&lt;/p&gt;

&lt;p&gt;Meldport brings model discovery and API access together. Its public catalog lets you compare published model IDs, context windows, capabilities, and token rates before choosing a route. A project key and balance cover the published catalog.&lt;/p&gt;

&lt;p&gt;For language models, the gateway accepts the familiar Chat Completions request shape. Point an OpenAI-compatible client at &lt;a href="https://api.meldport.com/v1" rel="noopener noreferrer"&gt;https://api.meldport.com/v1&lt;/a&gt;, choose a published model ID, and send a request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://api.meldport.com/v1/chat/completions &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="nv"&gt;$MELDPORT_API_KEY&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Idempotency-Key: request-123"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
    "model": "YOUR_MODEL_ID",
    "messages": [{"role": "user", "content": "Hello"}]
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API key stays on your server. The docs cover key scope, request limits, retries, and billing.&lt;/p&gt;

&lt;p&gt;Image, video, and audio generation use their own workflows. They can involve input uploads, asynchronous jobs, and result retrieval, so they need more than a chat completion endpoint.&lt;/p&gt;

&lt;p&gt;Meldport is available to the public now with prepaid, usage-based pricing. The official launch is set for 13 November 2026.&lt;/p&gt;

&lt;p&gt;If you try it, I would appreciate feedback on the quickstart, the model details you need to compare routes, and how media generation fits into your app.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://meldport.com/models" rel="noopener noreferrer"&gt;Browse the model catalog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://meldport.com/docs#quickstart" rel="noopener noreferrer"&gt;Read the quickstart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://meldport.com/pricing/pay-as-you-go" rel="noopener noreferrer"&gt;Check pay-as-you-go pricing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>api</category>
      <category>ai</category>
      <category>showdev</category>
      <category>buildinpublic</category>
    </item>
    <item>
      <title>I built an AI gateway because I was tired of guessing what a request would cost</title>
      <dc:creator>khaerul anwar</dc:creator>
      <pubDate>Sat, 29 Aug 2026 22:43:17 +0000</pubDate>
      <link>https://dev.to/eidosstack/i-built-an-ai-gateway-because-i-was-tired-of-guessing-what-a-request-would-cost-5622</link>
      <guid>https://dev.to/eidosstack/i-built-an-ai-gateway-because-i-was-tired-of-guessing-what-a-request-would-cost-5622</guid>
      <description>&lt;p&gt;Every provider has a different pricing page.&lt;/p&gt;

&lt;p&gt;If you use one provider, that is fine. But the moment you want to compare models across providers (and you should, because prices for the same task vary wildly), you end up with a spreadsheet, a bunch of open tabs, and the nagging feeling that the numbers went stale last week.&lt;/p&gt;

&lt;p&gt;That was me for months. So I built the thing I actually wanted: &lt;strong&gt;EidosStack AI Gateway&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;It is an OpenAI-compatible API gateway. One endpoint, one API key, 48+ models behind it from DeepSeek, Anthropic (Claude), OpenAI (GPT), Google (Gemini), Alibaba (Qwen), Moonshot (Kimi), and Zhipu (GLM).&lt;/p&gt;

&lt;p&gt;The part I am most happy with is the pricing table. It shows input, output, and cache token prices per model, and it refreshes every 30 seconds. You see what a request will cost before you send it, not after the invoice arrives.&lt;/p&gt;

&lt;h2&gt;
  
  
  How billing works
&lt;/h2&gt;

&lt;p&gt;Pay-as-you-go, no subscription. You create an API key, set a spending limit on it if you want, and top up when needed. Billing is in IDR with USD shown as a reference.&lt;/p&gt;

&lt;p&gt;Prices on the gateway run up to 50% below the official provider rates. That is not a promo, it is just how we price.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned building it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Keeping a pricing table honest is harder than it sounds. Providers change prices quietly, so the table has to be re-verified constantly instead of hand-edited once.&lt;/li&gt;
&lt;li&gt;"OpenAI-compatible" is easy to claim and hard to get right. Tool calling and streaming were the parts that needed the most attention.&lt;/li&gt;
&lt;li&gt;Per-key spending limits matter more to small teams than fancy routing. Nobody wants to discover a runaway loop ate their balance overnight.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;The gateway is live at &lt;a href="https://www.eidosstack.com/en/ai-gateway" rel="noopener noreferrer"&gt;eidosstack.com/en/ai-gateway&lt;/a&gt;. The pricing table is public, so you can compare costs before signing up.&lt;/p&gt;

&lt;p&gt;We are also launching on &lt;a href="https://www.producthunt.com/products/eidosstack-ai-gateway" rel="noopener noreferrer"&gt;Product Hunt on September 8&lt;/a&gt; if you want to follow along.&lt;/p&gt;

&lt;p&gt;Feedback is welcome, especially from people running multi-provider setups. What do you use to keep API costs under control?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>webdev</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
