berth

Apps and software

Staging copies and pushing to live

Make a shielded staging copy of a WordPress, Joomla, Drupal or Nextcloud site, test changes there, and push chosen files and tables back to live with a preview and a backup first.

Updated 5 min readstaging · wordpress · joomla · drupal · nextcloud · push to live · test siteView as Markdown

On this page
  1. What a staging copy is
  2. Create a staging copy
  3. Push a WordPress copy to live
  4. Push a Joomla or Drupal copy to live
  5. Why Nextcloud copies cannot be pushed to live
  6. Remove a staging copy
  7. Staging, duplicates and smart updates

A staging copy is a second version of a site on another address, with its own database, where you try updates, a new theme or a plugin without risk. When you are happy, you push the changes back to the live site. Berth makes staging copies for WordPress, Joomla, Drupal and Nextcloud and shields them from search engines and the outside world; for WordPress it also replaces personal data with fake data by default.

What a staging copy is

  • It lives on another domain in the same subscription, by default staging.<domain>, with its own database.
  • It is behind a password, marked noindex for search engines, and its outgoing mail is caught in the domain's mail catcher instead of being delivered (Nextcloud copies send no mail at all).
  • For WordPress, personal data is anonymised by default: customers, commenters and orders are replaced by fake data, while administrator accounts stay so you can log in. Tick Keep real personal data only when you really need it, for example to reproduce a bug with a specific order. Joomla, Drupal and Nextcloud copies keep the data of live, shielded by the password.
  • Making it again refreshes it from live.

The copy counts towards the subscription's disk space. For WordPress the panel rewrites the site's addresses in the database; Joomla and Drupal mostly use relative links, and absolute links to the live address in content stay as they are.

ApplicationCreate and refreshPush to live
WordPressyesfiles and/or database, with a choice of tables and file parts
Joomlayesfiles and/or database
Drupalyesfiles and/or database
Nextcloudyes, including a copy of the data folderno, by design
Matomonono

Create a staging copy

WordPress: on the WordPress page of the domain, section Staging and copy:

  1. Optionally enter the domain of the copy; empty means staging.example.com.
  2. Under Options you can choose Without password or Allow sending mail.
  3. Click Create staging copy, or Create or refresh staging copy when one exists.

The password of the copy is shown once. If the staging name does not resolve yet, add a preview address so the copy works without a DNS record.

berth wp staging create --domain example.com
berth wp staging create --domain example.com --target test.example.com --preview
berth wp staging create --domain example.com --keep-personal-data --allow-mail --no-protect

Joomla, Drupal and Nextcloud have the same function on their own pages, and on the command line:

berth joomla staging --domain example.nl
berth drupal staging --domain example.org --target staging.example.org
berth nextcloud staging --domain cloud.example.com

A Nextcloud copy gets its own database and its own copy of the data folder (the users' files), with the configuration pointing to both.

Push a WordPress copy to live

On the copy's WordPress page, choose Choose and push to live…. You decide exactly what goes over; everything you do not choose stays on live as it is.

  1. Preview. The page shows which tables differ or are new on staging, and which files are new, changed or gone, per part.
  2. Files. Choose the parts to push: themes, plugins, uploads and/or core. Within a chosen part, files that exist on live but not on staging disappear from live. wp-config.php of live always stays.
  3. Database. Push all tables, none, or only the ones you tick. Chosen tables replace the same tables on live; other tables on live are untouched. The panel warns when you pick tables that belong together only partly (for example posts without their meta).
  4. Confirm by typing the name of the live site, then Push to live.

Before anything is changed, the panel makes a backup of the subscription, which you can restore under Backups if needed.

berth wp staging preview --domain staging.example.com
berth wp staging publish --domain staging.example.com --files --part themes --part plugins --confirm example.com
berth wp staging publish --domain staging.example.com --database --table wp_posts --table wp_postmeta --confirm example.com

Anonymised copies and live

When the copy's database is anonymised, the tables with personal data, the options and the posts contain fake data. Those tables cannot be pushed to live; the page disables them. Everything else can. To push all tables, refresh the copy with real personal data first.

Push a Joomla or Drupal copy to live

For Joomla and Drupal you push the files and/or the whole database, with a backup first. The configuration file of live (configuration.php for Joomla, settings.php for Drupal) always stays.

berth joomla staging-publish --domain staging.example.nl --files --database
berth drupal staging-publish --domain staging.example.org --files

Why Nextcloud copies cannot be pushed to live

A Nextcloud database and its data folder belong together, and users keep changing both on live: new files, shares, calendar entries. Pushing a copy back would overwrite or orphan that work. Use the copy to try an upgrade or a new app, then do the same on live.

Remove a staging copy

Removing a copy deletes its domain, webspace and database. For WordPress you confirm on the command line with the name of the copy; for Joomla, Drupal and Nextcloud --domain names the copy:

berth wp staging remove --domain staging.example.com --confirm staging.example.com
berth joomla staging-remove --domain staging.example.nl
berth nextcloud staging-remove --domain staging.cloud.example.com

Staging, duplicates and smart updates

  • A staging copy stays linked to its live site and can be pushed back.
  • A duplicate is an independent copy on another domain, for example to start a new site from an existing one; see Software installer.
  • A smart update makes its own short-lived copy on berth-update.<domain> to test an update, and removes it afterwards. You do not need a staging copy for that.

For copies of a single database without personal data, for example to hand to a developer, see the anonymised copy in Databases.