Difference between revisions of "Installing Magento Extensions : Pre-install Checklist"

From Moogento How-to Guides
Jump to navigation Jump to search
m
m
Line 6: Line 6:
 
# '''Backup your database'''
 
# '''Backup your database'''
 
#* eg. using Magento's built-in backup system:
 
#* eg. using Magento's built-in backup system:
#** Head to {{menu3|Syetem|Tools|Backups}}, and {{keypress_orange|Create Backup|_no_x}}
+
#** Head to {{menu3|System|Tools|Backups}} and click {{keypress_orange|Database Backup|_no_x}}
 +
#:: ''You'll see a popup option to 'Put store in Maintenance Mode?' : this will show the '''Magento Maintenance Page''' to site visitors. See section below for pros/cons.
 
#* eg. using the '''command line''' (changing <code>[bracketed words]</code> to match your setup):
 
#* eg. using the '''command line''' (changing <code>[bracketed words]</code> to match your setup):
 
#** Make a backup of your database: <code>mysqldump -u [database user] -p [database name] > db_backup_[todays date].sql</code>
 
#** Make a backup of your database: <code>mysqldump -u [database user] -p [database name] > db_backup_[todays date].sql</code>
Line 20: Line 21:
 
#* if you're not sure if you have this turned on, check {{menu3|System|Tools|Compilation}}[[File:Compilation_off.png|link=|500px]]
 
#* if you're not sure if you have this turned on, check {{menu3|System|Tools|Compilation}}[[File:Compilation_off.png|link=|500px]]
  
 +
==Maintenance Mode?==
 +
===What is it?===
 +
* Magento has a built-in system to turn off the website frontend for visitors, and still allow admin access to the backend.
 +
===How to turn it on===
 +
* Just create an empty file in your Magento root with the filename {{folder|maintenance.flag}}
 +
*:: ''Delete that file to turn off the Maintenance Mode.''
 +
* Before you do turn it on, make sure your Maintenance Page:
 +
** Is styled for your store.
 +
** Explains what is happening.
 +
** Gives a timeframe for completion.
 +
** Has a contact email/phone number.
 +
===Why would we do this?===
 +
====Pros====
 +
You're about to backup the database:
 +
* If there is any customer activity between making the backup and potentially restoring it, you'll lose that activity.
 +
* This could include new orders. If they are then issued an Order/Invoice ID, you then turn on the store and another customer makes an order (before you can manually enter the new order(s), then multiple people will have the same Order/Invoice ID, which can make accountants anxious, and customer support tricky.
 +
* If your new extension involves database activity in the setup, if an order comes in halfway through, you could potentially include inconsistencies into the database.
 +
====Cons====
 +
* Your site is temporarily 'closed for business' and you may lose customers (if they don't come back later).
 +
* It's harder for you to test any frontend changes that the new extension has made (as the frontend will also be locked out to you).
 +
** To enable frontend access for yourself (while still showing the Maintenance Page to other visitors) edit the {{folder|index.php}} file:
 +
:: Change :
 +
<pre>
 +
if (file_exists($maintenanceFile)) {
 +
    include_once dirname(__FILE__) . '/errors/503.php';
 +
    exit;
 +
}
 +
</pre>
 +
:: To :
 +
<pre>
 +
$this_ip = $_SERVER['REMOTE_ADDR'];
 +
$allowed_ips = array('127.0.0.1','111.22.33.44');
 +
if (file_exists($maintenanceFile) && !in_array($this_ip, $allowed_ips)) {
 +
    include_once dirname(__FILE__) . '/errors/503.php';
 +
    exit;
 +
}
 +
</pre>
 +
:: *''Edit the <code>$allowed_ips</code> section to match your own local IPs.''
 +
:: *''To show a custom Maintenance Page (recommended) change <code>503.php</code> to eg. <code>maintenance.php</code>, and then create that custom file.''
 
[[Category:Extension installation]]
 
[[Category:Extension installation]]

Revision as of 06:11, 28 April 2014

We spend a lot of time testing our extensions on fresh installs of Magento. However, there are a lot of different ways to setup, customize, and add-on to Magento, which can cause new issues - please follow this checklist before starting your install, to safeguard your site.

Each of these steps are important, don't be tempted to skip!

  • You should do this before *every* extension install (not just ours!).
  1. Backup your database
    • eg. using Magento's built-in backup system:
      • Head to SystemToolsBackups and click Database Backup
    You'll see a popup option to 'Put store in Maintenance Mode?' : this will show the Magento Maintenance Page to site visitors. See section below for pros/cons.
    • eg. using the command line (changing [bracketed words] to match your setup):
      • Make a backup of your database: mysqldump -u [database user] -p [database name] > db_backup_[todays date].sql
      • Restore from backup: mysql -u [database user] -p [database name] < db_backup_[todays date].sql
    • eg. using phypMyAdmin:
      • Export/Import your Magento database
    Make sure you "Disable Foreign Key Constraints".
    • With either method, test that you can restore a backup (eg. to a test blank db) before starting!
  2. Backup your app folder
    • This is the fastest way to fully revert if you need to.
    • Easiest to put it next to your current app folder (e.g. app_bkp), that way you only need to rename the two folders to revert.magento app backup.png
  3. If you have compilation enabled for your site, disable it
    • if you're not sure if you have this turned on, check SystemToolsCompilationCompilation off.png

Maintenance Mode?

What is it?

  • Magento has a built-in system to turn off the website frontend for visitors, and still allow admin access to the backend.

How to turn it on

  • Just create an empty file in your Magento root with the filename maintenance.flag
    Delete that file to turn off the Maintenance Mode.
  • Before you do turn it on, make sure your Maintenance Page:
    • Is styled for your store.
    • Explains what is happening.
    • Gives a timeframe for completion.
    • Has a contact email/phone number.

Why would we do this?

Pros

You're about to backup the database:

  • If there is any customer activity between making the backup and potentially restoring it, you'll lose that activity.
  • This could include new orders. If they are then issued an Order/Invoice ID, you then turn on the store and another customer makes an order (before you can manually enter the new order(s), then multiple people will have the same Order/Invoice ID, which can make accountants anxious, and customer support tricky.
  • If your new extension involves database activity in the setup, if an order comes in halfway through, you could potentially include inconsistencies into the database.

Cons

  • Your site is temporarily 'closed for business' and you may lose customers (if they don't come back later).
  • It's harder for you to test any frontend changes that the new extension has made (as the frontend will also be locked out to you).
    • To enable frontend access for yourself (while still showing the Maintenance Page to other visitors) edit the index.php file:
Change :
if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}
To :
$this_ip = $_SERVER['REMOTE_ADDR'];
$allowed_ips = array('127.0.0.1','111.22.33.44');
if (file_exists($maintenanceFile) && !in_array($this_ip, $allowed_ips)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}
*Edit the $allowed_ips section to match your own local IPs.
*To show a custom Maintenance Page (recommended) change 503.php to eg. maintenance.php, and then create that custom file.