Quickstart cipi.yml Web panel API MCP Ecosystem Guides Docs GitHub Telegram channel
  1. Home
  2. Docs
  3. Apps
  4. WordPress apps

WordPress apps

WordPress from Git with zero-downtime releases: classic or Bedrock, shared uploads, WP-CLI.

AppsUpdated

A WordPress app deploys a WordPress kept in Git the way a Laravel app deploys: a new release beside the live one, one switch, rollback. The uploads and the configuration live outside the releases, so a deploy never touches them.

A WordPress app from Git
$ sudo cipi app create --wordpress --user=blog --domain=blog.example.com --repository=git@github.com:acme/blog.git

WordPress app or custom app?#

WordPress app (--wordpress)Custom app (--custom)
The codeIn Git: core, themes and plugins, committed or required with ComposerUploaded over SFTP, or pulled into ~/htdocs
DeployZero-downtime releases with rollbackIn place
Plugins and updatesIn Git, then a deploy. wp-admin does not install or updateFrom wp-admin, as usual
Database, salts, wp-config.phpCreated and written for youA database on request; the configuration is yours
ForSites built by developers, with a repository and reviewsA WordPress run from its dashboard

Both are fine. A site whose plugins are installed from wp-admin is a custom app: a release is replaced whole at the next deploy, and what the dashboard added would be gone with it.

Create one#

bash
# WordPress at the root of the repository
sudo cipi app create --wordpress --user=blog --domain=blog.example.com \
    --repository=git@github.com:you/blog.git

# Bedrock (roots.io): served from web/, WordPress in web/wp
sudo cipi app create --wordpress --user=shop --domain=shop.example.com \
    --repository=git@github.com:you/shop.git --docroot=web

# A theme built with Vite, on PHP 8.4
sudo cipi app create --wordpress --user=mag --domain=mag.example.com \
    --repository=git@github.com:you/mag.git --php=8.4 \
    --node-build='npm ci && npm run build'
FlagMeaningDefault
--wordpressThe app type. Also --framework=wordpress, or WordPress in the wizard
--repositoryGit URL over SSH. Requiredasked
--docroot=webA Bedrock projectthe repository's root
--db=NAMEThe database's name. --no-db makes nonethe app's name
--node-buildAsset build run in every deploynone
--php, --branch, --envAs for every app

The database is on MySQL or MariaDB, the engines WordPress runs on: --engine=pgsql is refused.

What the repository holds#

LayoutIn GitNot in Git
ClassicWordPress itself (index.php, wp-settings.php, wp-admin/, wp-includes/), wp-content/themes, wp-content/pluginswp-config.php, wp-content/uploads
Bedrockcomposer.json and composer.lock, config/, web/app/themes, your own plugins.env, web/wp and the plugins Composer installs, web/app/uploads

A wp-config.php committed to a classic repository is harmless: Cipi's own takes its place in every release. A composer.json at the root is installed on every deploy, so plugins from wpackagist work in a classic layout too.

Before a release goes live, the deploy checks that it has a WordPress to serve (index.php and wp-settings.php). A repository that holds only a theme stops there, with the site as it was.

Where things live#

/home/blog/
├── current -> releases/12        # what Nginx serves
├── releases/11/ 12/              # one folder per deploy
└── shared/
    ├── .env                      # database, salts, WP_HOME…
    ├── wp-config.php             # reads that .env (classic layout)
    └── wp-content/uploads/       # the media library

Each release gets links to the three shared entries. Bedrock shares .env and web/app/uploads and reads the .env itself.

Configuration#

Everything WordPress is told lives in ~/shared/.env. Cipi writes it when the app is created, so the first deploy shows WordPress's own installer with nothing left to configure. Change it with sudo cipi app env blog or from the panel's editor; it applies to the next request.

VariableValue
DB_NAME, DB_USER, DB_PASSWORD, DB_HOST, DB_PREFIXThe database made with the app
AUTH_KEY … NONCE_SALTThe eight keys and salts, generated
WP_HOME, WP_SITEURLhttps:// and the app's domain (/wp added for Bedrock). They follow sudo cipi app edit blog --domain=…
WP_ENVIRONMENT_TYPEFrom --env: production, staging, development or local
DISALLOW_FILE_MODS, AUTOMATIC_UPDATER_DISABLEDtrue: the code comes from Git
DISABLE_WP_CRONtrue: cron runs from the crontab
WP_DEBUG, WP_DEBUG_LOG, WP_DEBUG_DISPLAYfalse: errors are neither shown to visitors nor written to debug.log. To look into a problem set the first two to true and leave WP_DEBUG_DISPLAY off
CIPI_APP_USER, CIPI_ENV, CIPI_PHP_VERSION, CIPI_DEPLOY_BRANCHWhat Cipi knows about the app, for your own code
WP_MEMORY_LIMIT, FORCE_SSL_ADMIN, WP_CACHEYours to set

Constants that are not in the list go between the two comments at the end of ~/shared/wp-config.php (Add any custom values…).

With DISALLOW_FILE_MODS=true, wp-admin hides the plugin and theme installers and the update buttons. That is the point: add a plugin to the repository (or to composer.json) and deploy.

Deploy#

bash
sudo cipi deploy blog
sudo cipi deploy blog --rollback
Step 1 of 6Clone

The commit of the branch, in a folder of its own. The live release is not touched.

Pushes deploy by themselves: the webhook is Cipi's own, with nothing to install in WordPress (auto-deploy). Keep releases, the build's time limit and the database snapshot before a deploy are in sudo cipi app deploy-config blog.

A rollback moves the code back. The database is not part of a release: for a deploy that changes it, turn on the snapshot before deploy.

WP-CLI#

bash
sudo cipi package install wp-cli
sudo su - blog
wp plugin list
wp search-replace 'http://old.example.com' 'https://blog.example.com' --dry-run
WP-CLI on the app's own PHP
$ sudo cipi package install wp-cli
$ sudo su - blog
$ wp option get siteurl
$ wp --info | grep 'PHP binary'
$ wp cache flush

As the app's user, wp works on the live release from any folder, on the PHP version the app runs on. After a deploy it is on the new release.

Cron#

WordPress's scheduled events run every minute from the app's crontab (wp-cron.php, on the app's PHP), not when a visitor happens to load a page. Scheduled posts go out on time on a site with no traffic.

Caching#

LayerCommand
Pages, for anonymous visitorssudo cipi cache blog on
Objects, in a Valkey of the app's ownsudo cipi cache blog object on writes the WP_REDIS_* lines into ~/shared/wp-config.php (classic layout). On Bedrock, add them to config/application.php

Step by step: caching WordPress with Cipi.

What Nginx does#

PermalinksEvery path that is not a file goes to index.php
UploadsNo PHP runs from the uploads folder, classic or Bedrock
robots.txtWordPress's own answer when the repository has no file
During a deployThe path of the release is resolved per request ($realpath_root), so OPcache never mixes two releases

Common problems#

ProblemFix
The deploy stops at wp-settings.php not foundThe repository has no WordPress core. Commit it, or require it with Composer (Bedrock does)
Error establishing a database connectionCheck DB_* in sudo cipi app env blog. A new password: sudo cipi db password blog, then put it in the .env
A plugin installed from wp-admin is missingIt was added to a release that is gone. Add it to the repository and deploy
Images are missing after moving the siteCopy the old wp-content/uploads into ~/shared/wp-content/uploads (as the app's user)
Redirect loop behind CloudflareUse Full (strict) on Cloudflare and install a certificate on the app: the guide

Questions#

QuestionAnswer
Can I update WordPress from the dashboard?Not in this app type: updates come from Git. For a WordPress run from its dashboard, create a custom app.
Does it work with WooCommerce?Yes. Orders are in the database and uploads in shared/: neither is touched by a deploy. See WooCommerce on a VPS.
Multisite?Yes: add the MULTISITE constants to ~/shared/wp-config.php, and for subdomains a wildcard alias.
How do I move an existing site in?Put its code in a repository, create the app, import the database (wp db import) and copy the uploads into shared/. The guide walks through it.
Is it backed up?shared/ (uploads, .env) and the database are in backups. The code comes back from Git.
Can a custom app become a WordPress app?Not by a switch. Create the new app next to it and move the database and the uploads; the guide above has the steps.