Skip to content

Going Live Start To Finish

Going live is hard at any host. Especially if its an existing site.  Every duck has to be in a row to minimize downtime and keep your store running.  This guide is intended to be an example and may not fit every case when moving to Mojo Stratus.  Contact MageMojo support with any specific questions.

Preparing Your Stratus Environment

Before any go-live, you should test a copy of your store for at least basic functionality.  If you are migrating a site yourself, also check out our existing migration policy and how migrations work.

Now to prep your environment, gather the following information if you do not already have it.

  • Magento version (1 vs 2)
  • PHP version at the current host

Next, set your Stratus environment to match the PHP version and Stratus template based on the table below. Note that PHP 5.6 and 7.0 are end of life.  The default configuration for new Stratus environments is our Magento 2 template with PHP 7.1

For details on how to make those changes see the PHP version and Stratus template articles.

Clear The Existing Install

All new Stratus environments have Magento 2 pre-installed with the document root at /srv/public_html/.  Before you can copy your site, you need to clear this data.

  • Delete everything in public_html/ with rm -rf /srv/public_html/
  • Using the database credentials from the MySQL -> Info section , drop and recreate the existing database via SSH in your Stratus environment. Substitute the appropriate creds in the example below.
    bash mysqladmin -h mysql -u user_ -pPASSWORD drop db_ mysqladmin -h mysql -u user_ -pASSWORD create db_

Now you are ready to move your own files and database into the Stratus environment.

Copying Your Site

Copying your site over requires SSH access to your current host. Make sure that is available and working from your Stratus environment. Confirm by logging into your Stratus environment through SSH and connecting:

ssh myuser@mycurrenthost.com

If you can connect, great! You might have custom ports or even require a key, leading to these variants of the SSH command.

#with key
ssh -i /path/to/keyfile myuser@mycurrenthost.com
#with custom port
ssh -p 1234 myuser@mycurrenthost.com

With SSH access in hand, you should connect to your current host and create a database backup.  The popular n98 tools make this easy, you can download them to your current host in .phar format and run the db:dump commands (see below).  To grab the tools check out the Magento 1 and Magento 2 versions.  Put the dump file somewhere restricted from web access. Within the Magento doc root inside app/etc/ is a good place.

#example database dump commands
mysqldump -uUSERNAME -pPASSWORD databasename > migrate.sql
#with n98
n98-magerun db:dump migrate.sql

Now you can copy your files and database dump over to Mojo Stratus.  The easiest way is with rsync.  Rsync is installed in all Stratus environments and most Linux environments everywhere.

From SSH in your Stratus environment, do the following:

  1. Go to your document root, in this case public_html/
  2. Run the command
rsync -avz -e ssh myuser@mycurrenthost:/path/to/webroot/ .

If you have a custom port or ssh key, you need additional quotes around the SSH command

bash rsync -avz -e "ssh -p 1234" myuser@mycurrenthost.com:/path/to/webroot/ .

  1. The copy will begin.  If you have a lot of media and/or a large database this will take a long time.  Output will stream onto your terminal screen.

Initial Magento Configuration

If the files and database dump transfer are complete, you can start configuring Magento within your Stratus environment.

Database Config

First, update local.xml (Magento 1) or env.php (Magento 2) in app/etc with the proper database credentials from the MySQL -> Info section of the management panel.  Make sure to set the hostname to mysql, on many other environments the hostname is just localhost and left as the default!

In Magento 1 you would see:

<resources>
           <db>
               <table_prefix><![CDATA[]]></table_prefix>
           </db>
           <default_setup>
               <connection>
                   <host><![CDATA[localhost]]></host>
                   <username><![CDATA[USERNAME]]></username>
                   <password><![CDATA[PASSWORD]]></password>
                   <dbname><![CDATA[DATABASENAME]]></dbname>
                   <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                   <model><![CDATA[mysql4]]></model>
                   <type><![CDATA[pdo_mysql]]></type>
                   <pdoType><![CDATA[]]></pdoType>
                   <active>1</active>
               </connection>
           </default_setup>
       </resources>
In Magento 2 that block looks like this:
<? php
'db' => [
    'table_prefix' => '',
    'connection' => [
        'default' => [
            'host' => 'mysql',
            'dbname' => 'DATABASENAME',
            'username' => 'USERNAME',
            'password' => 'PASSWORD',
            'model' => 'mysql4',
            'engine' => 'innodb',
            'initStatements' => 'SET NAMES utf8;',
            'active' => '1'
        ]
    ]
],
?>

Import The Database

n98-magerun, once again, provides the perfect tool for importing a database.  Do that with the built-in  db:import  command.

#from your Magento document or web root
#magento 1
n98-magerun db:import app/etc/mydump.sql
#magento 2
n98-magerun2 db:import app/etc/mydump.sql

The pv utility shows the progress while the import completes.

Cache Configuration

Next enable Redis cache for Magento 1 or 2 per our guide.

Confirm Redis is enabled via the  n98-magerun sys:info  command (or n98-magerun2). On the Cache Backend line you will see:

| Cache Backend    | Cm_Cache_Backend_Redis

Session Configuration

We recommend using memcache for your sessions. As with the cache, you can enable it via the Magento configuration file and confirm with n98, see our Stratus memcache article.

Update Base URLs

The base URLs control the domain Magento servers your store on.  There may be several different base URLs if you are operating a multi-store.  The example here is for a simple store with only one core view and a single domain in the base URLs.

You can test your site with the pre-configured and include mojostratus.io subdomain.  That domain is always the UUID of your Stratus environment. And the UUID is a longer string of random letters and numbers similar to a hash.

See our how-tos on updating base URLs for Magento 1 and Magento 2.

Make sure to use the proper mojostratus.io subdomain. If you prefer you can use your own sub-domain for testing.  For setting up your own domain for testing, read these guides:

Testing

You should see the frontend of your store on a temporary domain at this point. If not, please review the previous steps and configuration.  Otherwise, you can test your site.  Our general recommendation is to look at as much as you can and work on the site as you would on production, especially backend work.  Doing your day to day on the test copy should show any obvious errors that could stop you from going live.

Check things such as:

  • Homepage
  • Product pages
  • Category pages
  • Add to cart functionality
  • Logging into the backend
  • Any special modules you use
  • Imports/exports
  • Cron configuration

If something does not work, hopefully it gives you an explicit on-screen error. If not check:

  • Chrome console for error output
  • Magento logs
  • Error logs for Nginx in /log/error.log
  • PHP error logs in /log/php-fpm/
  • Check with MageMojo Support if all else fails

Preparing For Going Live

Switch Nameservers Ahead

The time delay for DNS propagation can be up to 24 hours. A popular solution to the propagation problem is to set all records to very low TTL.  However, not all ISPs and network care what your TTL is and may ignore it.

When switching to Stratus, you have a few options laid out in our DNS guide.  Here we are assuming you are switching all your domains to use Route 53 through the Stratus Management panel.

When switching to Route 53, we recommend switching your nameservers ahead of time.  Then propagation is not an issue at all as all nameservers available will point to your current host.  To switch nameservers, follow these steps:

  1. Get the current IP or IPs for each domain at your current host.  You may have to contact your current host’s support.  Likely the IP can be obtained via DNS/dig query.
  2. Open the DNS section of your Stratus Management panel.  Select a zone from the list.  You will switch the nameservers for this zone.
  3. At the top of the zone, there is an option to switch the endpoint from CloudFront to a Custom IP point ahead-56

  4. Click the Custom IP bubble and enter the IP addressed used by your domain at the current host.

  5. Click Update near the bottom right to apply the change.
  6. At your domain’s registrar (typically where you bought the domain) change the nameservers for your domain to the 4 listed at the top of the zone.
  7. Make sure to update any records for www, and other sub-domains to point back to your current host in the rest of the zone file!
  8. Repeat previous steps for every domain in your Stratus environment

Now wait 24 hours to allow the nameserver change to propagation.

Other Preparation

Your store may have a lot of extra integrations, frameworks, and custom code to account for outside the scope of this guide.  Consider the list below but keep in mind the devil is always in the details!

  • Check all your DNS zones for any custom records that link to websites maintained at other hosts (subdomains etc) or custom TXT/SRV records for validation
  • Check all cron jobs are configured under the Cron Management area needed for your store, including any custom jobs from your current host.
  • Verify any non-Magento code/frameworks are working as expected (namely WordPress!)
  • If you are a developer or other technical contact moving a site for a merchant, make sure the merchant and any other parties know you will be moving the site!

Going Live

The big day is here, follow these steps to complete your transfer to Mojo Stratus.

  1. Place your Magento store at your current host into maintenance mode to prevent further orders. Failure to do so can cause a split DB situation where you have the same order numbers in two different databases and the orders themselves are different.  See Magento Maintenance
  2. In the DNS zones listed under the DNS section, adjust all the zones to point to the CloudFront endpoint instead of your current host, if you chose to switch the nameservers ahead. Otherwise, you must switch the nameservers now.
  3. Similar to the  Copying your site  section, re-copy your store database over to Mojo Stratus and any updated files.  Make sure to drop the existing database first, then re-import it.  Don’t overwrite your updated configuration files or you’ll have to re-do them.
mysqladmin -h mysql -u user_ -pPASSWORD drop db_
mysqladmin -h mysql -u user_ -pASSWORD create db_
  1. Go to the URLs area of the Stratus management panel.  Make sure all the domains listed match the domains you are moving, including their www. form i.e. mysite.com and www.mysite.com, see Stratus URLs List and Domains
  2. Waiting 15-30 minutes after updating the URLs list.  That list controls the domains in your CloudFront distribution and the domains sent for Lets Encrypt validation. During that update a Lets Encrypt certificate will be generated and applied.
  3. Adjust your multi-store configuration to match the live domains.
  4. Disable maintenance mode on the Stratus side, do not disable maintenance mode on your old host
  5. Verify your site loads, you are live!

Troubleshooting And Final Check

  • Repeat the initial testing for basic store functionality
  • Test the checkout
  • Check all caches and performance settings, review Magento Performance FAQ
  • Contact MageMojo Support if things get hairy!