DevOpsScenario based on common patterns

Deploys that only worked from one laptop

Releases ran by hand from one machine. A pipeline with tests, staging and one-click rollback made them routine for the whole team.

problem

Only one person could release, from one laptop, and releases often broke something.

approach

Containerise the app, define infrastructure as code, build one pipeline for every change.

outcome

Anyone on the team can ship; a bad release rolls back in one step.

stack

GitHub Actions, Docker, Bicep

Every deploy, same checks.
deploy.ymllive
How every deploy I set up behaves.

The scenario

One developer knew how to release. The steps lived in their head and on their laptop. When they were away, nothing shipped.

Releases happened late at night “to be safe”, and roughly one in three needed a follow-up fix the next morning.

Symptoms

  • “It works on my machine” and a different result in production.
  • Environment settings copied by hand between servers.
  • No clear way to go back to the previous version.

How it was found

Writing the release down step by step showed the real problem: about a dozen manual steps, three of them depending on files that only existed on that laptop. Staging didn’t match production either, because it had been built by hand at a different time.

What fixed it

  1. The app runs in a container, so the same image goes to every environment.
  2. Staging and production are defined in Bicep, so they’re created the same way.
  3. One pipeline for every change: build, test, deploy to staging, smoke test, then production after approval.
  4. Production deploys to a staging slot first and swaps only after a health check. The previous version stays ready to swap back.
yaml
name: deploy
on: { push: { branches: [main] } }
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: docker build -t app:${{ github.sha }} . && docker run app:${{ github.sha }} npm test
  production:
    needs: test
    environment: production   # requires approval
    runs-on: ubuntu-latest
    steps:
      - run: ./scripts/deploy-to-slot.sh && ./scripts/health-check.sh && ./scripts/swap.sh

Result

Releases become a merge to main. Anyone on the team can ship during the day, and a bad release is undone in one step instead of a night of fixes.

Lessons

  • If a release needs a specific person or laptop, it isn’t a process yet.
  • Build staging and production from the same code, or staging tests nothing.
  • Design the rollback before the first automated deploy.

crafted.data

New deep-dives by email

One email when a new article is out: databases, cloud and AI, with the code. Unsubscribe in one click.

Email signups open soon. Until then, new articles are announced on Instagram.

Short videos too: crafted.data on Instagram