separation of code and state part 2 for...

23
Separation of Code and State Part 2 for M2 Magento Developer Raj Chevli @chevli

Upload: others

Post on 30-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Separation of Code and State Part 2 for M2

Magento DeveloperRaj Chevli@chevli

Page 2: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

A bit about me

- Lead Magento Developer- Working at CTI Digital- Working with Magento since 2013- Like to play the Tabla (Indian Drums)

2@chevli

Page 3: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

3@chevli

Page 4: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Who remembers this?

4

Page 5: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Back in the day

- Using a shared DB- Importing the staging DB- Making configuration changes on stage and locally- FTP images from stage to local environment- Creating 100’s of data scripts- QA/TDD non-existent

5@chevli

Page 6: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Brief

4 - 5Developers

ShortDeadline

180Websites

200Store Fronts

+/-Websites

6@chevli

Page 7: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Process

7@chevli

Page 8: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Magento Configurator!

For Magento 1

https://github.com/ctidigital/magento-configurator

8

Page 9: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

What is it?

- A Magento module to create and maintain database variables using files.

- Allows you to install Magento from scratch with important database based configuration ready.

- Share and collaborate configuration with your team using VCS- Split your configuration based on the environment you're

developing on.

9@chevli

Page 10: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

The Process

Drop & Install Database

With Magerun

Run Configurator

Make DevelopmentAnd Database

Changes

Commit Changes

Developer 1

Pull Changes

Drop & Install Database

With Magerun

Run Configurator

Make DevelopmentAnd Database

Changes

Commit Changes

Developer n-1

Pull Changes

Drop & Install Database

With Magerun

Run Configurator

Make DevelopmentAnd Database

Changes

Commit Changes

Developer n

Pull Changes

10@chevli

Page 11: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Magento 2 Configurator

- Magento Configurator is split into components- Each component to address each model in Magento- This will populate each table of the Magento Database- bin/magento configurator:run

- bin/magento configurator:run --env=production

- bin/magento configurator:run --env=local --component=config

11@chevli

Page 12: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Configurator Componentsbin/magento configurator:list

- Admin Roles- Admin Users- API Integrations- Attribute Sets- Attributes- Blocks- Categories- Store Configuration- Customer Groups- Customers

- Media- Pages- Product Links- Products- Review Rating- Rewrites- Tax Rates- Tax Rules- Websites- Widgets

12@chevli

Page 13: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

master.yamlhttps://github.com/ctidigital/magento2-configurator/blob/develop/Samples/master.yaml

websites:enabled: 1sources:

- ../configurator/websites.yamlconfig:enabled: 1sources:- ../configurator/Configuration/global.yaml- ../configurator/Configuration/base.config.yaml

env:local:sources:- ../configurator/Configuration/local.yaml

stage:sources:- ../configurator/Configuration/stage.yaml

production:sources:- ../configurator/Configuration/production.yaml

13@chevli

Page 14: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Website Component (websites.yaml)websites:base:

name: Configurator's Website UKstore_groups:

-group_id: 1name: Main Website Storeroot_category_id: 2default_store: defaultstore_views:

default:name: Configurator's Store Viewis_active: 1

usa:name: Configurator's Website USstore_groups:

-name: Configurator's Website Store USroot_category_id: 2default_store: usa_en_usstore_views:

usa_en_us:name: Configurator's USA Store Viewis_active: 1

14@chevli

Page 15: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

@chevli15@chevli

Page 16: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Store Configuration Component

global:-path: general/country/defaultvalue: US

websites:base:-path: general/country/defaultvalue: GB

stores:default:-path: general/locale/codevalue: en_GB

16@chevli

Page 17: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

17

Page 18: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Free tools!

- n98-magerun- xdebug- robo.li- Travis-ci

- PHP Unit- PHP Code Sniffer- PHP Copy and Paste Detector- PHP Mess Detector

18@chevli

Page 19: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Big Thanks to the Community

- Paul Partington (CTI)- Francis Gallagher (Inviqa)- Chris Gan (CTI)- Matthew Howarth (MH Ltd)- Rob Stanley (CTI)- Evan Johnson (SplashLab)- Dcole (Inviqa)- Adragus (Inviqa)- Suresh Balasubramanian (CTI)- Andy Irvine (CTI)- Bartosz Herba (CTI)- Dan Kenny (Ampersand)- Alex Biddle (Inviqa)

19@chevli

Page 20: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

The Community

- Mage Titans inspired module- Developed by the Mage Titans community

20@chevli

Page 21: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Version 1For Magento 2

21

Page 22: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

What’s Next

- Magento Open Source (CE) components developed- Magento Commerce (EE) components to be developed- Magento Commerce (B2B) components to be developed- Bluefoot components- Third party extension components

22@chevli

Page 23: Separation of Code and State Part 2 for M2uk.magetitans.com/wp-content/uploads/2017/06/Raj-Chevli-Mage-Titans... · State Part 2 for M2 Magento Developer Raj Chevli @chevli. A bit

Thank you for listening

Questions

Raj Chevli

@chevli

https://github.com/ctidigital/magento2-configurator

23