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.
Gather the following information:
Magento version (1 vs 2)
PHP version at the current host
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.
- Delete everything in
rm -rf /srv/public_html/.
- 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.
- Connect to the Stratus instance via SSH.
Once connected, log into the existing Magento server:
Some SSH logins may require slightly different SSH commands:
#with key ssh -i /path/to/keyfile email@example.com #with custom port ssh -p 1234 firstname.lastname@example.org
Create a backup of the current database.
#example database dump commands mysqldump -uUSERNAME -pPASSWORD databasename > migrate.sql #with n98 n98-magerun db:dump migrate.sql
Copy the files and database dump to Stratus.
From SSH in your Stratus environment, go to the document root (e.g.
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" email@example.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.
local.xml(Magento 1) or
env.php(Magento 2) in
app/etcwith 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
<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
<? 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 using
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
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:
- 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
- PHP error logs in
Check with MageMojo Support if needed for further assistance.
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.
- Get the current IP or IPs for each domain at your current DNS host.
Go to DNS in the Stratus sidebar menu.
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.
- Add any additional DNS records, such as www or mailserver domains.
- 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.
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).
Follow these steps to complete your transfer to Mojo Stratus.
- 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.
- 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.
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_
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.
- Wait to allow the domains and cloudfront configuration to update. This may take as long as 15 minutes to complete.
- Adjust the multi-store configuration to match the live domains.
- Disable maintenance mode on the Stratus instance, leaving maintenance mode on the old host.
- 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.