Using staging sites on GridPane

7 min read

Multisite

Multisite staging isn't currently available, but it is planned for the future.

Introduction

GridPane includes the option to easily create a staging website for your primary website, and/or turn a staging website on or off at any point.

Inside your account you can push your live website to your staging site (or vice versa) anytime with just a few clicks.

About Staging Sites

Staging sites are an excellent way for you to develop and test a clone of your production website directly on your production server.

These are created with the popular “Force Login” plugin installed and active, so you won’t be able to view them without first signing in, and they also include the following rule to prevent search engines from indexing them and potentially causing duplicate content issues/penalties: 

X-Robots-Tag: noindex, nofollow, nosnippet, noimageindex

Please note that if you’re importing your website via a plugin and overwriting the database, then by default the force login plugin will no longer be active once the import has completed (unless you installed it on your site before migrating it in). This will also override the default login credentials.

Force Login Plugin

The Force Login plugin is active on all staging websites by default. If you want to turn it off, simply deactivate the plugin.

Staging and Backups

Previously when pushing from live to staging or vice versa for the first time, it required a backup of both your live site and your staging site if one didn’t already exist. This is no longer required, and is now taken care of automatically. If a backup fails, then the push process will cease to run, and exit. 

You also now have the option to skip taking a backup when pushing from Live -> Staging.

For Staging -> Live pushes, a backup is mandatory, and will automatically take place. 

Backups here are mandatory to prevent your sites being lost forever if you accidentally push the wrong way. The skip option above will only work when pushing to your staging sites, but please always proceed with caution, and run backups when you need to.

Pushing a Website from Staging > Live or Vice Versa

Making a staging push is quick and simple. This section will walk you through the process.

Note: Settings between sites will match

When pushing your site from Live to Staging or Staging to Live, the sites configuration settings will also be pushed to the destination site. This means that the process will: -

  • Clone all general customizer settings
  • Clone all security customizer settings
  • Clone all PHP settings
It's important to ensure that when pushing from Staging to Live, your caching, routing, security, and PHP settings are all what you want for your Live site.

Step 0.1 Create Your Staging Site

First, if it isn’t already, toggle on the staging site for your website.

Step 0.2 Preparation for Database Rewrites

You can reduce the time the search and replace operation takes by ensuring both the live and staging websites have an SSL certificate before the push begins, and ensuring that the routing (none/root/www) on the staging website is the same on the live site before you make the push.

If both domains have an SSL certificate before the swap/push, the system doesn’t need to check for HTTP/HTTPS URLs and can use a simpler compound regex.

You can learn more about GridPane search and replace functions in this article:

GridPane Database Rewrites and Workflow

Step 1. Open your Staging Site Customizer

Navigate to your staging page and locate your domain’s staging site. Click on your staging sites domain to open up the customizer.

If your staging site is brand new, first take a manual backup my clicking on the website name to open up the configuration modal, and then opening up the backups tab. Click “Backup Now”. If your staging site isn’t brand new, this may not be necessary.

Step 2. Choose your staging push option.

Click on the appropriate button for your push (live to staging or staging to live). Be sure to select the correct option so you don’t overwrite the wrong website. This will open up a modal as shown below.

Choose your staging push option from the dropdown and click the “Push Live to Staging” / “Push Staging to Live” button

Step 3. Choose your Push Settings

You have the ability to do partial database pushes. This requires you to select your database tables, so it’s only applicable if you know what specific database tables you want to replace. Please be careful with this option.

Partial Database Push Use Case Example

Use cases for this might be that you have a high traffic blog with lots of new comments, or a WooCommerce store with regular orders, and you need to do some development work on staging and then push it live. This is great if you know exactly which tables to push as it allows you to do your testing, confirm all’s good, and then push your changes live without overwriting any important data.

All Files No Database Use Case Example

If you’re on developer or higher, you also have the option to push all files but not touch the database. This can useful if you’ve been doing testing with different software or images etc on staging, but don’t want/need the data associated with the testing.

Database/Partial Database Only Use Case Example

Or push database changes only (full or partial) without pushing any theme, plugin or media library files. Great if you know exactly what you’re doing and just need to push some site tweaks that don’t require any files.

Choose the option that is correct for you, select your tables if applicable, and then click the Push button when you’re ready to proceed.

Step 4. Settings Check and Confirmation (Staging to Live Only)

When pushing from Staging to Live you will see the following checklist table:

This table lets you quickly view at a glance if any of your site’s caching, routing, security, and PHP settings don’t match between the current live site and the staging site. Please review them carefully and ensure that these are the settings that you desire for your production website.

If they aren’t, simply click the X in the top right to cancel, set the correct settings on your staging site, then repeat the above process and again and proceed with your staging push.

Wrapping Up

Once your push has completed you will see the following notifications and you can now check out the changes.

On completion, a full cache clear will take place on the new website so you should be able to see view the website correctly, without a pre-stored version showing in it’s place via the cache.

If your staging push failed, you can check your staging push log. This is located in the primary domain’s logs tab here:

This allows you to view the results of your push, and it will detail the reason it failed to go through:

Troubleshooting

Troubleshooting Tip 1

At the time of writing, our current backup system runs backups every hour on the hour. While this is running, staging pushes will not be able to take place. 

Our V2 backups system will remove this problem, but for now please note that if a push does fail and it’s near the hour, it may be because V1 backups are locked.

Troubleshooting tip 2

If you’re finding that your staging push is hanging (nothing’s happening), it may be due to your backup token being out-of-sync. Head to your servers page in your account and hit the refresh button under “Status” to sync things up, and then try your push again.

ManageWP

ManageWP (and potentially other plugins that have staging features) has issues when making staging pushes. If you have ManageWP on your website and the staging push isn’t working, you may see the following error in the staging log:

** (myloader:1692): CRITICAL **: 11:13:54.241: Error restoring Nui_staging_website_com.wp_options from file website_com.wp_options.sql: Duplicate entry 'mwp_communication_keys' for key 'wp_options.option_name'

Unfortunately, there is not an easy fix for this. Deactivating the plugin may be necessary for the push to proceed.

Staging sites and SendGrid

Note: SendGrid is not available on staging sites. It is available only on the production sites.