Knowledgebase: Magento
Set Up a Magento Staging Area
Posted by CTX Admin on 21 October 2014 05:38 PM

The best way to test out a new Magento release without potentially destroying your production store is to setup a staging area.

A staging area is a duplicate of your primary store that you can use to see if the upgrade process will go smoothly, and also allow you to use both the frontend and backend of your site to see if everything is running properly.

This article is written with our customers in mind, but the principles will apply no matter where you are hosted or what control panel you're using.

Create Staging Sub-domain

The first thing we want to do is set up a sub-domain for our staging store:

  1. Log in to cPanel for your domain

  2. Click the Sub Domains icon

  3. For both the Sub Domain and Document Root, enter staging

  4. Click the Create button

Create Staging Database

While we're still in cPanel, set up a blank database for our staging store:

  1. Go back to the main screen for cPanel and click on the MySQL Database Wizard icon

  2. For the New Database, we'll enter staging

  3. Click the Next Step button

  4. For the Username enter staging and for the Password enter whatever you'd like

  5. Click the Next Step button

  6. Click the box next to ALL PRIVILEGES

  7. Click the Next Step button

Copy Production Store

Now that the sub-domain and database have been setup copy the production store over to the sub domain directory:

  1. Log in to SSH for your domain, and change to the staging folder:

    cd staging/

  2. Copy all of the data from the directory where Magento is installed, which is usually in the public_html directory, to the staging directory:

    cp -R ../public_html/* ../public_html/.htaccess .

    Note: for the next step, you'll need to know the database information for the production store. If you don't remember this, open up the following file:

    app/etc/local.xml

    Lines 43-46 will contain your hostname, username, password, and database name.

  3. Copy the data from the production database over to the staging database, via SSH:

    mysqldump -u PRODUCTION_DBUSER -p PRODUCTION_DBNAME > data.sql

  4. When prompted, enter the password for the user that has privileges to the production database and press the Enter key

    This can take a couple seconds to a couple minutes depending on the size of your database, so just wait until it finishes.

  5. Once it finishes import this data to our staging database:

    mysql -u STAGING_DBUSER -p STAGING_DBNAME < data.sql

  6. When you're prompted to enter a password enter it for the user who has privileges for the staging database

Update Configuration

  1. Using your favorite text editor open up the following file from the staging directory:

    app/etc/local.xml

  2. Replace the values for lines 44-46 with the database details for our staging database

  3. Start updating the Unsecure and Secure URL for our staging store by logging in to cPanel for your domain

  4. Navigate to and click the phpMyAdmin icon

  5. From the left-hand sidebar click on  _staging link

  6. Click on the SQL tab, and in the text area, run the following command:

    SELECT * FROM `core_config_data` WHERE `path` LIKE '%base_url%';

  7. Click the Check All link and then click on the pencil icon.

  8. Update the value fields with the URL for your staging site.

  9. Click on the Go button at the very bottom to save your changes.

Upgrade Staging Store

Check out our Upgrade Magento via SSH article for instructions on how to upgrade Magento.

After You Upgrade

After you upgrade your store, don't assume everything is working correctly because your site is coming up without errors. Use this time wisely to go through your entire site, including the backend:

  • If your navigation has dropdown items, make sure they work

  • Search for a product to see if anything comes up in the results

  • Make sure you can add a product to your cart and purchase it

  • Check if your layered navigation is intact

  • Create or edit an existing product, making sure you can save it

If you do come across any errors, check the community forum to see if others are experiencing the same issue.

If you can't find anything, create a new thread to see if anyone can assist you.

It's also a good idea to search the bug tracker. You can even help by submitting a new bug if you don't find anything.

(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
Help Desk Software by Kayako fusion