SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Downloaden Sie, um offline zu lesen
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 beneļ¬t 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 ļ¬‚exible
ā€¢ 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 ļ¬nal slides)
2) Ensure Magento-composer-installer is required
3) Create your projectā€™s initial composer.json ļ¬le
4) Install Magento ļ¬les 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.ļ¬regento.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.ļ¬regento.com"
}
],
ā€¦
Or simply require Magento core installation in composer.json 	

if youā€™re starting from scratch	

(Note, full version on composer.json ļ¬le 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.ļ¬regento.com"
}
],
"extra":{
"magento-root-dir": "htdocs/",

 
"magento-deploystrategy": "copy"

 },

 "minimum-stability": "dev"
}
The very basic version of the ļ¬le 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_preļ¬x 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_ļ¬rstname 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 ļ¬le 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 conļ¬guration in ~/.composer/conļ¬g.json ā€Ø
(e.g. which overlaps with your per-project conļ¬guration)!
!
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 ļ¬les 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 speciļ¬c 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.ļ¬regento.com/
!
Composerā€Ø
https://getcomposer.org/
28
29
WATCH THE MODULES!
Alec Bedzir	

Head of development	

Vaimo Ukraine	

alec.bedzir@vaimo.com
30

Weitere Ƥhnliche Inhalte

Was ist angesagt?

Vue ę·ŗč«‡å‰ē«Æå»ŗē½®å·„具
Vue ę·ŗč«‡å‰ē«Æå»ŗē½®å·„具Vue ę·ŗč«‡å‰ē«Æå»ŗē½®å·„具
Vue ę·ŗč«‡å‰ē«Æå»ŗē½®å·„具
andyyou
Ā 

Was ist angesagt? (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
Ā 

Andere mochten auch

Magento2 airplane
Magento2 airplaneMagento2 airplane
Magento2 airplane
Magento Dev
Ā 

Andere mochten auch (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
Ā 

Ƅhnlich wie 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
Ā 

Ƅhnlich wie 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
Ā 

Mehr von Magento Dev

DevHub 3 - Pricing
DevHub 3 - PricingDevHub 3 - Pricing
DevHub 3 - Pricing
Magento Dev
Ā 
DevHub 3 - CVS
DevHub 3 - CVSDevHub 3 - CVS
DevHub 3 - CVS
Magento Dev
Ā 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhub
Magento Dev
Ā 
Magento devhub
Magento devhubMagento devhub
Magento devhub
Magento Dev
Ā 
Php + erlang
Php + erlangPhp + erlang
Php + erlang
Magento Dev
Ā 
Gearman jobqueue
Gearman jobqueueGearman jobqueue
Gearman jobqueue
Magento Dev
Ā 
Choreography of web-services
Choreography of web-servicesChoreography of web-services
Choreography of web-services
Magento Dev
Ā 
Security in PHP
Security in PHPSecurity in PHP
Security in PHP
Magento Dev
Ā 
Take more from Jquery
Take more from JqueryTake more from Jquery
Take more from Jquery
Magento Dev
Ā 

Mehr von 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
Ā 

KĆ¼rzlich hochgeladen

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
Ā 
Top Rated Call Girls In chittoor šŸ“± {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor šŸ“± {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor šŸ“± {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor šŸ“± {7001035870} VIP Escorts chittoor
dharasingh5698
Ā 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
Ā 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
KreezheaRecto
Ā 
Call Girls in Ramesh Nagar Delhi šŸ’Æ Call Us šŸ”9953056974 šŸ” Escort Service
Call Girls in Ramesh Nagar Delhi šŸ’Æ Call Us šŸ”9953056974 šŸ” Escort ServiceCall Girls in Ramesh Nagar Delhi šŸ’Æ Call Us šŸ”9953056974 šŸ” Escort Service
Call Girls in Ramesh Nagar Delhi šŸ’Æ Call Us šŸ”9953056974 šŸ” Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
Ā 

KĆ¼rzlich hochgeladen (20)

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
Ā 
Top Rated Call Girls In chittoor šŸ“± {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor šŸ“± {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor šŸ“± {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor šŸ“± {7001035870} VIP Escorts chittoor
Ā 
Top Rated Pune Call Girls Budhwar Peth āŸŸ 6297143586 āŸŸ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth āŸŸ 6297143586 āŸŸ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth āŸŸ 6297143586 āŸŸ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth āŸŸ 6297143586 āŸŸ Call Me For Genuine Se...
Ā 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
Ā 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
Ā 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
Ā 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
Ā 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
Ā 
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...
Ā 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Ā 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
Ā 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
Ā 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
Ā 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Ā 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
Ā 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
Ā 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
Ā 
Call Girls in Ramesh Nagar Delhi šŸ’Æ Call Us šŸ”9953056974 šŸ” Escort Service
Call Girls in Ramesh Nagar Delhi šŸ’Æ Call Us šŸ”9953056974 šŸ” Escort ServiceCall Girls in Ramesh Nagar Delhi šŸ’Æ Call Us šŸ”9953056974 šŸ” Escort Service
Call Girls in Ramesh Nagar Delhi šŸ’Æ Call Us šŸ”9953056974 šŸ” Escort Service
Ā 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Ā 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
Ā 

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 beneļ¬t 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 ļ¬‚exible ā€¢ 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 ļ¬nal slides) 2) Ensure Magento-composer-installer is required 3) Create your projectā€™s initial composer.json ļ¬le 4) Install Magento ļ¬les 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.ļ¬regento.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.ļ¬regento.com" } ], ā€¦ Or simply require Magento core installation in composer.json if youā€™re starting from scratch (Note, full version on composer.json ļ¬le 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.ļ¬regento.com" } ], "extra":{ "magento-root-dir": "htdocs/", "magento-deploystrategy": "copy" }, "minimum-stability": "dev" } The very basic version of the ļ¬le 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_preļ¬x 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_ļ¬rstname 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 ļ¬le 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 conļ¬guration in ~/.composer/conļ¬g.json ā€Ø (e.g. which overlaps with your per-project conļ¬guration)! ! 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 ļ¬les 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 speciļ¬c 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.ļ¬regento.com/ ! Composerā€Ø https://getcomposer.org/ 28
  • 15. 29 WATCH THE MODULES! Alec Bedzir Head of development Vaimo Ukraine alec.bedzir@vaimo.com 30