Operations & deploy

Once Pionia Shop works locally, this section covers how to run and ship it — from php pionia serve on port 8000 to RoadRunner workers, OPcache preload, and zero-downtime deploys for Pionia Shop.

Who this is for

You have a working Pionia Shop API (product, customer, order, wallet services) and need to operate it in dev and production — CLI commands, persistent workers, logs under storage/logs/, and deploy-time optimization without rewriting application code.

What you will learn

  • Which CLI commands you run daily vs only on deploy
  • How to move from the built-in server to RoadRunner workers
  • Where to configure caching, logging, maintenance mode, and /stats metrics
Before you start

How it works

flowchart LR
  Dev["php pionia serve :8000"] --> RR[php pionia runserver]
  RR --> Opt[php pionia optimize --production]
  Opt --> Ship[Deploy + restart workers]
  Ship --> Obs["Logs / stats / cache"]

Development uses a single-process PHP server. Production adds persistent workers, optional OPcache preload, shared cache stores, and observability — all configured in your app, not in framework vendor code.

Daily commands

TaskGuide
CLI overviewCommands
Schema changesMigrations
Warm microbenchmarksBenchmarking
Persistent workersRoadRunner
Deploy checklistProduction performance
Zero-downtime deploysMaintenance mode

Observability & background work

TaskGuide
LogsLogging
Request metricsDeveloper stats
Post-response jobsBackground work
Cache storesCaching

Production checklist

composer install --no-dev -o
php pionia migrate
php pionia optimize --production
php pionia runserver --detach
curl -s http://127.0.0.1:8000/api/v1/ping

Common mistakes

  • Running optimize on every code change — use it at deploy time; local dev does not need preload or bootstrap caches.
  • Expecting php pionia serve to match production — HTTP/1 only, no job queue; use RoadRunner for production-like testing.
  • Forgetting to restart workers after deploy when opcache.validate_timestamps=0 — stale bytecode until FPM/RR reload.
  • Leaving /stats open in production without STATS_TOKEN — see Developer stats.

What’s next

Commands

Daily CLI and make:* scaffolds.

Benchmarking

php pionia bench microbenchmarks.

RoadRunner

Persistent workers and Moonlight jobs.