Skip to main content

Examples

miabi-io/examples is a set of small, real applications with everything Miabi needs to ship them: a Dockerfile, tests, a .miabi/pipeline.yaml, and miabi.io/v1 manifests for GitOps. Each app builds, passes its own tests, answers a health check, and shuts down cleanly when Miabi replaces a release. Copy the one closest to your stack and change the code.

The apps​

ExampleStackPortShows
nodeNode.js 22, Express3000Tests with node:test, calling another app by name
goGo, Okapi, distroless8080Multi-arch builds, version stamping, a container with no capabilities
pythonPython 3.13, FastAPI8000A managed Postgres database wired in through DB_URL
phpPHP 8.4 on jkaninda/nginx-php-fpm80Plain PHP, plus a managed Redis visit counter
laravelLaravel 13 on jkaninda/nginx-php-fpm80Postgres, Redis, a queue worker, migrations before each release, CronJobs
javaJava 25, JDK HttpServer, distroless8080No framework, a jlink runtime of about 40 MB, no capabilities
spring-bootJava 25, Spring Boot 48080Postgres with Flyway, JVM sizing from the memory limit, graceful shutdown

Every app answers on the same routes, so you can check any of them the same way: / names the version and the container that served it, /healthz (/up for Laravel) is the health check, and /api/info returns the same details as JSON. Under miabi, /api/info also lists the variables Miabi set in the container, such as MIABI_RELEASE, MIABI_NODE, MIABI_REPLICA and MIABI_PUBLIC_URL, and the page shows the release and the node.

Alongside the apps:

  • gitops/ holds one folder per Git source: each app on its own, a Stack, a Volume and a Config, a DatabaseInstance shared by two apps, replicated storage in a swarm cluster, a multi-app Project with a custom domain and a rate-limited route, and the same app as staging and production.
  • pipelines/ holds pipeline specs that build straight from the monorepo, a build-only image, a versioned release with a Trivy scan and a Slack notice, and two GitHub Actions workflows.
  • compose/ holds a Docker Compose file to import as a stack.

Four ways to deploy one​

Apply a manifest. The images are published to ghcr.io/miabi-io/examples/<name>, so a manifest from gitops/ deploys as-is. Only images are pulled, so no build runner is needed:

git clone https://github.com/miabi-io/examples && cd examples
miabi login
miabi apply -f gitops/python/app.yaml --dry-run # print the plan
miabi apply -f gitops/python/app.yaml # Postgres + the app, wired together

Reconcile from Git. Register https://github.com/miabi-io/examples under Git repositories (it is public, so no token is needed), then create a Git source with the path set to one folder, such as gitops/laravel. Miabi keeps the workspace matching that folder: a commit is a change, a revert is a rollback. Fork the repository to change anything.

Import a Docker Compose file. miabi stacks import turns each service of compose/docker-compose.yml into an app in a stack.

Build from source. Copy an example folder into its own repository and create an app from it. Miabi finds .miabi/pipeline.yaml and offers to adopt it: from then on every deploy runs the tests, builds the image on your runner, and rolls it out. To build from the monorepo instead, bind a spec from pipelines/monorepo to the app; its context points the build at one directory.

Wiring without credentials​

The manifests never write a secret into Git. Connection strings come from interpolation and are stored encrypted, secrets stay references to the vault, and an app's public address is filled in at each deploy:

env:
DB_URL: "{{ .databases.python-example-db.uri }}" # resolved at apply time, stored encrypted
APP_KEY: "{{ .secrets.laravel-app-key }}" # a Secret with generate: true, resolved at deploy
APP_URL: "{{ .applications.laravel-example.public_url }}" # the app's domain or external URL

None of these needs a secretEnv entry.

Jobs​

The Laravel folder declares its jobs next to the app:

  • laravel-migrate is a Job with runPolicy: beforeRelease: each deploy runs the migration in the new image before the release starts, and a failed migration fails the deploy while the current release keeps serving. See Before each release.
  • laravel-prune-messages is a nightly CronJob with its own LOG_LEVEL.
  • laravel-vacuum runs psql from the postgres image with inheritEnv: false, so it gets only the database credentials it names, not the app's other secrets. See the job's environment.

See the manifest reference for every kind and field.