@@PRODUCT@@

A staging copy of an application

A staging copy is a complete second version of your site at its own address, where you can try things without your visitors noticing. A new theme, an extension you do not trust, a different layout for your shop: you try it on the copy first

Written for: Customer, Reseller, Administrator

A staging copy is a complete second version of your site at its own address, where you can try things without your visitors noticing. A new theme, an extension you do not trust, a different layout for your shop: you try it on the copy first. If you like it, one button sends it to the real site. It works for Joomla, OpenCart, phpBB, Drupal, MediaWiki and Matomo.

Making the copy

Open Applications, click the application and choose Staging maken (Make staging copy). CoreCP puts the copy on staging. followed by your site's name, for example staging.example.nl. That address is created with its own certificate, so it simply works on https://. The copy gets its own files and its own database: what you do on it does not touch your real site.

As soon as the copy is ready, its address is on the application's card, with the password. You see that password once. CoreCP stores it nowhere; write it down before you close the window. If you lose it, remove the staging copy and make a new one.

Hidden, and behind a password

A copy of your site must never turn up in search results beside the original. So the staging copy is closed in three ways:

  • every answer from the copy tells search engines not to list the page;
  • the copy has a robots.txt that refuses everything;
  • the whole copy sits behind a password. The user name is staging; the browser asks for it with "Staging copy of" and the name of your site.

That also keeps visitors and bots from landing on it by accident. Note that the application's scheduled tasks, such as a shop sending e-mail, keep running on the copy. The password is the lock on that, so do not give it to customers.

Working on the copy

Sign in on the copy as you do on your real site, with the same users and passwords as at the moment of copying. Change what you want to change. The copy is an application in its own right: it has its own card, its own restore points and its own updates.

Sending it live

Happy with it? On the live application's card choose Naar live zetten (Send to live). The window says up front what will happen:

  1. CoreCP first makes a restore point of your live site, so you can go back.
  2. Only the changed files go to the live site. What the live site gained in the meantime, such as uploaded photos, stays.
  3. The copy's database goes onto the live site, except the content: orders, customers, users, posts and the other things your visitors keep adding. Those stay as they are on the live site, because otherwise you would lose everything that came in while you worked on the copy. Settings, menus, themes and extensions do go across.
  4. The copy's address is replaced by your real site's again.

Overwriting the content too

If you want the content to go across as well, switch on Ook inhoud overschrijven (Also overwrite content). The warning in the window says it exactly: the orders, users and posts on the live site are replaced by those of the copy. Everything added to the live site since you made the copy is gone afterwards. Only do this when the copy has the latest state.

CoreCP does not put the live site in maintenance mode while it sends the copy live. The database is taken over in one go.

Back, if it goes wrong

If something goes wrong while sending live, CoreCP puts your live site back from the restore point of just before, files and database, and says so. The staging copy stays as it was. The card shows "mislukt, live is teruggezet" (failed, live restored) for the last push.

If it goes fine but you do not like the result, the restore point is on the live application's Logboek (Log) tab, with the reason "push". Choose Terugzetten (Restore) next to it to put the live site back to how it was before. What changed on the live site afterwards, new orders and posts, is then gone; read Making and downloading restore points of applications for the details.

Refreshing the copy

There is always one copy per application. Has the live site changed and do you want the copy fresh again? Remove the copy and make a new one, or refresh it from the terminal with corectl app stage <application> --replace on: CoreCP then first makes a restore point of the copy and builds it again from the live site.

Removing the staging copy

When you are done with the copy, choose Staging verwijderen (Remove staging copy). You type the copy's name to confirm. Afterwards the copy's files, its database and its database user are gone. The address goes too if CoreCP created it for the copy; if you already had that address before you made the copy, it stays, without the copy, the password and the ban for search engines. The live site does not change.

Which applications can

A staging copy can be made of Joomla, OpenCart, phpBB, Drupal, MediaWiki and Matomo. For the other applications the card says why not:

  • WordPress has its own way: the WordPress screen has a staging tab. See Making a test environment.
  • Nextcloud and Laravel do not: with Nextcloud your users' files and shared links would exist twice, and the copy would keep syncing them. A Laravel application is managed by you and has no fixed shape CoreCP could copy.
  • Moodle not yet: it consists of several directories that have to be copied together. That comes later.

CoreCP cannot adjust a database table without a key to the new address; if your application has one, the result names that table.

From the terminal

$ corectl app stage joomla:example.nl/site
$ corectl app push joomla:example.nl/site
$ corectl app push joomla:example.nl/site --content on
$ corectl app unstage joomla:example.nl/site

See also Making a test environment (WordPress) and Removing an application.