Skip to content

Deployments from the CLI and GitHub Actions

Choose the deployment method that matches the application.

Application Deploy and update
Worker-style Node app using wrangler.jsonc and the MIE Cloud runtime Use the Cloud CLI with its OS provider. It manages one container per app name and site.
Existing server app such as a Laravel/PHP application Provision a suitable LXC through Manager. Deploy a reviewed release over SSH, retain the database and uploads, and restart the application's services.
Disposable branch preview packaged as a registry image the cluster can pull Launchpad derives a hostname from the repository owner, repository name and branch. Subsequent deployments with a template replace the container.

MIE Cloud CLI

Use the installed mieweb command or run npx mieweb with Node.js 22.18+. For a Cloud app with a DNS-compatible name in wrangler.jsonc and a start script that listens on $PORT (default 8787), run from the app directory:

npx mieweb login
npx mieweb whoami
npx mieweb deploy
npx mieweb tail -n 50 --no-follow

The CLI includes the OS provider and defaults to MIE. For a private preview, select the site and domain in Manager and configure the HTTP auth gate before deploying. This example mieweb.jsonc uses values you would replace for your installation:

{
  "targets": {
    "mieweb": {
      "instanceUrl": "https://manager.example.org",
      "siteId": 7,
      "domain": "apps.example.org",
      "authRequired": true
    }
  }
}

Code transfer uses the SSH identity enrolled for the Manager user. Deploy from a clean checkout: sync includes modified and untracked files allowed by repository .gitignore rules. Set sync: false when you only need to provision infrastructure.

The provider owns the app HTTP route, SSH on 22, and explicitly declared extra TCP/UDP services. Declare all desired services and environment values in the deployment configuration. Later deploys remove undeclared entries. Supply each app secret as MIEWEB_OS_SECRET_<NAME> for every deploy. A code-only change normally syncs in place. An image or GPU change can replace the container. Check that the attached writable /mnt/data volume is ready and contains the data you need before replacement, and verify backups. Use destroy only on an identified, authorized target. The provider reattaches retained storage for the same site, owner and app name on supported Managers.

mieweb images build|push|inspect|status handles OCI images referenced by wrangler.jsonc's containers list. mieweb registry login authenticates to the registry. Use Manager MCP or its API for inventory and lifecycle operations on general-purpose LXC containers. Cloud CLI · Provider implementation · Operator guide

Example trusted-branch workflow

For a Cloud application with npm, save this as .github/workflows/deploy-os.yml. Pin the public mieweb package as a development dependency in the project lockfile for CI. Set a GitHub environment named staging, restrict its deployment branches to main, and configure the two named secrets. Enroll the matching SSH public key for the deployment user. Set the verified Manager origin, site and domain in mieweb.jsonc. Add any app-specific MIEWEB_OS_SECRET_* values to the deploy step. Replace npm test with the project's test command if needed.

name: Deploy to OS staging
on:
  push:
    branches: [main]
  workflow_dispatch:
permissions:
  contents: read
concurrency:
  group: os-staging
  cancel-in-progress: false
jobs:
  deploy:
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    environment: staging
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
        with:
          persist-credentials: false
      - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
        with:
          node-version: '24'
      - run: npm ci
      - run: npm test
      - name: Deploy the reviewed revision
        shell: bash
        env:
          MIEWEB_OS_TOKEN: ${{ secrets.MIEWEB_OS_TOKEN }}
          DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
        run: |
          set -euo pipefail
          : "${MIEWEB_OS_TOKEN:?Set the Manager token}"
          eval "$(ssh-agent -s)"
          trap 'ssh-agent -k >/dev/null' EXIT
          ssh-add - <<< "${DEPLOY_SSH_KEY:?Set the deploy key}"
          unset DEPLOY_SSH_KEY
          npx --no mieweb whoami
          npx --no mieweb deploy

The Cloud SSH client uses first-connection trust and keeps its pin in ~/.mieweb/known_hosts. An ephemeral runner starts with an empty pin file. For a known existing container, provision its verified fingerprint on the runner using the provider's [host]:port SHA256:… format. After deployment, test the application health check and the expected unauthenticated and authorized proxy responses. A running container alone only confirms the operating system started.

A human or authorized agent can dispatch the same reviewed workflow with gh workflow run deploy-os.yml --ref main, then monitor the matching run using gh run watch <run-id> --exit-status. The workflow must exist on the default branch. Use environment protection and the same fixed deployment operation for automation. Keep fork PRs on unprivileged test jobs, and keep deployment credentials out of steps that execute unreviewed PR code. GitHub manual triggers · Deployment environments

Dispatch an update to an existing guest

A durable PHP or other server application can reuse the same protected main push/manual triggers and concurrency group above. Point the GitHub environment at one existing staging guest. This path requires SSH access to that guest. The job can run without a Manager token when it only delivers application releases.

One workable contract is a guest-side deploy-release <sha> command installed by the operator. It fetches the approved repository using its own read-only credential, verifies that the exact commit belongs to the protected release branch, builds or unpacks the matching artifact, updates the existing service, and checks the app. Keep persistent data outside the release directory. Record the active SHA and health result. Limit the SSH account to that release command and required service operations. Test the contract once on staging before enabling the trigger.

In the workflow above, replace the Cloud deploy step with this step and use the application's own build/test jobs as prerequisites. Set OS_SSH_HOST, OS_SSH_PORT and OS_DEPLOY_USER as protected environment variables. Store a previously verified OpenSSH known-hosts line for the assigned endpoint and the dedicated private key as environment secrets.

- name: Update the existing staging guest
  shell: bash
  env:
    HOST: ${{ vars.OS_SSH_HOST }}
    PORT: ${{ vars.OS_SSH_PORT }}
    DEPLOY_USER: ${{ vars.OS_DEPLOY_USER }}
    DEPLOY_KEY: ${{ secrets.OS_DEPLOY_KEY }}
    KNOWN_HOSTS: ${{ secrets.OS_KNOWN_HOSTS }}
  run: |
    set -euo pipefail
    [[ "$GITHUB_SHA" =~ ^[0-9a-f]{40}$ ]]
    umask 077
    keydir=$(mktemp -d)
    trap 'rm -rf -- "$keydir"' EXIT
    printf '%s\n' "$DEPLOY_KEY" > "$keydir/key"
    printf '%s\n' "$KNOWN_HOSTS" > "$keydir/known_hosts"
    unset DEPLOY_KEY KNOWN_HOSTS
    ssh -T -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes \
      -o UserKnownHostsFile="$keydir/known_hosts" -i "$keydir/key" \
      -p "$PORT" "$DEPLOY_USER@$HOST" "deploy-release $GITHUB_SHA"

After updating a stateful app, check a synthetic record or upload created before the update. Compare its ID and contents, verify the release and proxy sign-in, and check one background job. An agent can dispatch and watch this workflow exactly as it would the Cloud workflow. If the requested action changes the guest's routes or storage, resolve the site and Manager container ID separately before applying that infrastructure change.

Launchpad preview lifecycle

Launchpad accepts a site ID, Manager base URL, API key, OCI image and services. Select an immutable build tag that the Manager can pull. Follow the cluster's LXC image convention: use an MIE-compatible base, enable a systemd unit for the service, and declare its listening port with EXPOSE and org.mieweb.opensource-server.services.http.default-port. The documented registry path uses anonymous pulls. For private project source, keep release code private and use a suitable generic base plus authenticated transfer. Image guide · Registry requirements

At the reviewed revision, workflow_dispatch, create, ordinary pushes, and open PR updates manage the branch container. A branch-creation push is skipped. A PR close or branch deletion deletes the branch container. For trusted PR previews use pull_request.types: [opened, synchronize, reopened, closed], check github.event.pull_request.head.repo.full_name == github.repository, use synthetic data, and serialize operations per target. Use distinct branch names after lowercasing and punctuation replacement, and assign one workflow to own each resulting container.

On a manage event, supplying template_name deletes an existing container before creating its replacement. The action exposes no volumes input. Its nested create step prints the full payload and sends environment, while the inspected Manager reads environmentVars. Keep credentials out of container_env_vars. Pin and review every action handling credentials: Launchpad itself references nested actions at @main. Verify cleanup in Manager since the delete step can continue after an error. Launchpad event and replacement logic · Nested create action · Manager request handling