Podmaker
All pages
Use

Git, builds and CI/CD

Connect a repository, build exact commits, and deploy automatically from GitHub Actions or GitLab CI.

Git, builds and CI/CD

There are two ways to get from a commit to a running deployment.

A. Build in CI, deploy with Podmaker B. Build on a Podmaker builder
Who builds your CI (GitHub Actions, GitLab CI, …) a server with the builder role (rootless BuildKit)
Extra setup a registry and a CI token a builder server, a registry, a deploy key
Command in CI podmaker deploy <image>@sha256:… podmaker build <commit> --deploy
Recommended for most projects, especially to start keeping source and build credentials off third-party CI

Both use the same environment config, secrets, approvals and rollback.

Easiest: connect GitHub (one click, as a private GitHub App) or GitLab under Git and link the project. Access is set up for you, and pushes deploy automatically (see Put your app online). The steps below are the manual way and the CI/CD route.

Service account for CI

CI should not use your personal token. Create a service account with only the permissions it needs. The Developer role can read and create deployments and nothing else.

podmaker service-account create github-ci --role Developer
podmaker service-account token-create github-ci --name shop-deploy \
  --ability deployment.create --ability deployment.read --ability project.read \
  --ability operation.read --expires-in-days 90

Store the printed token as a CI secret (PODMAKER_TOKEN) together with PODMAKER_API=https://panel.podmaker.sh/api/v1. Revoke it at any time: podmaker service-account token-revoke github-ci <token-id>.

Service accounts can deploy to staging directly. Deployments to production wait for a human to approve them in the panel or with podmaker deploy approve. A leaked CI token therefore cannot ship to production on its own.

A. Build in CI, deploy with Podmaker

GitHub Actions

# .github/workflows/deploy.yml
name: deploy
on:
  push:
    branches: [main]
jobs:
  build-deploy:
    runs-on: ubuntu-latest
    permissions: { contents: read, packages: write }
    steps:
      - uses: actions/checkout@v4
      - uses: docker/login-action@v3
        with: { registry: ghcr.io, username: "${{ github.actor }}", password: "${{ secrets.GITHUB_TOKEN }}" }
      - id: build
        uses: docker/build-push-action@v6
        with: { push: true, tags: "ghcr.io/${{ github.repository }}:${{ github.sha }}" }
      - name: Deploy to staging
        env:
          PODMAKER_TOKEN: ${{ secrets.PODMAKER_TOKEN }}
          PODMAKER_API: ${{ vars.PODMAKER_API }}
        run: |
          curl -fsSL -o podmaker "${PODMAKER_API%/api/v1}/downloads/podmaker-linux-amd64" && chmod +x podmaker
          ./podmaker login --url "$PODMAKER_API" --token-stdin <<< "$PODMAKER_TOKEN"
          ./podmaker deploy "ghcr.io/${{ github.repository }}@${{ steps.build.outputs.digest }}" \
            --project shop --env staging --wait 10m

GitLab CI

# .gitlab-ci.yml
deploy-staging:
  stage: deploy
  image: docker:28
  services: [docker:28-dind]
  rules: [{ if: '$CI_COMMIT_BRANCH == "main"' }]
  script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
    - docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA" .
    - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA"
    - DIGEST=$(docker inspect --format '{{index .RepoDigests 0}}' "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA")
    - wget -qO podmaker "${PODMAKER_API%/api/v1}/downloads/podmaker-linux-amd64" && chmod +x podmaker
    - ./podmaker login --url "$PODMAKER_API" --token-stdin <<< "$PODMAKER_TOKEN"
    - ./podmaker deploy "$DIGEST" --project shop --env staging --wait 10m

For a private package, add a registry login (for GitLab: a deploy token with read_registry, host registry.gitlab.com) and set "image": {"registry": "<name>"} in the environment config. The agent logs in before pulling.

Promote to production

Deploy the same digest that passed staging:

podmaker deploy ghcr.io/you/shop@sha256:4f1c... --project shop --env production
# → awaiting approval; approve in the panel (Projects) or:
podmaker deploy approve <deployment-id>

A manual CI job (when: manual / workflow_dispatch) can request the production deployment with --wait 0. The job ends once the request is recorded, and a person approves it. With a non-zero --wait, the job would wait for the approval and fail if it does not arrive in time.

podmaker deploy exits non-zero when a deployment fails, is rejected or is rolled back after a failed health check, so the CI job fails visibly. Add -o json to parse the result.

The panel serves the CLI for CI at /downloads/podmaker-linux-amd64, /downloads/podmaker-linux-arm64 and /downloads/podmaker-darwin-arm64, with an X-Checksum-Sha256 header.

B. Build on a Podmaker builder

1. Connect the repository

podmaker project create shop --repository git@github.com:you/shop.git
podmaker project deploy-key shop        # prints an SSH public key (read-only)

Add the public key to the repository as a read-only deploy key: GitHub → Settings → Deploy keys; GitLab → Settings → Repository → Deploy keys. The private key is encrypted in Podmaker and given to the builder only for the duration of a clone. Running deploy-key again rotates it. Public HTTPS repositories need no key. Plain http:// remotes are refused.

2. Prepare a builder server

A builder needs git, buildctl and a BuildKit daemon. Podmaker sets them up when a server gets the builder role:

  • Existing server: on the server’s page, Change roles over SSH (or Install the agent over SSH for a new one) → tick builder → install. Podmaker installs git, starts BuildKit in the container podmaker-buildkitd (listening on 127.0.0.1:1234 only), copies buildctl, waits until BuildKit answers and restarts the agent with the new roles.
  • New server at a provider: choose the builder role in Add server → Create at a provider. Cloud-init does the same on first boot.

The builder pushes to the environment’s image.repository with its registry login. Use the Podmaker server’s registry (registry.podmaker.sh/<repo> with "registry": "podmaker") so any server can pull the result.

3. Build and deploy

The environment config needs image.repository (where to push), and optionally image.registry and build:

podmaker build 3f2a9c1e... --project shop --env staging --deploy
podmaker build status <build-id>        # includes the log tail

The builder:

  1. Clones exactly that commit.
  2. Builds it with BuildKit.
  3. Labels the image with org.opencontainers.image.revision=<commit>.
  4. Pushes it and reports the digest.

With --deploy, that digest is deployed. For production, the deployment then waits for approval as usual. In CI:

./podmaker build "$CI_COMMIT_SHA" --project shop --env staging --deploy --wait 30m

Migrations and zero-surprise rollouts

  • Use profile: laravel or explicit before_up hooks so that migrations run once, before the new containers start. If a migration fails, the old version keeps running.
  • Write migrations that the previous release can live with (add columns before using them, drop them a release later). Rollback restores the previous image, not the database schema.
  • Take a backup before risky migrations: podmaker backup create ... (see backups).