Your DevOps study space

Real explanations. Videos with tests. Fresh exams every time. Keep the streak alive and watch the XP stack up.

A complete CI/CD pipeline · DevOps Docs · StackwisePlanDevOps A complete CI/CD pipeline · DevOps Docs · StackwiseCodePython A complete CI/CD pipeline · DevOps Docs · StackwiseBuildDocker A complete CI/CD pipeline · DevOps Docs · StackwiseTestDevOps A complete CI/CD pipeline · DevOps Docs · StackwiseReleaseGit A complete CI/CD pipeline · DevOps Docs · StackwiseDeployKubernetes A complete CI/CD pipeline · DevOps Docs · StackwiseOperateLinux A complete CI/CD pipeline · DevOps Docs · StackwiseMonitorDevOps

Pick a topic

Eight tracks, each with docs, a cheat sheet, videos and tests.

How it works

One loop, repeated until it sticks.

Jump back in

Picked up from where you left off.

Free forever

Your DevOps journey starts with one click.

Sign in with Google or GitHub to open every chapter, video, test and challenge. Your progress is saved wherever you learn.

A complete CI/CD pipeline

Git chapter 6 introduced workflows. Here you build the whole pipeline a real team runs: every push and pull request is tested, every merge to main builds a Docker image and pushes it to a registry, and the new version is deployed to a server, with secrets kept out of the code and a manual approval before production.

The plan

  1. Test on every push and pull request. Nothing else happens if this fails.
  2. Build and push a Docker image, but only for main, tagged with the commit's SHA so every version is traceable.
  3. Deploy that exact image to the server, after a person approves it.

The repository holds the app, its tests, a Dockerfile, and the workflow in .github/workflows/pipeline.yml. The server holds a compose.yaml that runs the image.

push / PRtestevery pushbuild + pushmain only, :shaapprovea persondeploythe same imagefails: nothing else runssame image tested, built once, deployed
Each stage only runs if the one before it passed. Tagging by commit SHA means you always know exactly which code is live, and rolling back is just redeploying an older tag.

The whole workflow

name: pipeline
on:
  push:
    branches: [main]
  pull_request:

permissions:
  contents: read                     # the default for every job: read the code, nothing more

concurrency:
  group: pipeline-${{ github.ref }}
  cancel-in-progress: true           # a newer push cancels the older run of the same branch

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"     # quoted: see YAML in 15 minutes
          cache: pip
      - run: pip install -r requirements-dev.txt
      - run: pytest -q

  build:
    needs: test
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write                # allowed to push to GitHub Container Registry
    steps:
      - uses: actions/checkout@v4
      - name: Image name (registries need lowercase)
        run: echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV"
      - uses: docker/setup-buildx-action@v3
      - uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - uses: docker/build-push-action@v6
        with:
          push: true
          tags: ${{ env.IMAGE }}:${{ github.sha }},${{ env.IMAGE }}:latest
          cache-from: type=gha
          cache-to: type=gha,mode=max

  deploy:
    needs: build
    runs-on: ubuntu-latest
    environment: production          # waits for approval if the environment requires it
    steps:
      - name: Deploy over SSH
        env:
          SSH_KEY: ${{ secrets.SSH_KEY }}
          HOST: ${{ secrets.DEPLOY_HOST }}
          DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
          TAG: ${{ github.sha }}
        run: |
          mkdir -p ~/.ssh
          printf '%s\n' "$SSH_KEY" > ~/.ssh/id_ed25519
          chmod 600 ~/.ssh/id_ed25519
          ssh-keyscan -H "$HOST" >> ~/.ssh/known_hosts
          ssh "$DEPLOY_USER@$HOST" "cd /srv/app && echo TAG=$TAG > .env && docker compose pull && docker compose up -d"

Stage by stage

  • test uses cache: pip so dependencies aren't downloaded from scratch every run. requirements-dev.txt holds the app's packages plus test tools like pytest.
  • build runs only after test passes (needs) and only on main (if). The image goes to GHCR (GitHub Container Registry) using the automatic GITHUB_TOKEN, so there's no password to manage. Tagging with github.sha means you can always tell which commit is running, and roll back to any of them. The gha cache reuses Docker layers between runs.
  • deploy logs in to the server over SSH and tells Docker Compose to pull and start the new tag. Writing the tag into .env on the server means a later manual docker compose up keeps the same version.

On the server, /srv/app/compose.yaml uses that tag:

services:
  web:
    image: ghcr.io/you/app:${TAG:-latest}
    restart: unless-stopped
    ports:
      - "80:8000"

New GHCR packages are private, so log the server in once with a GitHub token that only has read:packages: docker login ghcr.io -u you. Or make the package public in its settings on GitHub.

Secrets and environments

  • Add secrets under the repository's Settings, then Secrets and variables, then Actions. Workflows read them as ${{ secrets.NAME }}, and GitHub masks them in logs. Never echo them anyway.
  • The deploy key is a separate SSH key pair made just for CI. Its public half goes into ~/.ssh/authorized_keys of a dedicated deploy user on the server; the private half (including the BEGIN and END lines) goes into the SSH_KEY secret.
  • Under Settings, then Environments, create production and add required reviewers (available on public repositories, and on private ones with paid plans). The deploy job then waits for a click before it runs. Environments can also hold their own secrets, so a staging job can't see production's.
  • ssh-keyscan trusts whatever host answers the first time. For more safety, store the server's known_hosts line as a secret and write that instead.
  • Deploying to a cloud? Prefer OIDC over stored access keys: with permissions: id-token: write, the aws-actions/configure-aws-credentials action exchanges a short-lived GitHub token for temporary AWS credentials, so there's no long-lived key to leak (Cloud chapter 4 covers roles).

Keeping main green

Under Settings, then Branches, add a branch protection rule (or ruleset) for main that requires the test job to pass before a pull request can be merged. Combined with the pipeline above, broken code can't reach main, and main is always deployable.

Rolling back

Because every image is tagged with its commit, rolling back is just deploying an older tag. Either re-run the old workflow run from the Actions tab, or add a manual trigger:

on:
  workflow_dispatch:
    inputs:
      tag:
        description: "Image tag (commit SHA) to deploy"
        required: true

and use ${{ inputs.tag }} instead of github.sha in the deploy step.

Deploying to Kubernetes instead

The test and build jobs stay exactly the same. The deploy step changes to something like kubectl set image deployment/web web=$IMAGE:$TAG or helm upgrade --install, with the cluster credentials coming from a secret or OIDC. Bigger teams often go one step further with GitOps: the pipeline only updates the image tag in a Git repository, and a tool inside the cluster such as Argo CD notices and applies it.

Common failures

  • denied: permission_denied: write_package: the job is missing packages: write, or the package already exists and isn't linked to this repository (fix it in the package's settings).
  • repository name must be lowercase: use the lowercase step shown above.
  • Host key verification failed: known_hosts wasn't written, or the server was rebuilt and its key changed.
  • Permission denied (publickey): wrong user, the public key isn't in authorized_keys, or the secret lost its first or last line.
  • The workflow never starts: the file isn't in .github/workflows/, the branch name in on: is wrong, or the YAML is invalid (the Actions tab shows the error).
  • Secrets are empty: pull requests from forks don't get secrets, on purpose. Run the deploy only on pushes to main, as above.

Questions

Pick an answer. Get it wrong and you can try again right away, no waiting. 10 questions per topic - pick a filter below, then use Recreate questions for a fresh set on that topic.

Fresh questions every time

Exam

A mixed test across the whole site, shuffled so you never know which topic comes next. When you submit, every mistake comes with the reason and a jump to the exact moment in the video that explains it.

30 questions 6 topics 20 minute limit Up to 70 XP
1–4 answer · ←→ move
History

Essay

0 / 200-250 words
Sample answer
History
0:00 / 0:00
Not started

on YouTube
Subscribe

Topic progress

Activity

Achievements

Settings

Your profile and your account.

Profile details

* Required. Saved in this browser until you sign in.

Letters, numbers, dots, dashes and underscores.
0 / 160

Account

Checking…

App

Install Stackwise on your phone or computer. It opens in its own window from your home screen, and the Docs and cheat sheets you've opened keep working without internet.

Only admins can see this

Dashboard

Sign-ups, activity, messages and reviews in one place.

Prove it

Certificates

Pass a topic's test and get a certificate with its own public page you can share or add to LinkedIn. Each test is 10 questions drawn at random and graded on the server; you need 8 right, you have 15 minutes, and you get one try per topic a day.

From first command to production

Linux for DevOps

A path through Linux the way DevOps engineers use it: ten stages, every command explained with its flags, examples, real output and mistakes, the combinations engineers chain together, and incidents worked through step by step. Practise everything in a safe lab folder.

Before the interview

Interview prep

Questions that come up in real DevOps interviews, with the kind of answer that lands. Say yours out loud first, then compare. Each one links to the chapter that goes deeper.

    Private to you

    My notes

    Everything you wrote down while watching and reading, in one place. Saved to your account, never shown to anyone.