Docs cipi.yml Web panel API MCP Guides Compare GitHub Telegram channel
  1. Home
  2. Guides
  3. cipi.yml recipes for common Laravel setups
cipi.yml

cipi.yml recipes for common Laravel setups

18 copy-paste cipi.yml recipes, each with when to use it and what to change: a first app, SaaS with Horizon and Reverb, Octane API, online shop, multi-tenant, staging, redirects, Next.js, Nuxt, static sites, long jobs, AI apps, backups and tuning.

By Updated 8 min read

Start from the recipe closest to your app, run php artisan cipi:yml validate, commit, then sudo cipi yml plan <app> after the deploy. Every key is documented in the reference.

All recipes#

RecipeUse it for
A first, simple Laravel appYour first `cipi.
SaaS: Horizon, Reverb, search, backupsA product with paying users: Horizon for queues, Reverb for live updates, Meilisearch for search, frequent database backups and automatic rollback if a release breaks.
API on Octane with a reporting databaseA JSON API served by Octane, a separate PostgreSQL database for reports, a busy webhook queue and a cleanup task.
Online shop: busy queues, big uploads, frequent backupsA Laravel shop (Bagisto, Lunar or your own): order e-mails on their own queue, larger product image uploads, a database snapshot before every deploy and a backup every 30 minutes.
Multi-tenant SaaS on a wildcard domainEvery customer on their own subdomain (`acme.
Moving to a new domainYou renamed the product.
Marketing site: redirects and a proxied blogOld URLs redirected after a redesign, docs moved to their own subdomain, and a blog served from another local service under /blog/.
Staging next to productionThe staging app reads `cipi-staging.
Internal tool behind a passwordA back-office tool only your team should reach, with HTTPS forced and two named users.
Next.js front end (SSR)A server-rendered Next.
Nuxt front end (SSR) with a health pathNuxt in SSR mode, started from its build output, with a health path checked before traffic switches.
Static site or SPA (Vite, Astro)A built site served by Nginx, with no Node process running in production.
Long-running jobs (imports, exports, video)Exports and imports that run for minutes on their own queue, so they never delay e-mails.
AI app with embeddings on PostgreSQLAn app that embeds documents in the background and stores vectors in a PostgreSQL database.
Custom steps after every deployCommands to run after each successful deploy, plus extra Artisan caches during the build.
Extra scheduled commands without touching codeCommands on a timer, declared in the file instead of `routes/console.
Backups for a database that growsFrequent database backups that skip noisy tables, plus weekly full backups kept for months.
A busy PHP-FPM app, tunedMore PHP processes and memory for an app with a lot of traffic.

How to use a recipe#

Step 1 of 5Copy

Pick the recipe closest to your app and paste it into cipi.yml at the root of the repository.

Names inside the file (databases, backup profiles) must start with the app's name, so replace shop with yours. New to the file? Start with the cipi.yml guide.

A first, simple Laravel app#

When to use it. Your first cipi.yml: one queue worker, the scheduler, a health check and nightly backups. Good for a blog, a small business site or an internal tool.

yaml
version: 1
app:
  php: "8.6"
workers:
  queues:
    - { queue: default, processes: 1 }
schedule: true
health:
  url: "https://shop.example.com/up"
backup:
  profiles:
    - { name: shop-nightly, scope: all, cron: "0 2 * * *", keep_days: 14, destinations: [local] }
  • health.url must be one of the app's own domains. Laravel 11+ answers /up out of the box.
  • destinations: [local] keeps backups on the server; add s3 once you have a bucket (backups).

SaaS: Horizon, Reverb, search, backups#

When to use it. A product with paying users: Horizon for queues, Reverb for live updates, Meilisearch for search, frequent database backups and automatic rollback if a release breaks.

yaml
version: 1
app:
  php: "8.6"
  aliases: ["www.acme.app"]
  www: to-root
workers:
  horizon: true
  reverb: true
schedule: true
search: true
health:
  url: "https://acme.app/up"
  rollback_on_unhealthy: true
deploy:
  predeploy_snapshot: true
  node_build: "npm ci && npm run build"
  post:
    - artisan scout:sync-index-settings
env: { required: [STRIPE_KEY, STRIPE_SECRET, POSTMARK_TOKEN] }
backup:
  profiles:
    - { name: acme-db, scope: db, every: 30m, keep: 48, destinations: [local] }
    - { name: acme-nightly, scope: all, cron: "0 2 * * *", keep_days: 30, destinations: [s3], encrypt: true }
  • The app is called acme, so backup profiles are acme-….
  • search: true needs sudo cipi search install once on the server.
  • Horizon needs laravel/horizon in the app and QUEUE_CONNECTION=redis (guide).

API on Octane with a reporting database#

When to use it. A JSON API served by Octane, a separate PostgreSQL database for reports, a busy webhook queue and a cleanup task.

yaml
version: 1
app:
  php: "8.6"
  limits: { octane_workers: 4 }
databases:
  - name: api_reporting
    engine: pgsql
workers:
  queues:
    - { queue: default, processes: 2 }
    - { queue: webhooks, processes: 4, tries: 10, timeout: 120 }
schedule: true
crons:
  - { every: 30m, run: artisan queue:prune-batches }
  • The app itself must be created with --octane; the file sets how many Octane workers it runs.
  • engine: pgsql needs sudo cipi db install pgsql first (guide). Credentials go to shared/cipi-databases.env.

Online shop: busy queues, big uploads, frequent backups#

When to use it. A Laravel shop (Bagisto, Lunar or your own): order e-mails on their own queue, larger product image uploads, a database snapshot before every deploy and a backup every 30 minutes.

yaml
version: 1
app:
  php: "8.6"
  ini: { upload_max_filesize: 32M, post_max_size: 40M, memory_limit: 512M }
workers:
  queues:
    - { queue: default, processes: 2 }
    - { queue: orders, processes: 2, tries: 5, timeout: 300 }
    - { queue: mail, processes: 1, tries: 5 }
schedule: true
health:
  url: "https://shop.example.com/up"
  rollback_on_unhealthy: true
deploy:
  predeploy_snapshot: true
  node_build: "npm ci && npm run build"
backup:
  profiles:
    - { name: shop-db, scope: db, every: 30m, keep: 48, destinations: [local, s3], encrypt: true }
    - { name: shop-nightly, scope: all, cron: "0 3 * * *", keep_days: 30, destinations: [s3], encrypt: true }
  • With a 30-minute database backup, the most orders you can lose is half an hour's worth.
  • More in self-host PHP e-commerce.

Multi-tenant SaaS on a wildcard domain#

When to use it. Every customer on their own subdomain (acme.yourapp.com), one app, one certificate.

yaml
version: 1
app:
  aliases: ["*.yourapp.com"]          # covers www and every tenant
ssl: { force_https: true }
health:
  url: "https://www.yourapp.com/up"
  • The wildcard certificate is issued over DNS: run sudo cipi ssl install saas --dns=cloudflare once (multi-tenant guide).
  • app.aliases replaces the whole list: write every alias you want to keep.

Moving to a new domain#

When to use it. You renamed the product. The old app keeps its domain only to send visitors (and search engines) to the new one, keeping the path.

yaml
version: 1
redirect: { to: "https://newbrand.com", code: 301, keep_path: true }
  • keep_path: true sends /pricing to https://newbrand.com/pricing, which keeps your SEO.
  • Use 301 for a permanent move.

Marketing site: redirects and a proxied blog#

When to use it. Old URLs redirected after a redesign, docs moved to their own subdomain, and a blog served from another local service under /blog/.

yaml
version: 1
redirects:
  - { from: /pricing-old, to: /pricing }
  - { from: /docs/, to: "https://docs.acme.app/", code: 308 }
proxies:
  - { prefix: /blog/, upstream: "http://127.0.0.1:3000", strip_prefix: true }
  • Proxies to Cipi's own ports, link-local or cloud metadata addresses are refused on purpose.

Staging next to production#

When to use it. The staging app reads cipi-staging.yml instead of cipi.yml: fewer workers, a password, the develop branch.

yaml
# cipi-staging.yml
version: 1
app:
  basic_auth: { users: [preview] }
workers:
  queues: [{ queue: default, processes: 1 }]
deploy: { branch: develop, predeploy_snapshot: false }

Internal tool behind a password#

When to use it. A back-office tool only your team should reach, with HTTPS forced and two named users.

yaml
version: 1
app:
  basic_auth:
    users:
      - admin
      - { name: ops, password_hash: "$2y$12$replace.with.a.real.bcrypt.hash" }
ssl: { force_https: true }
  • admin keeps the password already set on the server; ops uses a bcrypt hash. Never write plain passwords in the file.
  • Create a hash with htpasswd -nbB ops 'your-password'.

Next.js front end (SSR)#

When to use it. A server-rendered Next.js app as a Node app, on Node 24.

yaml
version: 1
node:
  framework: next
  mode: ssr
  version: 24
deploy:
  branch: main
  • The node: section is applied by the deploy itself and needs sudo cipi yml auto web on.

Nuxt front end (SSR) with a health path#

When to use it. Nuxt in SSR mode, started from its build output, with a health path checked before traffic switches.

yaml
version: 1
node:
  framework: nuxt
  mode: ssr
  version: 24
  start: node .output/server/index.mjs
  health_path: /health
  • The new release must answer the health path before Nginx switches to it.

Static site or SPA (Vite, Astro)#

When to use it. A built site served by Nginx, with no Node process running in production.

yaml
version: 1
node:
  framework: vite
  mode: static
  output: dist
  • The deploy fails if dist/ has no index.html, so a broken build never goes live.

Long-running jobs (imports, exports, video)#

When to use it. Exports and imports that run for minutes on their own queue, so they never delay e-mails.

yaml
version: 1
workers:
  queues:
    - { queue: default, processes: 2 }
    - { queue: exports, processes: 1, tries: 1, timeout: 7200 }
  • Also set public $timeout on the job class, and retry_after above it in config/queue.php (why).
  • Video work needs sudo cipi package install ffmpeg once.

AI app with embeddings on PostgreSQL#

When to use it. An app that embeds documents in the background and stores vectors in a PostgreSQL database.

yaml
version: 1
databases:
  - name: rag_vectors
    engine: pgsql
workers:
  queues:
    - { queue: default, processes: 2 }
    - { queue: embeddings, processes: 3, tries: 5, timeout: 600 }
env: { required: [OPENAI_API_KEY] }
  • The app is called rag. pgvector must be created once by the database superuser (PostgreSQL guide).

Custom steps after every deploy#

When to use it. Commands to run after each successful deploy, plus extra Artisan caches during the build.

yaml
version: 1
deploy:
  keep_releases: 10
  extra_artisan: [event:cache, icons:cache]
  post:
    - artisan scout:sync-index-settings
    - node scripts/warm-cache.mjs
  post_on_failure: warn
  • Only allowlisted runners are accepted (artisan, composer, npm, npx, yarn, pnpm, php/node with a script in the release). No shells, no pipes.
  • post_on_failure: abort makes the deploy fail if a step fails.

Extra scheduled commands without touching code#

When to use it. Commands on a timer, declared in the file instead of routes/console.php.

yaml
version: 1
crons:
  - { every: 30m, run: artisan queue:prune-batches }
  - { cron: "15 4 * * *", run: artisan model:prune }
  • Up to 20 entries. Your own crontab lines are left untouched. Most apps should prefer Laravel's scheduler (guide).

Backups for a database that grows#

When to use it. Frequent database backups that skip noisy tables, plus weekly full backups kept for months.

yaml
version: 1
backup:
  profiles:
    - { name: shop-db, scope: db, every: 1h, keep: 72, exclude_tables: ["*.telescope_*", "*.jobs"], destinations: [s3], encrypt: true }
    - { name: shop-weekly, scope: all, cron: "0 4 * * 0", keep_weeks: 12, destinations: [s3], encrypt: true }
  • exclude_tables keeps debug and queue tables out of the archive.
  • Restore and verify: backups to S3.

A busy PHP-FPM app, tuned#

When to use it. More PHP processes and memory for an app with a lot of traffic.

yaml
version: 1
app:
  ini: { memory_limit: 512M, max_execution_time: 60 }
  limits: { fpm_max_children: 30, worker_procs: 6 }
  • Bounds are enforced: fpm_max_children 1–50, worker_procs 1–20, octane_workers 1–16. Out-of-range values block the plan.
  • Each PHP process can use up to memory_limit: 30 × 512M must fit in RAM.

Troubleshooting#

ProblemFix
search: true blockedMeilisearch isn't installed on the server: sudo cipi search install
Wildcard alias works, HTTPS doesn'tThe wildcard certificate needs DNS-01: wildcard guide
horizon: true and queues both setHorizon replaces the queues: keep one
Engine pgsql blockedPostgreSQL isn't installed: sudo cipi db install pgsql (guide)

Questions

Can I mix recipes?

Yes. Sections are independent: take workers from one and backup from another.

Will a recipe overwrite settings I made by hand?

Only for the sections it contains. Run cipi yml plan first: it lists every change.

Where do I put the passwords these setups need?

In the server's .env (cipi app env --set). env.required only lists the names so a missing one blocks the plan.

What if a step fails?

Read the troubleshooting table above first. Then check the matching docs page, open a GitHub issue, or ask in the community. Most commands print the fix when they refuse something.

Do I need the web panel for this?

No. Every step works from the CLI. The optional web panel shows the same things in a browser.

Can I run these commands from my laptop?

Many of them, through cipi-cli and the API, with a scoped token. Otherwise ssh cipi@your-server and use sudo cipi ….

Will this affect other apps on the server?

No, unless the step says it's server-wide (installing a PHP version, firewall, Cloudflare tunnel). Each app has its own user, PHP pool, database and Valkey.

Try it on your own server

Free and open source. One command on a fresh Ubuntu 24.04 or 26.04 VPS.

wget -O - https://cipi.sh/setup.sh | bash
Read the quickstart