cancel
Showing results for 
Search instead for 
Did you mean: 

Move test site to production

Move test site to production

I created a test site to update my Magento 2.2.3 to the latest version 2.4.6; everything went well, it took me some time, but I managed it, and I fixed everything. my problem now is to bring everything back online, in fact the database I used for the test site dates back to June 2023, and I would like to take at least orders and customers from the site in production. How do I proceed? I can't launch upgrades on the site in production because I did everything in 2 steps, first I moved to 2.3 and then to 2.4; but I didn't take into account the various fixes. Can I copy just some folders from the test site and update the test site db with order and customer tables?

5 REPLIES 5

Re: Move test site to production

To move customer and order data from your Magento 2.4.6 test site to your production site running Magento 2.2.3, follow these steps:

1. Backup both sites.
2. Export customer and order data from the Magento 2.4.6 database.
3. Modify and adapt the data to be compatible with Magento 2.2.3.
4. Import this data into your production site's database.
5. Ensure code and folder changes between versions are manually applied to your production site.
6. Thoroughly test your production site.
7. Optimize performance and configurations.
8. Go live once everything works well.

Re: Move test site to production

To move your test site changes to the production site without executing upgrades directly on the live environment, you can follow a staged approach. First, ensure that both the test and production databases are compatible, especially with regards to the Magento version. Then, export the necessary data tables from your test site database, focusing on orders and customer information. Import these tables into the production database, making sure to back up both databases before proceeding. Regarding files, copying specific folders from the test site to production may work, but it's crucial to identify and transfer only those files directly related to your updates. Additionally, carefully manage configuration files, such as env.php and config.php, to avoid inconsistencies. After the data and files are synchronized, thoroughly test the production site in a controlled environment before making it live to ensure a seamless transition.

Re: Move test site to production

When migrating data from a test site to a production site in Magento, it's crucial to be careful and follow the best practices to ensure a smooth transition. Here's a general guideline on how you can proceed:

1. Backup Everything:

Before making any changes, ensure you have a complete backup of both your test and production environments. This includes files, databases, and configurations.

2. Identify Relevant Data Tables:

Identify the tables in your Magento database that contain customer and order data. Key tables include customer_entity, sales_order, sales_order_item, and related tables.

3. Export Data from Test Site:

Export the relevant customer and order data from the test site database. You can use tools like mysqldump or export features within database management tools.

Example:

mysqldump -u [username] -p[password] [database_name] customer_entity sales_order sales_order_item >

4. Import Data into Production Site:

On your production site, import the exported data. Ensure you've backed up the production database before proceeding.

Example:

mysql -u [username] -p[password] [database_name] <

5. Clear Cache and Reindex:

After importing the data, clear the Magento cache and reindex data.

php bin/magento cache:clean
php bin/magento

6. Adjust Configuration Files:

Review any configuration files that may contain site-specific settings, such as app/etc/env.php and make any necessary adjustments. Ensure that your production site configuration is correctly pointing to the updated database.

7. Test Thoroughly:

Before making the production site live, thoroughly test functionality, including order placement, customer login, and other critical features. This ensures that the imported data integrates seamlessly with the existing production environment.

8. Consider Incremental Upgrade:

If your production site is still running an older version of Magento, consider upgrading it incrementally to avoid potential issues. For example, you could first upgrade to Magento 2.3.x, test thoroughly, and then proceed to 2.4.x.

9. Monitor Logs:

Monitor error logs (var/log in Magento's directory) during and after the import. Address any errors or issues promptly.

10. Inform Stakeholders:

If your production site is live, you mentioned ricepuritytestt and receives regular traffic, inform stakeholders about the upcoming changes and schedule the migration during low-traffic periods.

Always test any process thoroughly in a staging environment before attempting changes on a live production site. Additionally, ensure that both the test and production environments are as identical as possible in terms of configurations and settings.

Re: Move test site to production

@papaeredi 

Hey,

Move the production side to maintainance mode

2) take backup of database and file-folder

3) create the backup folder in root directory and move all the file and folder to take directory

4) Copy all the file and folder to production website 

5) run all the command and change the setting you did related to configuration in production website(you also copy the core_config_data table from test website to live, you need to change the web URL in this case)

 

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: Move test site to production

Moving a Magento test site to production while ensuring the latest orders and customers from the live site are preserved can be a delicate process. Here's a structured approach to achieving this:

  • Backup Everything:
    Production Site: Create a full backup of your production site's files and database.
    Test Site: Ensure you have a full backup of your test site files and database.
  • Identify Tables to Migrate:
    The key tables for orders and customers in Magento are:
  • sales_order
  • sales_order_item
  • sales_order_payment
  • sales_order_status
  • sales_order_status_history
  • customer_entity
  • customer_address_entity
  • Any related tables (sales_* and customer_* tables).

Export Data from Production Site:

  • Export the latest data from the necessary tables on the production database. You can use tools like phpMyAdmin, MySQL Workbench, or command-line MySQL commands.

-- Export customers and orders
mysqldump -u username -p password production_database customer_entity customer_address_entity sales_order sales_order_item sales_order_payment sales_order_status sales_order_status_history > production_customers_orders.sql

  • Import Data into Test Site Database:

Import the exported data into the test site database. Be careful to avoid duplicates and ensure data integrity. You might need to handle this manually or with specific scripts to avoid conflicts.

-- Import customers and orders into the test database
mysql -u username -p password test_database < production_customers_orders.sql

  • Update References and Fix Conflicts:

After importing, check for any conflicts or reference issues. Update foreign keys and references as needed. This step might require custom SQL scripts or careful manual adjustments.

  • Synchronize Files:

Copy the updated files from the test site to the production site. Be sure to include:

  • Updated Magento core files.
  • Any custom modules or extensions.
  • Configuration files (like app/etc/env.php).

Test the Production Site:

  • Before making the site live, thoroughly test the production environment to ensure everything is working correctly. Check orders, customer data, and any other critical functionality.

Put the Production Site Live:

  • Once testing is complete, make the production site live. Monitor the site closely for any issues.

If the issue will be resolved, Click Kudos & Accept as a Solution.