Skip to content

Going Live on Stratus

The process of taking a store in development into a live, production state can go quite smoothly if properly prepared and if an ideal launch process is followed.

The following is a typical, example launch sequence on a Stratus instance based on a an existing Magento store that is migrated to Stratus.

Each store is unique and may require slight variations from the sequence shown. Developers may contact MageMojo support for assistance. MageMojo provides free migration to a new Stratus instance. Consult our existing migration policy and how migrations work.

Prepare the Stratus Environment

Before any go-live, test a copy of the store for all functionality.

  1. Gather the following information:

  2. Magento version (1 vs 2)

  3. PHP version at the current host

  4. Set the Stratus PHP Version and Stratus Template for the intended installation.

Clear the Existing Install

All new Stratus environments have Magento 2 pre-installed with the document root at /srv/public_html/. Before copying a site, clear this data.

  1. Delete everything in public_html/: run rm -rf /srv/public_html/.
  2. Using the database credentials, drop and recreate the existing Stratus database via SSH.
    mysqladmin -h mysql -u USERNAME -pPASSWORD drop db_
    mysqladmin -h mysql -u USERNAME -pPASSWORD create db_
    

Copy the Site

Copying a site requires SSH access to the current host.

  1. Connect to the Stratus instance via SSH.
  2. Once connected, log into the existing Magento server:

    ssh myuser@mycurrenthost.com
    

    Some SSH logins may require slightly different SSH commands:

    #with key
    ssh -i /path/to/keyfile myuser@mycurrenthost.com
    #with custom port
    ssh -p 1234 myuser@mycurrenthost.com
    
  3. Create a backup of the current database.

    To install the n98 commands, access the GitHub for Magento 1 or Magento 2, as needed.

    #example database dump commands
    mysqldump -uUSERNAME -pPASSWORD databasename > migrate.sql
    #with n98
    n98-magerun db:dump migrate.sql
    
  4. Copy the files and database dump to Stratus.

  5. From SSH in your Stratus environment, go to the document root (e.g. public_html/).

  6. Run rsync -avz -e ssh myuser@mycurrenthost:/path/to/webroot/ .

    If there is a custom port or ssh key, additional quotes around the SSH command are needed: rsync -avz -e "ssh -p 1234" myuser@mycurrenthost.com:/path/to/webroot/ .

The copy will begin. A lot of media and/or a large database will take a more time. Output will stream onto the terminal screen.

Initial Magento Configuration

Once the files and database dump transfer are complete, configure Magento within the Stratus environment.

  1. Update local.xml (Magento 1) or env.php (Magento 2) in app/etc with the proper database credentials from the MySQL -> Info panel of the Stratus Management Control. Set the hostname to "mysql" (in contrast, many other systems have the hostname set as "localhost").

    • Magento 1 example local.xml file:

      <resources>
                 <db>
                     <table_prefix><![CDATA[]]></table_prefix>
                 </db>
                 <default_setup>
                     <connection>
                         <host><![CDATA[mysql]]></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>
      
    • Magento 2 example env.php file:

      <? php
      'db' => [
          'table_prefix' => '',
          'connection' => [
              'default' => [
                  'host' => 'mysql',
                  'dbname' => 'DATABASENAME',
                  'username' => 'USERNAME',
                  'password' => 'PASSWORD',
                  'model' => 'mysql4',
                  'engine' => 'innodb',
                  'initStatements' => 'SET NAMES utf8;',
                  'active' => '1'
              ]
          ]
      ],
      ?>
      
  2. Import the database using n98-magerun[2]

    bash
    #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 and Sessions Configuration

Next enable Redis cache. The Redis > Full Page Cache panel will indicate the status of the Redis cache. Redis can also be used for sessions cache.

Update Base URLs

For testing prior to launch, set the Base URL of the new Magento store to the pre-configured and included mojostratus.io domain found in the Urls control panel.

At launch, this Base URL will be replaced with the domain(s) of the Magento store(s) to be served.

Test the New Install

Before taking a new install "live," all functions, pages, and administrative tasks should be thoroughly checked. Add-ons and customizations should particularly be reviewed and tested.

Testing should include:

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

If testing reveals errors, check:

  • Chrome Web Inspector Console for errors and descriptions
  • Magento logs
  • Error logs for Nginx in /log/error.log
  • PHP error logs in /log/php-fpm/

Check with MageMojo Support if needed for further assistance.

Pre-Launch Preparations

Switch Nameservers

Since Domain Name Server (DNS) propagation can take up to 24 hours, it can be prudent to set any relevant DNS records to a very short Time-to-Live (TTL), if allowed by the DNS server host.

For complete instructions on DNS settings, see our DNS guide.

When switching to Route 53, it is recommended that the nameserver switch be made well ahead of time, as the nameserver propagation takes the longest to complete.

  1. Get the current IP or IPs for each domain at your current DNS host.
  2. Go to DNS in the Stratus sidebar menu.

    point ahead-56

  3. Select the appropriate DNS zone in the list shown. If none is showing, create a new zone.

    • Select Custom IP in the IP section.
    • Enter the current IP for the domain as it is currently hosted.
  4. Add any additional DNS records, such as www or mailserver domains.
  5. Click Update to save the changes.

The step changes the nameservers at the domain registrar. The domain registrar is where the domain is registered, such as GoDaddy or Google Domains. It may not be the same provider as the DNS host.

Update the nameservers at the domain registrar. Use all four nameserver values shown at the top of the DNS control panel (in green).

Repeat this process for any other domains which will be used with the new store.

DNS management can be complicated. If you are unfamiliar with domain name management or have any questions, please contact MageMojo Support.

Other Preparations

A store may have a extra integrations, frameworks, and custom code to account for outside the scope of this guide. Use the following list as an initial guide for reviewing your store configuration.

  • Check all DNS zones for any custom records that link to websites maintained at other hosts (subdomains etc) or custom TXT/SRV records for validation. These DNS records will need to be copied to the Stratus DNS when using the Stratus Route 53 DNS system.
  • Check all cron jobs are configured under the Cron Management area needed for the store, including any custom cron jobs on the current host.
  • Verify any non-Magento code/frameworks are working as expected (e.g. WordPress).

Going Live

Follow these steps to complete your transfer to Mojo Stratus.

  1. Place the Magento store at the current host into maintenance mode to prevent additional orders. Failure to do so can cause a split DB situation where the same order numbers exist in two different databases for different orders. Put the new store into maintenance mode.
  2. In the DNS zones listed in the DNS control panel, adjust all the zones to point to the CloudFront endpoint instead of the current host (if the nameservers were set in advance as described above). Otherwise, switch the nameservers now.
  3. As described in Copy the Site above, re-copy the 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 the updated configuration files.

    mysqladmin -h mysql -u user_ -pPASSWORD drop db_
    mysqladmin -h mysql -u user_ -pASSWORD create db_
    
  4. Go to the URLs control panel in the Stratus management panel. Make sure all the domains listed match the domains that are moving, including their www. form (i.e. mysite.com and www.mysite.com). See Stratus URLs List and Domains for more information.

  5. Wait to allow the domains and cloudfront configuration to update. This may take as long as 15 minutes to complete.
  6. Adjust the multi-store configuration to match the live domains.
  7. Disable maintenance mode on the Stratus instance, leaving maintenance mode on the old host.
  8. Verify the new site.

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 needed.