Your SlideShare is downloading. ×
Wiring Magento Projects
Magento Fireside Chat
Google+ Hangout - March 20, 2014
Intro – Fabrizio Branca (@fbrnc)
Composer – Fabrizio Branca (@fbrnc)
Magento Composer Installer – Bastian Ike (@b_ike)
Lig...
the problem
Intro
htdocs
<Name>
<theme>
layout
template
code
design
etc
locale
<area>
core
community
local
<area>
<language>
modules
<packag...
htdocs
Module
default
layout
template
code
design
etc
locale
local
frontend
de_DE
modules
My
base
*.xml
app
My_Module2.xml...
Magento 2
pub
Module
code
My
app
Magento
My_Module
My_Module2
view
Controller
etc
i18n
Block
…
Module2
view
Controller
etc
i18n
Bloc...
the requirements
Intro
• Reuse modules
• Share modules
• Easy and clean uninstall without leftovers
• Non-destructive (no deletion of files)
• Cl...
a solution
Intro
modman
by @colinmollenhour
htdocs
code
core
community
local
app
app/code/…/My/Module
.modman
My_Module
app/design/…
skin/frontend/…
app/etc/modules/M...
“wiring”
Intro
modman “connects” existing modules to the Magento core,
but how do we manage them?
htdocs
code
core
community
local
app
app/code/…/My/Module
.modman
My_Module
app/design/…
skin/frontend/…
app/etc/modules/M...
svn:externals
Git submodules
Phing/Ant
Custom scripts
Composer
Components
Options
works fine, but needs
some getting used ...
Composer
Intro
in a nutshell…
Composer“Composer is a tool for dependency management in PHP. It allows you to declare
the dependent libraries your projec...
theHackathon installer approach
Approach
Magento Composer
Installer
Overview
• Aims to provide an easy way to install Magento
modules via composer (instead of e.g. modman)
• Community driven...
Components
• Magento Composer installer
• Package repository
• Compatible with package.xml, modman and
manual file mapping ...
Using Magento+Composer
{	
"minimum-stability": "dev",	
"require": {	
"fbrnc/aoe_templatehints": "*"	
},	
"repositories": [...
Using Magento+Composer
{	
"minimum-stability": "dev",	
"require": {	
"fbrnc/aoe_templatehints": "*"	
},	
"repositories": [...
Using Magento+Composer
{	
"minimum-stability": "dev",	
"require": {	
"fbrnc/aoe_templatehints": "*"	
},	
"repositories": [...
Using Magento+Composer
{	
"minimum-stability": "dev",	
"require": {	
"fbrnc/aoe_templatehints": "*"	
},	
"repositories": [...
Using Magento+Composer
{	
"minimum-stability": "dev",	
"require": {	
"fbrnc/aoe_templatehints": "*"	
},	
"repositories": [...
extra
• magento-root-dir: Where your Magento installation lives
• magento-deploystrategy:
• symlink: symlink into Magento
...
composer install
Publishing packages
• Add a composer.json to your extension
• Publish your extension on github
• Add it to packages.firegen...
composer.json
{	
"name": "fbrnc/Aoe_TemplateHints",	
"license": "OSL-3.0",	
"type": "magento-module",	
"description": "Adv...
composer.json
{	
"name": "fbrnc/Aoe_TemplateHints",	
"license": "OSL-3.0",	
"type": "magento-module",	
"description": "Adv...
composer.json
{	
"name": "fbrnc/Aoe_TemplateHints",	
"license": "OSL-3.0",	
"type": "magento-module",	
"description": "Adv...
composer.json
{	
"name": "fbrnc/Aoe_TemplateHints",	
"license": "OSL-3.0",	
"type": "magento-module",	
"description": "Adv...
composer.json
{	
"name": "fbrnc/Aoe_TemplateHints",	
"license": "OSL-3.0",	
"type": "magento-module",	
"description": "Adv...
Package Repository
{ "type": "vcs", "url": "git://github.com/colinmollenhour/
Cm_Cache_Backend_Mongo.git" },	
{ "type": "v...
Package.xml? modman?
JSON-mapping
• package.xml: Used by Magento Connect
• modman: Used by modman, imho best solution.

No...
That's it :)
Links
• https://getcomposer.org/
• https://github.com/magento-hackathon/magento-
composer-installer/
• https://github.com/...
Fabrizio’s lightweightapproach
Approach
@fbrnc
Keeping it Simple!
AOEpeople/composer-installers
"replace": { "magento-hackathon/magento-composer-installer":"*" }
“inspired” by
composer/ins...
<?php
namespace AoepeopleComposerInstallers;
class MagentoInstaller extends BaseInstaller
{
protected $locations = array(
...
• Fully compatible with magento-hackathon/magento-composer-installer
• Adds support for type “magento-source”
• Only puts ...
{
{
"minimum-stability":"dev",
"require":{
"aoepeople/composer-installers": "*",
"fbrnc/aoe_scheduler": "*",
"fbrnc/aoe_ca...
htdocs
code
core
community
local
app
app/code/…/My/Module
.modman
My_Module
app/design/…
skin/frontend/…
app/etc/modules/M...
Build
Workflow
Unit Tests,…
• git clone
• Add some metadata (build
number, master system,
package type)
• (Run Composer)
•...
Deployment & Installation
Workflow
Update local
copy of the
“systemstorage”
Move files to
new release
folder
Download buil...
Directory layoutvar
var
<projectName>
releases
<environmentName>
shared
www
media
build_117
build_118
build_119
.modman
ht...
Daniel’s experimental approach
Approach
@Flyingmana
http://flyingmana.name/slides/magento-wizards_fugue-introduction.html
Rolando’s different approach
Approach
@beeplogic
http://slid.es/beeplogic/magesync
Ben’s approach
Approach
@benmarks
Thank you!
Any questions?
http://www.youtube.com/watch?v=bscXyCy4fHc
Watch the recording!
Magento Fireside Chat: "Wiring Mageno Projects"
Upcoming SlideShare
Loading in...5
×

Magento Fireside Chat: "Wiring Mageno Projects"

1,503

Published on

Slides of the Magento Fireside Chat March 20th, 2014 with

Fabrizio Branca (@fbrnc)
Bastian Ike (@b_ike)
Daniel Fahlke (@flyingmana)
Rolando Granadino (@beeplogic)
Ben Marks (@benmarks)

Published in: Technology

Transcript of "Magento Fireside Chat: "Wiring Mageno Projects""

  1. 1. Wiring Magento Projects Magento Fireside Chat Google+ Hangout - March 20, 2014
  2. 2. Intro – Fabrizio Branca (@fbrnc) Composer – Fabrizio Branca (@fbrnc) Magento Composer Installer – Bastian Ike (@b_ike) Lightweight approach – Fabrizio Branca (@fbrnc) Experimental approach – Daniel Fahlke (@flyingmana) Different approach – Rolando Granadino (@beeplogic) Ben’s approach – Ben Marks (@benmarks) ? – You! Q&A Agenda
  3. 3. the problem Intro
  4. 4. htdocs <Name> <theme> layout template code design etc locale <area> core community local <area> <language> modules <package> <Namespace> <package> *.xml *.csv <theme> app skin lib Module2 default layout template code design etc locale frontend local frontend de_DE modules base My base My_Module2.xml My_Module2.csv default app skin etc, Block, … js, css, img, … my_module2 my_module2 Magento My_Module My_Module2 Module default layout template code design etc locale frontend local frontend de_DE modules base My base My_Module.xml My_Module.csv default app skin etc, Block, … js, css, img, … my_module my_module
  5. 5. htdocs Module default layout template code design etc locale local frontend de_DE modules My base *.xml app My_Module2.xml My_Module2.csv my_module2 My_Module.xml My_Module.csv etc, Block, … my_module Module2 etc, Block, … my_module2 my_module
  6. 6. Magento 2
  7. 7. pub Module code My app Magento My_Module My_Module2 view Controller etc i18n Block … Module2 view Controller etc i18n Block … Magento 2
  8. 8. the requirements Intro
  9. 9. • Reuse modules • Share modules • Easy and clean uninstall without leftovers • Non-destructive (no deletion of files) • Clean Magento vanilla code • Work collaboratively on projects • Restrict access to modules for team members • Independent versioning scheme of modules • Independent version control origin the requirements
  10. 10. a solution Intro
  11. 11. modman by @colinmollenhour
  12. 12. htdocs code core community local app app/code/…/My/Module .modman My_Module app/design/… skin/frontend/… app/etc/modules/My_Module.xml modman app/code/…/My/Module My_Module2 app/design/… skin/frontend/… app/etc/modules/My_Module.xml modman <theme> layout template design etc locale <area> <language> modules <package> *.xml modman
  13. 13. “wiring” Intro modman “connects” existing modules to the Magento core, but how do we manage them?
  14. 14. htdocs code core community local app app/code/…/My/Module .modman My_Module app/design/… skin/frontend/… app/etc/modules/My_Module.xml modman app/code/…/My/Module My_Module2 app/design/… skin/frontend/… app/etc/modules/My_Module.xml modman <theme> layout template design etc locale <area> <language> modules <package> *.xml Components tools n98-magerun.phar phpunit.phar modman EnvSettingsTool composer.phar htdocs .modman Configuration Installer (Metadata, Doc,…) My_Module My_Module2 app,… and usually there’s even more stuff… These should come from different origins
  15. 15. svn:externals Git submodules Phing/Ant Custom scripts Composer Components Options works fine, but needs some getting used to it
  16. 16. Composer Intro in a nutshell…
  17. 17. Composer“Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.” phar file json configuration supports Git, SVN, tar,… and mix’n’match package management Dependency management (including fine-grained control over specific versions,…) Autoloader
  18. 18. theHackathon installer approach Approach
  19. 19. Magento Composer Installer
  20. 20. Overview • Aims to provide an easy way to install Magento modules via composer (instead of e.g. modman) • Community driven, initial started by the Magento Hackathon • Main component: magento-hackathon/magento- composer-installer
  21. 21. Components • Magento Composer installer • Package repository • Compatible with package.xml, modman and manual file mapping paths • Possible to bootstrap the Magento core, but not recommended
  22. 22. Using Magento+Composer { "minimum-stability": "dev", "require": { "fbrnc/aoe_templatehints": "*" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ], "extra": { "magento-root-dir": "htdocs/", "auto-append-gitignore": true } }
  23. 23. Using Magento+Composer { "minimum-stability": "dev", "require": { "fbrnc/aoe_templatehints": "*" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ], "extra": { "magento-root-dir": "htdocs/", "auto-append-gitignore": true } } Include dev-versions, not just final releases
  24. 24. Using Magento+Composer { "minimum-stability": "dev", "require": { "fbrnc/aoe_templatehints": "*" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ], "extra": { "magento-root-dir": "htdocs/", "auto-append-gitignore": true } } List of required packages with the required version * = newest version ! ! See composer manual for version syntax
  25. 25. Using Magento+Composer { "minimum-stability": "dev", "require": { "fbrnc/aoe_templatehints": "*" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ], "extra": { "magento-root-dir": "htdocs/", "auto-append-gitignore": true } } Include the Firegento Package Repository
  26. 26. Using Magento+Composer { "minimum-stability": "dev", "require": { "fbrnc/aoe_templatehints": "*" }, "repositories": [ { "type": "composer", "url": "http://packages.firegento.com" } ], "extra": { "magento-root-dir": "htdocs/", "auto-append-gitignore": true } } Installation-specific configuration
  27. 27. extra • magento-root-dir: Where your Magento installation lives • magento-deploystrategy: • symlink: symlink into Magento • link: hardlink into Magento • copy: copy the files instead of linking • none: no automatic deployment, if you want to use e.g. modman • auto-append-gitignore: add deployed files to .gitignore in the Magento folder • modman-root-dir: Use e.g. .modman/ instead of vendor/
  28. 28. composer install
  29. 29. Publishing packages • Add a composer.json to your extension • Publish your extension on github • Add it to packages.firegento.com
  30. 30. composer.json { "name": "fbrnc/Aoe_TemplateHints", "license": "OSL-3.0", "type": "magento-module", "description": "Advanced Template Hints for Magento", "homepage": "http://www.fabrizio-branca.de/magento-advanced-template- hints-20.html", "require": { "magento-hackathon/magento-composer-installer": "*" }, "authors":[ { "name":"Fabrizio Branca", "email":"mail@{firstname}-{lastname}.de" } ] }
  31. 31. composer.json { "name": "fbrnc/Aoe_TemplateHints", "license": "OSL-3.0", "type": "magento-module", "description": "Advanced Template Hints for Magento", "homepage": "http://www.fabrizio-branca.de/magento-advanced-template- hints-20.html", "require": { "magento-hackathon/magento-composer-installer": "*" }, "authors":[ { "name":"Fabrizio Branca", "email":"mail@{firstname}-{lastname}.de" } ] } Metadata: Author, Website, etc
  32. 32. composer.json { "name": "fbrnc/Aoe_TemplateHints", "license": "OSL-3.0", "type": "magento-module", "description": "Advanced Template Hints for Magento", "homepage": "http://www.fabrizio-branca.de/magento-advanced-template- hints-20.html", "require": { "magento-hackathon/magento-composer-installer": "*" }, "authors":[ { "name":"Fabrizio Branca", "email":"mail@{firstname}-{lastname}.de" } ] } type: magento-module ! This line activates the magento-composer-installer during composer install
  33. 33. composer.json { "name": "fbrnc/Aoe_TemplateHints", "license": "OSL-3.0", "type": "magento-module", "description": "Advanced Template Hints for Magento", "homepage": "http://www.fabrizio-branca.de/magento-advanced-template- hints-20.html", "require": { "magento-hackathon/magento-composer-installer": "*" }, "authors":[ { "name":"Fabrizio Branca", "email":"mail@{firstname}-{lastname}.de" } ] } Requirements
  34. 34. composer.json { "name": "fbrnc/Aoe_TemplateHints", "license": "OSL-3.0", "type": "magento-module", "description": "Advanced Template Hints for Magento", "homepage": "http://www.fabrizio-branca.de/magento-advanced-template- hints-20.html", "require": { "magento-hackathon/magento-composer-installer": "*" }, "authors":[ { "name":"Fabrizio Branca", "email":"mail@{firstname}-{lastname}.de" } ] } Involved Authors
  35. 35. Package Repository { "type": "vcs", "url": "git://github.com/colinmollenhour/ Cm_Cache_Backend_Mongo.git" }, { "type": "vcs", "url": "git://github.com/colinmollenhour/ Cm_Cache_Backend_Redis.git" }, { "type": "vcs", "url": "git://github.com/colinmollenhour/Cm_RedisSession.git" }, { "type": "vcs", "url": "git://github.com/colinmollenhour/Cm_Diehard.git" }, { "type": "vcs", "url": "git://github.com/fbrnc/Aoe_Scheduler.git" }, { "type": "vcs", "url": "git://github.com/fbrnc/Aoe_Profiler.git" }, { "type": "vcs", "url": "git://github.com/fbrnc/Aoe_TemplateHints.git" }, { "type": "vcs", "url": "git://github.com/fbrnc/Aoe_ReuseImages.git" }, { "type": "vcs", "url": "git://github.com/fbrnc/Aoe_ManageStores.git" }, Add your Repository to satis.json and open a pull request https://github.com/magento-hackathon/composer-repository/
  36. 36. Package.xml? modman? JSON-mapping • package.xml: Used by Magento Connect • modman: Used by modman, imho best solution.
 No support for shell scripts! • json-mapping: "map": [ ["themes/default/skin", "public/skin/frontend/foo/default"], ["themes/default/design", "public/app/design/frontend/foo/default"], ["modules/My_Module/My_Module.xml", "public/app/etc/modules/My_Module.xml"], ["modules/My_Module/code", "public/app/code/local/My/Module"], ["modules/My_Module/frontend/layout/mymodule.xml", "public/app/design/frontend/base/default/ layout/mymodule.xml"] ]
  37. 37. That's it :)
  38. 38. Links • https://getcomposer.org/ • https://github.com/magento-hackathon/magento- composer-installer/ • https://github.com/magento-hackathon/composer- repository/ • http://packages.firegento.com/ • http://magebase.com/magento-tutorials/composer- with-magento/
  39. 39. Fabrizio’s lightweightapproach Approach @fbrnc
  40. 40. Keeping it Simple!
  41. 41. AOEpeople/composer-installers "replace": { "magento-hackathon/magento-composer-installer":"*" } “inspired” by composer/installers “magento-module” “magento-source” handles package types
  42. 42. <?php namespace AoepeopleComposerInstallers; class MagentoInstaller extends BaseInstaller { protected $locations = array( 'module' => '.modman/{$name}/', 'source' => 'htdocs/' ); } AOEpeople/composer-installers
  43. 43. • Fully compatible with magento-hackathon/magento-composer-installer • Adds support for type “magento-source” • Only puts packages into place • Native modman script is used to deploy modules • Wrapped in a simple installer script AOEpeople/composer-installers
  44. 44. { { "minimum-stability":"dev", "require":{ "aoepeople/composer-installers": "*", "fbrnc/aoe_scheduler": "*", "fbrnc/aoe_cachecleaner": "*", "aoemedia/magento_enterprise": "1.13.1.0", "aoemedia/envsettingstool": "*" }, "config": { "bin-dir": "bin" } } AOEpeople/composer-installers replaces Hackathon Installer some modules Vanilla Magento Source Tools,…
  45. 45. htdocs code core community local app app/code/…/My/Module .modman My_Module app/design/… skin/frontend/… app/etc/modules/My_Module.xml modman app/code/…/My/Module My_Module2 app/design/… skin/frontend/… app/etc/modules/My_Module.xml modman <theme> layout template design etc locale <area> <language> modules <package> *.xml Components
  46. 46. Build Workflow Unit Tests,… • git clone • Add some metadata (build number, master system, package type) • (Run Composer) • (Run modman) • Packaging • Tagging
  47. 47. Deployment & Installation Workflow Update local copy of the “systemstorage” Move files to new release folder Download build package from Jenkins Extract build package Run installer Create symlinks to var/ and media/ Is master ? Import systemstorage (db and media/) Run Composer Run modman Apply settings Fix permissions Update symlinks Delete old releases install.sh deploy.sh
  48. 48. Directory layoutvar var <projectName> releases <environmentName> shared www media build_117 build_118 build_119 .modman htdocs Configuration tools install.sh app,… var media previous latest current next My_Module My_Module2 Webroot: /var/www/<projectName>/<environmentName>/current/htdocs
  49. 49. Daniel’s experimental approach Approach @Flyingmana
  50. 50. http://flyingmana.name/slides/magento-wizards_fugue-introduction.html
  51. 51. Rolando’s different approach Approach @beeplogic
  52. 52. http://slid.es/beeplogic/magesync
  53. 53. Ben’s approach Approach @benmarks
  54. 54. Thank you! Any questions?
  55. 55. http://www.youtube.com/watch?v=bscXyCy4fHc Watch the recording!

×