SlideShare a Scribd company logo
1 of 15
Download to read offline
2014
1
FOR
COMPOSER + MAGENTO
Alec Bedzir	

Head of development	

Vaimo Ukraine	

alec.bedzir@vaimo.com
Kiev, Jul 16, 2014
2
HOW DO WE USUALLY START THE PROJECT
• Getting core
• Installing few already existing modules
• Developing few customizations
3
4
HOW DO WE MAINTAIN THE PROJECT
• Lots of useful/useless modules installed and
their list is smth difficult to get right away
• Development has introduced multiple
dependencies
• Development has over-customised a bunch of
general purpose modules
• Thanks god core is untouched
5
6
THOUGH IN SOME TIME…
7
• It is faster and easier to implement a feature issuing
dependencies on other modules
WHY PROJECT LOSE FIT
• Or vice versa - some module in the project becomes kind
of “customization” module storing everything
• Original purpose and integrity of each separate module is
not tracked by anyone
• The same module in the other project is being developed
in parallel instead of getting benefit from already created
code
8
SOLUTION: LETS WATCH THE MODULES
9
CONCEPTS
• Project and modules relation should not be hardcoded
• This relation should be many to many and remain flexible
• Module “purity” and maintenance (at least of main line)
should be delegated to “module maintainer”
• Module development by different teams should be done
together even though being conducted in different projects
• Module versions should be clear and all ready-to-use
10
TOOLS
• Composer 

(https://getcomposer.org/)
• Magento-composer-installer

(https://github.com/magento-hackathon/magento-composer-installer)
• Whatever VCS
and
11
STEPS
1) Install Composer
Check the link to Github for code of all the steps (in final slides)
2) Ensure Magento-composer-installer is required
3) Create your project’s initial composer.json file
4) Install Magento files via Composer
5) Create Magento DB, user and grant permissions
6) Ensure corresponding Magento folders are writable
7) Finalise magento installation: install.php from CLI or web
12
1. COMPOSER
$ mkdir bin
$ curl -s https://getcomposer.org/installer | php -- --install-dir=bin
In the project root issue:
Create empty project root folder.
13
2. MAGENTO-COMPOSER-INSTALLER
…
"require": {

 
 …
"magento-hackathon/magento-composer-installer": "*"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.firegento.com"
}
],
…
Add to composer.json if your project already uses composer
14
2. MAGENTO-COMPOSER-INSTALLER (2)
…
"require": {
"magento/core": "1.9.0.1"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.firegento.com"
}
],
…
Or simply require Magento core installation in composer.json 	

if you’re starting from scratch	

(Note, full version on composer.json file is shown in next step)
15
3. COMPOSER.JSON
{
"authors": [
{
"name": "Alec Bedzir",
"email": "alec.bedzir@vaimo.com"
}
],
"require": {
"magento/core": "1.9.0.1"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.firegento.com"
}
],
"extra":{
"magento-root-dir": "htdocs/",

 
"magento-deploystrategy": "copy"

 },

 "minimum-stability": "dev"
}
The very basic version of the file which 	

installs magento only with no other 	

modules.	

!
File should be named composer.json and 	

put into the root directory of the project
16
4. INSTALLING MAGENTO VIA COMPOSER
$ php ./bin/composer.phar -n install
In the project root issue:
17
5. DB, USER AND PERMISSIONS
$ mysql -u root -p -e " 

 CREATE DATABASE magento_composer 

 




CHARACTER SET utf8 COLLATE utf8_general_ci; 

 CREATE USER magento_user@127.0.0.1 IDENTIFIED BY '123456'; 

 GRANT ALL ON magento_composer.* TO magento_user@127.0.0.1; 
"
Run sql for preparing Mysql infrastructure for Magento:
18
6. MAGENTO WRITABLE FOLDERS
$ chmod -R 777 ./htdocs/app/etc
$ chmod -R 777 ./htdocs/var
$ chmod -R 777 ./htdocs/media
In the project root issue:
19
6. EXECUTE MAGENTO’S INSTALL.PHP
$ php -f ./htdocs/install.php -- --license_agreement_accepted yes 
--locale en_US --timezone "America/Los_Angeles" --default_currency USD 
--db_host 127.0.0.1 --db_name magento_composer --db_user magento_user 
--db_pass 123456 --db_prefix magento_ 
--url "http://magento-composer.lo" --use_rewrites yes 
--use_secure yes --secure_base_url "http://magento-composer.lo" 
--use_secure_admin yes 
--admin_lastname Owner --admin_firstname Store 
--admin_email "admin@example.com" 
--admin_username admin --admin_password qwerty_123 
--encryption_key "Encryption Key"
In the project root issue:
20
EXPECTED RESULT . <project root>
|-- bin
| `-- composer.phar
|-- composer.json
|-- composer.lock
|-- htdocs
| |-- …
| |-- app
| |-- cron.php
| |-- index.php
| |-- …
| `-- var
`-- vendor
|-- autoload.php
|-- bin
|-- …
|-- magento
`-- magento-hackathon
1) Magento was deployed to ./htdocs
under the project root	

2) Composer.lock file has been
generated	

3) Magento installation is entirely
comlete
21
TROUBLESHOOTING
If magento/core is not put into your htdocs directory:!
!
• Check whether this is not the issue with installing outdated version: (e.g. 1.4). Be sure version is 2.0.0 and higher.

(this can be checked in composer install operation log:

…

Installing dependencies (including require-dev)

- Installing magento-hackathon/magento-composer-installer (1.4)

…!
!
• check whether you have the up-to-date version of composer!
!
• check whether cache of composer is cleaned!
!
• check whether you don't have any custom configuration in ~/.composer/config.json 

(e.g. which overlaps with your per-project configuration)!
!
If Magento after installation with composer throws at you

Fatal error: Call to a member function getModelInstance() on a non-object 

in /var/www/magento-composer/htdocs/app/Mage.php on line 463!
!
• simply check the user magento files belong to and ensure app/etc/ media/ and var/ are writable.
22
SHOW TIME!
23
SPECIFICS OF VERSIONING
• Trickiest part: project has versions but modules too
• Thus, upgrade in project doesn’t mean that modules were
upgraded too. Probably they were downgraded
• Each project environment (dev, staging, live etc.) should be
backed up by separate branch of the project repo
• Forking module for customizing it to very specific needs is
a good option
24
USAGE AND BENEFITS
• Modules repos are separate and module tracking is easy
• One can’t break the module’s overall purpose with his code
as this will fail other projects using this module
• Module get’s a “maintainer” or few of them which are
responsible for main line of its development
• Multiple teams working on the same module contribute to
it simultaneously
25
USAGE AND BENEFITS (2)
• Flexible module versions locking in the project
• Modules used in the project and their versions are easy to
check
26
DEVELOPING IDEA IN
• Push to module repo on BitBucket via hook informs Jenkins about new
changes
• Jenkins having successfully done the build of the module (with all the
checks, tests etc) updates “Vaimo packages” - our own Magento module
composer repository
• Composer (custom of Vaimo edition) upon next “composer update”
fetches the updated packages feed and uses it for updating the project
• In our internal web tool “Server portal” we track each module’s state, it’s
all available versions, projects were it is installed and in which revisions
27
LINKS AND DEMO FILES
Files executed during demo (for Magento entire installation and for cleanup):
https://github.com/alecbedzir/composer_plus_magento_devhub_2014_Jul	

!
Magento-composer-installer

https://github.com/magento-hackathon/magento-composer-installer
!
Firegento - Magento Module Composer Repository
http://packages.firegento.com/
!
Composer

https://getcomposer.org/
28
29
WATCH THE MODULES!
Alec Bedzir	

Head of development	

Vaimo Ukraine	

alec.bedzir@vaimo.com
30

More Related Content

What's hot

What's hot (20)

WordCamp Montreal 2016 WP-API + React with server rendering
WordCamp Montreal 2016  WP-API + React with server renderingWordCamp Montreal 2016  WP-API + React with server rendering
WordCamp Montreal 2016 WP-API + React with server rendering
 
Drupal 8 improvements for developer productivity php symfony and more
Drupal 8 improvements for developer productivity  php symfony and moreDrupal 8 improvements for developer productivity  php symfony and more
Drupal 8 improvements for developer productivity php symfony and more
 
Drupal + composer = new love !?
Drupal + composer = new love !?Drupal + composer = new love !?
Drupal + composer = new love !?
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
 
Browser Exploitation Framework Tutorial
Browser Exploitation Framework TutorialBrowser Exploitation Framework Tutorial
Browser Exploitation Framework Tutorial
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
 
Oleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performanceOleh Kobchenko - Configure Magento 2 to get maximum performance
Oleh Kobchenko - Configure Magento 2 to get maximum performance
 
OpenCms Days 2015: Keynote - OpenCms 10 X marks the spot
OpenCms Days 2015: Keynote - OpenCms 10 X marks the spotOpenCms Days 2015: Keynote - OpenCms 10 X marks the spot
OpenCms Days 2015: Keynote - OpenCms 10 X marks the spot
 
OVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source TreeOVERVIEW: Chromium Source Tree
OVERVIEW: Chromium Source Tree
 
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
OpenCms Days 2014 - OpenCms Module Development and Deployment with IntelliJ, ...
 
Webpack
WebpackWebpack
Webpack
 
Intro to Powershell
Intro to PowershellIntro to Powershell
Intro to Powershell
 
Packing it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowPacking it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to now
 
Hitchhiker's guide to the front end development
Hitchhiker's guide to the front end developmentHitchhiker's guide to the front end development
Hitchhiker's guide to the front end development
 
Firefox OS - The platform you deserve - Firefox OS Budapest workshop - 2013-1...
Firefox OS - The platform you deserve - Firefox OS Budapest workshop - 2013-1...Firefox OS - The platform you deserve - Firefox OS Budapest workshop - 2013-1...
Firefox OS - The platform you deserve - Firefox OS Budapest workshop - 2013-1...
 
Vue 淺談前端建置工具
Vue 淺談前端建置工具Vue 淺談前端建置工具
Vue 淺談前端建置工具
 
The shift to the edge
The shift to the edgeThe shift to the edge
The shift to the edge
 
HTTPS + Let's Encrypt
HTTPS + Let's EncryptHTTPS + Let's Encrypt
HTTPS + Let's Encrypt
 
Link. apache wicket [santi caltabiano]
  Link. apache wicket [santi caltabiano]  Link. apache wicket [santi caltabiano]
Link. apache wicket [santi caltabiano]
 
OpenCms Days 2016: Keynote - Introducing OpenCms 10.5
OpenCms Days 2016:   Keynote - Introducing OpenCms 10.5OpenCms Days 2016:   Keynote - Introducing OpenCms 10.5
OpenCms Days 2016: Keynote - Introducing OpenCms 10.5
 

Viewers also liked (6)

Yurii Hryhoriev "Php storm tips&tricks"
Yurii Hryhoriev "Php storm tips&tricks"Yurii Hryhoriev "Php storm tips&tricks"
Yurii Hryhoriev "Php storm tips&tricks"
 
Magento2 airplane
Magento2 airplaneMagento2 airplane
Magento2 airplane
 
TechLeads meetup: Макс Лапшин, Erlyvideo
TechLeads meetup: Макс Лапшин, ErlyvideoTechLeads meetup: Макс Лапшин, Erlyvideo
TechLeads meetup: Макс Лапшин, Erlyvideo
 
TechLeads meetup: Евгений Потапов, ITSumma
TechLeads meetup: Евгений Потапов, ITSumma TechLeads meetup: Евгений Потапов, ITSumma
TechLeads meetup: Евгений Потапов, ITSumma
 
TechLeads meetup: Алексей Рыбак, Badoo
TechLeads meetup: Алексей Рыбак, BadooTechLeads meetup: Алексей Рыбак, Badoo
TechLeads meetup: Алексей Рыбак, Badoo
 
TechLeads meetup: Андрей Шелёхин, Tinkoff.ru
TechLeads meetup: Андрей Шелёхин, Tinkoff.ruTechLeads meetup: Андрей Шелёхин, Tinkoff.ru
TechLeads meetup: Андрей Шелёхин, Tinkoff.ru
 

Similar to DevHub 3 - Composer plus Magento

Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
Drupalcon Paris
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
Kalkey
 
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.jsMulti modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
David Amend
 

Similar to DevHub 3 - Composer plus Magento (20)

Establish reliable builds and deployments with Magento
Establish reliable builds and deployments with MagentoEstablish reliable builds and deployments with Magento
Establish reliable builds and deployments with Magento
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDKYocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to Maven
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with Maven
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
 
Code One 2018 maven
Code One 2018   mavenCode One 2018   maven
Code One 2018 maven
 
Pragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecturePragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecture
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
Gitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a proGitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a pro
 
Maven
MavenMaven
Maven
 
Webpack: from 0 to 2
Webpack: from 0 to 2Webpack: from 0 to 2
Webpack: from 0 to 2
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.jsMulti modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
 
Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"
 
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...
 
Continuous Integration & Development with Gitlab
Continuous Integration & Development with GitlabContinuous Integration & Development with Gitlab
Continuous Integration & Development with Gitlab
 
OpenCms Days 2015 Workflow using Docker and Jenkins
OpenCms Days 2015 Workflow using Docker and JenkinsOpenCms Days 2015 Workflow using Docker and Jenkins
OpenCms Days 2015 Workflow using Docker and Jenkins
 
CD in kubernetes using helm and ksonnet. Stas Kolenkin
CD in kubernetes using helm and ksonnet. Stas KolenkinCD in kubernetes using helm and ksonnet. Stas Kolenkin
CD in kubernetes using helm and ksonnet. Stas Kolenkin
 

More from Magento Dev (15)

DevHub 3 - Pricing
DevHub 3 - PricingDevHub 3 - Pricing
DevHub 3 - Pricing
 
DevHub 3 - CVS
DevHub 3 - CVSDevHub 3 - CVS
DevHub 3 - CVS
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhub
 
Разработка на стероидах или как я перестал бояться и полюбил свою IDE
Разработка на стероидах или как я перестал бояться и полюбил свою IDEРазработка на стероидах или как я перестал бояться и полюбил свою IDE
Разработка на стероидах или как я перестал бояться и полюбил свою IDE
 
Top 5 magento secure coding best practices Alex Zarichnyi
Top 5 magento secure coding best practices   Alex ZarichnyiTop 5 magento secure coding best practices   Alex Zarichnyi
Top 5 magento secure coding best practices Alex Zarichnyi
 
Magento 2 Page Cache
Magento 2 Page CacheMagento 2 Page Cache
Magento 2 Page Cache
 
Data migration into eav model
Data migration into eav modelData migration into eav model
Data migration into eav model
 
Magento devhub
Magento devhubMagento devhub
Magento devhub
 
Php + erlang
Php + erlangPhp + erlang
Php + erlang
 
Tdd php
Tdd phpTdd php
Tdd php
 
Gearman jobqueue
Gearman jobqueueGearman jobqueue
Gearman jobqueue
 
Autotest
AutotestAutotest
Autotest
 
Choreography of web-services
Choreography of web-servicesChoreography of web-services
Choreography of web-services
 
Security in PHP
Security in PHPSecurity in PHP
Security in PHP
 
Take more from Jquery
Take more from JqueryTake more from Jquery
Take more from Jquery
 

Recently uploaded

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Recently uploaded (20)

Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 

DevHub 3 - Composer plus Magento

  • 1. 2014 1 FOR COMPOSER + MAGENTO Alec Bedzir Head of development Vaimo Ukraine alec.bedzir@vaimo.com Kiev, Jul 16, 2014 2
  • 2. HOW DO WE USUALLY START THE PROJECT • Getting core • Installing few already existing modules • Developing few customizations 3 4
  • 3. HOW DO WE MAINTAIN THE PROJECT • Lots of useful/useless modules installed and their list is smth difficult to get right away • Development has introduced multiple dependencies • Development has over-customised a bunch of general purpose modules • Thanks god core is untouched 5 6
  • 4. THOUGH IN SOME TIME… 7 • It is faster and easier to implement a feature issuing dependencies on other modules WHY PROJECT LOSE FIT • Or vice versa - some module in the project becomes kind of “customization” module storing everything • Original purpose and integrity of each separate module is not tracked by anyone • The same module in the other project is being developed in parallel instead of getting benefit from already created code 8
  • 5. SOLUTION: LETS WATCH THE MODULES 9 CONCEPTS • Project and modules relation should not be hardcoded • This relation should be many to many and remain flexible • Module “purity” and maintenance (at least of main line) should be delegated to “module maintainer” • Module development by different teams should be done together even though being conducted in different projects • Module versions should be clear and all ready-to-use 10
  • 6. TOOLS • Composer 
 (https://getcomposer.org/) • Magento-composer-installer
 (https://github.com/magento-hackathon/magento-composer-installer) • Whatever VCS and 11 STEPS 1) Install Composer Check the link to Github for code of all the steps (in final slides) 2) Ensure Magento-composer-installer is required 3) Create your project’s initial composer.json file 4) Install Magento files via Composer 5) Create Magento DB, user and grant permissions 6) Ensure corresponding Magento folders are writable 7) Finalise magento installation: install.php from CLI or web 12
  • 7. 1. COMPOSER $ mkdir bin $ curl -s https://getcomposer.org/installer | php -- --install-dir=bin In the project root issue: Create empty project root folder. 13 2. MAGENTO-COMPOSER-INSTALLER … "require": { … "magento-hackathon/magento-composer-installer": "*" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ], … Add to composer.json if your project already uses composer 14
  • 8. 2. MAGENTO-COMPOSER-INSTALLER (2) … "require": { "magento/core": "1.9.0.1" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ], … Or simply require Magento core installation in composer.json if you’re starting from scratch (Note, full version on composer.json file is shown in next step) 15 3. COMPOSER.JSON { "authors": [ { "name": "Alec Bedzir", "email": "alec.bedzir@vaimo.com" } ], "require": { "magento/core": "1.9.0.1" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ], "extra":{ "magento-root-dir": "htdocs/", "magento-deploystrategy": "copy" }, "minimum-stability": "dev" } The very basic version of the file which installs magento only with no other modules. ! File should be named composer.json and put into the root directory of the project 16
  • 9. 4. INSTALLING MAGENTO VIA COMPOSER $ php ./bin/composer.phar -n install In the project root issue: 17 5. DB, USER AND PERMISSIONS $ mysql -u root -p -e " CREATE DATABASE magento_composer CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER magento_user@127.0.0.1 IDENTIFIED BY '123456'; GRANT ALL ON magento_composer.* TO magento_user@127.0.0.1; " Run sql for preparing Mysql infrastructure for Magento: 18
  • 10. 6. MAGENTO WRITABLE FOLDERS $ chmod -R 777 ./htdocs/app/etc $ chmod -R 777 ./htdocs/var $ chmod -R 777 ./htdocs/media In the project root issue: 19 6. EXECUTE MAGENTO’S INSTALL.PHP $ php -f ./htdocs/install.php -- --license_agreement_accepted yes --locale en_US --timezone "America/Los_Angeles" --default_currency USD --db_host 127.0.0.1 --db_name magento_composer --db_user magento_user --db_pass 123456 --db_prefix magento_ --url "http://magento-composer.lo" --use_rewrites yes --use_secure yes --secure_base_url "http://magento-composer.lo" --use_secure_admin yes --admin_lastname Owner --admin_firstname Store --admin_email "admin@example.com" --admin_username admin --admin_password qwerty_123 --encryption_key "Encryption Key" In the project root issue: 20
  • 11. EXPECTED RESULT . <project root> |-- bin | `-- composer.phar |-- composer.json |-- composer.lock |-- htdocs | |-- … | |-- app | |-- cron.php | |-- index.php | |-- … | `-- var `-- vendor |-- autoload.php |-- bin |-- … |-- magento `-- magento-hackathon 1) Magento was deployed to ./htdocs under the project root 2) Composer.lock file has been generated 3) Magento installation is entirely comlete 21 TROUBLESHOOTING If magento/core is not put into your htdocs directory:! ! • Check whether this is not the issue with installing outdated version: (e.g. 1.4). Be sure version is 2.0.0 and higher.
 (this can be checked in composer install operation log:
 …
 Installing dependencies (including require-dev)
 - Installing magento-hackathon/magento-composer-installer (1.4)
 …! ! • check whether you have the up-to-date version of composer! ! • check whether cache of composer is cleaned! ! • check whether you don't have any custom configuration in ~/.composer/config.json 
 (e.g. which overlaps with your per-project configuration)! ! If Magento after installation with composer throws at you
 Fatal error: Call to a member function getModelInstance() on a non-object 
 in /var/www/magento-composer/htdocs/app/Mage.php on line 463! ! • simply check the user magento files belong to and ensure app/etc/ media/ and var/ are writable. 22
  • 12. SHOW TIME! 23 SPECIFICS OF VERSIONING • Trickiest part: project has versions but modules too • Thus, upgrade in project doesn’t mean that modules were upgraded too. Probably they were downgraded • Each project environment (dev, staging, live etc.) should be backed up by separate branch of the project repo • Forking module for customizing it to very specific needs is a good option 24
  • 13. USAGE AND BENEFITS • Modules repos are separate and module tracking is easy • One can’t break the module’s overall purpose with his code as this will fail other projects using this module • Module get’s a “maintainer” or few of them which are responsible for main line of its development • Multiple teams working on the same module contribute to it simultaneously 25 USAGE AND BENEFITS (2) • Flexible module versions locking in the project • Modules used in the project and their versions are easy to check 26
  • 14. DEVELOPING IDEA IN • Push to module repo on BitBucket via hook informs Jenkins about new changes • Jenkins having successfully done the build of the module (with all the checks, tests etc) updates “Vaimo packages” - our own Magento module composer repository • Composer (custom of Vaimo edition) upon next “composer update” fetches the updated packages feed and uses it for updating the project • In our internal web tool “Server portal” we track each module’s state, it’s all available versions, projects were it is installed and in which revisions 27 LINKS AND DEMO FILES Files executed during demo (for Magento entire installation and for cleanup): https://github.com/alecbedzir/composer_plus_magento_devhub_2014_Jul ! Magento-composer-installer
 https://github.com/magento-hackathon/magento-composer-installer ! Firegento - Magento Module Composer Repository http://packages.firegento.com/ ! Composer
 https://getcomposer.org/ 28
  • 15. 29 WATCH THE MODULES! Alec Bedzir Head of development Vaimo Ukraine alec.bedzir@vaimo.com 30