Expert guidance on migrating from magento 1 to magento 2

Post on 11-Apr-2017

29 views 0 download

Transcript of Expert guidance on migrating from magento 1 to magento 2

Expert Guidance on Migrating from Magento 1 to Magento 2

Gordon KnoppeBusiness Solutions Architect, ECG

James CowieTechnical Architect, ECG

Expert Consulting Group

ECG Charter: To provide expert insight, review, and guidance at every stage of the Magento project lifecycle.

• Customer Success: Leverage innovative technologies and superior talent to exceed customer expectations in every way.

• Quality and Scale: Drive quality for all implementations, large and small, to ensure success on the Magento platform.

• Thought Leadership: Develop and publish best practices to increase quality in the Magento community.

Expert Consulting Group

Preferred Service

Technical Account Manager

Migration Analysis Methodology

Current Magento Landscape

Codebase & Database

System landscape & Systems of record

Requirements & Wireframes

Test Documentation

Existing and Future-state Infrastructure Diagrams

Environments

Dev Tools & SDLC

StrategiesReview and Assess

• Custom Modules• Extensions• New Features• Theme• Personal Devices• Integrations• Information Migration• Business Process Changes• Infrastructure• Environments• Testing

• Desktop and personal device requirements

• Integrity of Magento Core code• Custom Modules• Extensions• Customized Features• Integrations• Database• Theme and Templates• Test Documentation• Infrastructure• Environments

Migration Analysis

Confidence is the feeling you have before you fully understand the situation.

- Unknown

Analysis Phase - Features

1. Requirements

2. Code Audit

3. Theme

4. Testing Process

Code Audit

• Custom development

• Third-party extensions

• Dependencies between extensions

• Un-used modules

• JavaScript functionality

• Business logic in templates

Requirements

• Obsolete customizations

• Magento native features and functionality in use

• Desktop vs. mobile, progressive enhancement

• Mapping requirements to tests and acceptance

Theme

• Identify theme requirements

• Create theme approach

• Theme is not migrated by tools

Testing Process

• Start early, understand what you’ve got

• End-to-end (integration) testing

• Written documentation and gap analysis

• Mapping tests to requirements?

Analysis - Supporting Elements

1. Landscape Diagram / Integrations

2. Data (size, scope, locations)

3. Environments

Strategy and Vision

If you aim at nothing, you will hit it every time.

- Zig Ziglar

New Features

• New in Magento 2

– Or maybe just new to you?

• Return to native

• Demo, demo, demo for your business users!

Third-party Extensions

• Full inventory of installed extensions and versions

• Remove, return to native, upgrade

• Does it do everything it did in the Magento 1 version?

Theming and Personal Devices

• HTML, CSS, and JavaScript

• Build on a responsive foundation

• Single theme or global multi-store with unified branding?

• Supported devices and responsive break points

Custom Modules

• Code custom built to satisfy your requirements

• Remove or migrate

• Re-architect (refer to James)

– Divide

– Merge

– Refactor

Non-code Related Strategies

• Integrations

• Information Migration

• Infrastructure and Environments

• Testing Strategy

• Business Process Changes

Data Migration in ActionData is a precious thing and will last longer than the systems themselves.

Tim Berners-Lee

Magento official Data migration tool

https://github.com/magento/data-migration-tool

Best Practices

• Remove outdated and redundant data

• Close by MySQL instances

• Use a replicated Magento 1 database NOT live

Benchmarks

• Database had:– 177k products,

– 355k orders,

– 214k customers

Performance results

• Settings migration time: ~10 mins

• Data migration time: ~9 hours for full migration

Performance results

• Site downtime – Around 5 minutes for re-index.

– DNS propagation

What does it do?

• Store Configuration

• Products

• Customers

• Orders

• Promotions

Modes

• Store Configuration settings

• Data

• Delta (changes since the last run)

Prerequisites

• Have Magento 2 Installed

• Don’t start the Magento 2 cron jobs

• Database Backups

Install

composer config repositories.data-migration-tool git https://github.com/magento/data-migration-tool

composer require-dev magento/data-migration-tool:<version>

Configure your version

• CE to CE

• CE to EE

• EE to EE

Pick your migration path:

Configure your version

• 1.6.0.0

• …

• 1.9.3.2

Pick the version number of Magento 1 used:

Configuring the tool – config.xml

Copy the file specific to your version.

<source> <database host="127.0.0.1" name="magento1" user="root"/> </source>

<destination> <database host="127.0.0.1" name="magento2" user="root"/> </destination>

Configuring the tool – config.xml

Copy the file specific to your version.

<source> <database host="127.0.0.1" name="magento1" user="root"/> </source>

<destination> <database host="127.0.0.1" name="magento2" user="root"/> </destination>

Best Practice: Keep these as close as possible.

Mappings, How it all works

• Mapping Files– Changing table names

– Changing field names

– Ignoring tables or fields

– Adapt transferring of data

Running the tool

> php bin/magento

migrate migrate:data migrate:delta migrate:settings

Remember the order

• Settings

• Data

• Deltas

Common errors

• Invalid attributes– Differing data types

• Source field not mapped

Map Files

• Maps data between systems

• Ignore fields

• Field Rules– Move fields from one name to another– Transform fields from one type to another

• Rules can apply to:– Source (m1) – Destination (m2)

Example

[ERROR]: Source fields not mapped.

Document: sales_flat_order_address. Fields: giftregistry_item_id

Source field not found

• config.xml

<map_file>etc/ce-to-ce/1.9.2.3/map.xml.dist</map_file>

<map_file>etc/ce-to-ce/1.9.2.3/map.xml</map_file>

map.xml

<ignore> <field>sales_flat_order_address.giftregistry_item_id</field></ignore>

map.xml

<ignore> <field>sales_flat_order_address.giftregistry_item_id</field></ignore>

Document Field

Tables that don’t exist on Magento 2

<source> <document_rules> <ignore> <document>Table Name</document> </ignore>

Deltas

• Only to be ran after initial migration

• Changes since last run

• Run as often as possible (Multiple times per day)

• Start this process early in migration plan

Custom data structures for modules

• Ensure schema exists in both DB’s

• Only add mappings if you want to change things.

• Will migrate data automatically

Cleaning up

• Check databases for temporary tables

• Stop delta process running

• Remove tool tables listed in deltalog.xml

• Remove code from composer

Conclusion for Data

• Practice, Practice and Practice

• Use mappings for everything

• Could use “scripts” but data migration can work well

• Use Ignore responsibly

• Integration with Business plans and process.

Preparing for codeHow to bring modules into M2

Automated tools

https://github.com/magento/code-migration

Overview of Official Tool

• Static file generation

• Maps types:– Models / Resource Models / Collections

– Controllers

– Actions

– Blocks

– XML

• Repeatable process

What’s changed in module code

• Plugins

• Interceptors

• Dependency Injection

• Composer

• UI components

• API & Service contracts ( Interfaces )

Plugins

• Modify Behavior of public methods and class• Before, Around and After

• Reduces observer dependency mess.

Dependency Injection

• Use DI over new instantiation

• Constructor Arguments

• Removes “God” class and thinking

Composer

• Easily manage module dependencies

• Pin versions of packages based on semantic versioning

• Think create for reuse

• Small helpful packages

• Stop inventing the wheel

UI Components

• Empower forms for adminhtml

• Used through checkout and frontend as new bindings of logic

Concluding Code

• Use automation for “prototype”

• Consider time needed for rewrite – Learning time

– Implementing time

• Be selective with functionality migrated

Beyond Code and DataMigrating process. How to deploy

Deployments

• Static assets

• Composer dependencies

• Code generation

• Database coupling*

Options for deployment

• Continuous integration

• Build servers

Any Questions ? Thank-you for your time.