I needed to create a Magento Staging Area for both common development tasks and testing the latest upgrades.
In order to create the staging area for my Magento store I’m going to create a mirror of it at a subdomain. I host on my own Linux server and use Godaddy to manage my domains.
My main Web site will be referred to as www.domain.com. I’ll be creating the Magento development site at dev.domain.com. Below is a step by step documentation of the steps taken to create my Magento staging area using virtual host.
Create CNAME Record:
=> login to Godaddy
=> select Domains : My Domains
=> select your domain (domain.com)
=> select Total DNS Control and MX Records
=> select Add New CNAME Record
=> enter (dev) as Alias Name
=> enter (domain.com) as Host Name
Create Staging Files:
=> copy live file directory to dev
=> run cp -R store.domain.com dev.domain.com
Create Staging Database:
=> create new Dev database
=> dump Production database
=> mysqldump –opt –user=liveuser –pass=livepass livedbname > livedbname.sql
=> load Staging database
=> mysql -u devuser -p devdbname < livedbname.sql
Setup Virtual Host in Apache:
=> locate conf file (ie httpd.conf, vhosts.conf)
=> create VirtualHost entry for dev.domain.com
=> locate apachectl
=> run ./apachectl configtest
=> run ./apachectl restart
Sync Staging Site DB Credentials:
=> editapp/etc/local.xml
=> edit lines
=> edit lines
=> edit lines
Sync Staging Site Database Settings:
=> login to MySQL dev database
=> find config to edit
=> SELECT * FROM `core_config_data` WHERE `path` LIKE ‘%base_url%’;
=> update path web/unsecure/base_url
=> update path web/secure/base_url
Cleanup Staging Site:
=> rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
=> rm -rf var/cache/* var/session/*
It might take a while to shake out the cache, but that should basically get you a Magento staging server — a snapshot of your live Magento site.
** Note: I pulled my hair out for hours trying to figure out why the dev url was not printing correctly. It just seemed that whatever I did the system wouldn’t pick up the new base_urls. What I did was restart apache which I’m assuming cleared cache and allowed for the update base_url to be picked up. Also, make sure var directory is writable.
4 Responses
Jools
March 29th, 2009 at 8:57 am
1I have published information with an alternative solution that means you don’t have to update the base_urls for the staging site.
http://maglife.co.uk/2009/03/28/magento-base-urls-and-devstaging-installations/
Tacitus
January 14th, 2010 at 12:25 am
2…great solution! Thanks a lot! …BUT, don´t forget to modify your .htaccess file (-> RewriteBase) when you use mod_rewrite!
Sean
February 6th, 2010 at 12:21 pm
3Thanks for the article. I have a quick question on it though. At the very end of the article you mentioned that you ” pulled my hair out for hours trying to figure out why the dev url was not printing correctly”. When you say “printing correctly” what does that mean. Did that mean the pages pulled up fine but that the URL in the browser was wrong? Or was it that you couldn’t pull of the correct pages even with the right URL in the browser?
Thx
ed
February 8th, 2010 at 9:44 am
4Sean, what I think I meant was that Magento was not using the new dev url as the base url. It was stuck on using the production full url. So for instance, I could see the site at dev.store.com, but the category/page links were still using the production url.
RSS feed for comments on this post · TrackBack URI
Leave a reply
Categories
Archives
Clients and Projects
Recently Written
Calendar
Recent Entries
Recent Comments
Most Commented
Kliky.Net - Web Development Blog is proudly powered by WordPress - BloggingPro theme by: Design Disease