The perfect Magento 2 setup for development

Please note: This article is work in progress!

 

I had the pleasure to attend MageUnconference again this year (thanks to Modulwerft – Simon Sprankel for the ticket btw!). As usual for an Unconference, we collected the topics for our daily programme in the morning. Out of some discussions I had with Matthias at the office regarding the easiest/best/most painless way to set up an environment for M2 module development, we decided to put this as a topic on the wall for voting and discussion with other attendees.

A few minutes and a lot of votes later, we’ve found ourselves in a packed room full of developers who wanted to hear and discuss with us about this topic as well.

Spoiler: You’re maybe not gonna find the perfect Magento 2 setup for module development in this article. This is a collection of things that can be useful for your setup and what we discussed during our session at MageUnconference.

Out of scope: This article is not about setting up a new project with Magento 2. I do only focus on the development of a single module here.

 

Various M2 module development methods

Seperate Repository

The first method I’d like to share here is the method of setting up a single repository for your new module: This can either be a local repository or a remote one on GitHub/Bitbucket.

Add this module to your composer.json just as any 3rd party module and you’re good to go.

{
    "require": { "avoelkl/mymodule": "*" },
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/avoelkl/mymodule.git"
        }
    ]
}

Positive:

+ Easy way to start and set up

+ There’s only the need to add your module to composer.json, no additional registration/modification needed.

Negative:

– You have to do a lot of git commits/push/pulls/composer updates for your changes to take effect

– You’ll generate a lot of unneccessary commits during development (especially if you’re new to M2 development and trying out some stuff)

 

Working in the vendor dir

This approach it pretty straight forward: Set up a new Git repository, add it to the composer.json and run composer update. You’ll find your module files in the vendor directory afterwards, where you can edit them.

While I personally do not prefer this method as it feels rather dirty to me, applying changes and developing directly in the vendor folder seems not to be so unusual among Magento developers present in the MageUnconference session.

Positive:

+ no need to commit every change to test it

Negative:

– It’s not very obvious where the extension development happens.

– When someone else/you decide to remove the vendor folder completely (which should not be a problem usually, as you can always get the recent packages via composer install/upadte), you will lose all your uncommitted changes.

At least composer warns you if you have got modified content in the vendor dir when running a “composer update” so you don’t lose your changes without confirming before.

Symlink to your module

Another easy way, which requires no Git repo at all to get started (but seriously, who wants that?) is to create a symlink in app/code to your module files outside the Magento folder structure.

 

You could also be interested in including a local repo via composer path https://getcomposer.org/doc/05-repositories.md#path

{
    "repositories": [
        {
            "type": "path",
            "url": "../../avoelkl/mymodule",
            "options": {
                "symlink": false
            }
        }
    ]
}

Folder Structure

From Magento 1 we’re used to work with our own folder structures and symlink them later via modman file.

Most of the current M1 modules I know either have the `app/` folder directly in their extension repo or a `src/` folder above them:

Version 1:

  • app/ modman

Version 2:

  • src/
  • src/app
  • test
  • modman

It seems to me (from what I can see in the official Magento 2 sample modules) that such a folder structure is not the default somewhat suggested, I think this is not very flexible.

  • .git
  • Block/
  • etc/
  • Model/
  • Observer/
  • view/
  • registration.php
  • composer.json

Different Ways of Setups

Fabian Schmengler (@fschmengler)

Fabian explained his current structure during the session.
The folder structure looks like this:

/var/www/m2.local/MyExt <= this folder also contains the .git dir

registration.php & Subfolders

/var/www/m2.local/MyExt/registration.php
/var/www/m2.local/MyExt/src
/var/www/m2.local/MyExt/test


Daniel Falke (@flyingmana)

https://github.com/Cotya/DashboardProject

David Verholen (@david_verholen)

https://github.com/davidverholen/magento2-dynamic-component-registry

Max Pronko

Max wrote a Blogpost about how to develop a Magento 2 module with modman

Magento CE 1.9.2.2 database diagram

Update: Here’s the new version of a Magento CE 2.1.3 database diagram.

Every now and then someone on the Internet asks for a Magento database diagram, like this question here on MagentoSE.

While there are a lot of cool resources out there (which are unfortunately a bit outdated), I created a new one.

This is the database diagram of a fresh CE 1.9.2.2 installation.

Some statistics (because I love statistics):

  • Magento CE 1.9.2.2 consists of 333 tables
  • 19 tables start with core_*
  • 47 tables start with sales_*
  • 84 tables start with catalog_*

How to read it & find stuff:

  • Catalog is on the very left (big yellow group)
  • Sales is on the very right (big blue group)
  • EAV and Core stuff is in the middle (the brown & orange groups)
  • Customer tables are in the middle/bottom (big green group)
  • The rest (salesrules, logs, reports, newsletter, tags, poll, etc.) is on the bottom

If you like it, go and upvote my answer on MagentoSE 😉

Have fun with it!

Magento CE 1.9.2.2 database diagram

Link: Magento CE 1.9.2.2 database diagram

Feedback on the diagram is welcome. Especially on some lonely tables that I moved to the best of my knowledge and belief into one of the groups.

 

Windows 10: VPN settings not available & DNS problem

Update: Windows Update 1511 solved the problem with the non-accessible DNS settings. You might need to set the Standardgateway though:
VPN Connection > Properties > Network >  IPv4 > Properties > Advanced > IP-Settings
[X] Use default gateway for remote network


 

The Problem

The network settings window of my VPN adapter was not accessible. Means: It was there, not greyed out but clicking on it did not open the settings tab.

First stop(s):

http://superuser.com/questions/949306/windows-10-windows-vpn-ipv4-properties-not-accessible
http://answers.microsoft.com/en-us/insider/forum/insider_wintp-insider_web/network-connection-vpn-ipv4-properties-not-working/a60edf99-4b06-4219-bb75-b7c08de4ff9e

The File

The first place to get rid of my problem after the first recommendation: Adjust stettings in this file:

“C:\Users\USERNAME\AppData\Roaming\Microsoft\Network\Connections\Pbk\rasphone.pbk”

Change the following settings:

IpPrioritizeRemote=1 => IpPrioritizeRemote=0
IpInterfaceMetric=0 => IpInterfaceMetric=1

I was looking for some fast fix but: Nothing changed. Enabled/disabled the connection: not better.

PowerShell

Run the PowerShell as Admin:

Check VPN connection:

Get-VpnConnection

Set SplitTunneling:

Set-VpnConnection -Name "YOURVPNNAME" -SplitTunneling $True

Again: nothing happened.

Enabled/disabled the connection again, nothing happened.

Back to the config file

I tried to set the DnsAddresses in there:

IpDnsAddress=10.0.0.11
IpDns2Address=10.0.0.11

(note: these are not the real DNS settings)

as well as setting it via command prompt:

netsh int ip set address "YOURVPNNAME" gateway=10.0.0.11

Disconnecting + Connecting again: no luck.

nslookup

After some more research I found out it could also be a DNS issue. I ran “nslookup” form the command prompt and checked the gateway.
This showed my local gateway.

Getting closer?

IPv6 & Split tunneling

Some hints on that from the Microsoft forum:

No. 1:

This seems to be IPv6 related.
It keeps using my ISP’s IPv6 DNS server instead of my company’s (IPv4 only) DNS server.
If I disable IPv6 on my LAN network adapter, it starts working.

No. 2.:

Ok, it works, when SplitTunneling is disabled (Remote Gateway on) and IPv6 disabled.

I disabled SplitTunneling (again) and IPv6 on my WiFi and VPN. No luck.

 

Maybe these settings about help someone else resolving the issue. Some lucky users were able to resolve the problem after the very first step by editing the config file.

To be continued.

Ubuntu: Nicht genügend freier Festplattenspeicher für Aktualisierung

Bei der Installation der letzten Ubuntu Updates kam folgende Meldung:

Nicht genug freier Festplattenspeicher verfügbar

Die Systemaktualisierung benötigt 72,5 M an freiem Speicherplatz auf der Festplatte “/boot”. Bitte stellen Sie mindestens x M an zusätzlichem Speicherplatz auf der Festplatte “/boot” zur Verfügung. [..]

Die Lösung war folgender Befehl aus dem Ubuntu-Forum der die alten Header aus /boot entfernt:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

 

FAQs about MageUnconference 2015

The first MageUnconference took place on March 7th & 8th in Berlin. You’d like to know how it was? Read the FAQs!

What’s an unconference?

Like an conference, but without any planned talks and with muuuch more and longer breaks. Someone Sander said to me in one of the breaks (sorry for not remembering, who it was I do SO remember it was Sander): “MageUnconference is a great combination of user group meeting and sessions”.

It was such a relaxed athmosphere according to conferences where people just rush from talk to talk and hardly have time to chat during breaks. It was my first unconference and – omg – unconferences are awesome! It was also the very first MageUnconference btw!

How was the preparty?

We had a few beers, we had food, I met a lot of people I already knew and a lot of new ones and some even not known from twitter before!

According to Fabian we didn’t manage to spend all the money that was sponsored for the preparty. Reminder for next time to all: Drink more beer or start earlier 😉

I also tried Ginger-Beer, I cannot recommend it.

The preparty took place in the Lindenbräu in the Sony-Center btw. After the last round of drinks we went for the After Pre-Party in the bar on the other side of the street of the Motel One.

2015-03-07 00.38.45 2015-03-07 00.38.53 2015-03-07 01.43.18 2015-03-07 02.14.13

Where did you stay?

After rumours on twitter, a lot of us booked their room in the Motel One at Ku’Damm (thanks Tobi for your tweet, i think everyone followed that). That was pretty cool as there was always someone around to go together to the Unconference and back.

I’m not sure which way was longer: The one from the elevator to my hotel room or the one to the toilets in the Abenteuerzentrum.

How did you get to the venue?

Driving with the bus from the Motel One! Despite my concerns beforehand it worked out better than I thought. My new favourite bus line in Berlin is now X10. Going with the bus, especially when going with a group of people, requires some attention from at least one of the group. Otherwise you will miss the station to get out. We had some near-misses.

2015-03-07 08.24.34

The Eichhörnchensteig is just right after the Waldmeisterstraße. The way to the Abenteuerzentrum was very idyllic.

Eichhörnchenweg 2015-03-08 14.13.19 2015-03-08 14.08.28

How was the venue?

The Abenteuerzentrum lies inbetween a lot of trees and green. It’s quite big and has a long way to the toilets (don’t forget to pass by when you’re in a session in the room “Bob”). We were lucky and the weather was very nice during MageUnconf which made it possible to sit outside, have breakfast outside and also sessions.

We had WIFI there which was reliable most of the time (depending on your location) and – for people like me without data plan in Germany – really essential to follow up all the tweets 🙂

2015-03-08 09.49.25 2015-03-08 14.07.24

What about the sessions?

Everyone had the chance to add topics he/she wanted to hear or talk about. The topics were collected on a wall, then introduced with a few words. A detailed picturized explanation about how that works can be found in Carmen’s Blogpost.

The good thing is: There are 3 (or even 4) dev-tracks.

The bad thing is: There are 3 (or even 4) dev-tracks.

Which means: You have to decide which one of all those cool sessions to attend! What I really liked were the discussions that evolved out of the sessions and also the quality of the topics was very good!

There were sessions about: Module testing, Magento search, Burnout, Magento and Bootstrap, Scaling Magento (day 1), Recommender systems, design patterns: abstract factory, Mistake Driven Development, Vagrant, Magento Meetups, Code Usablity, CRM and a lot more!

I even got to do my “First Aid – Survival Guide for web developers” session together with Benno which was really cool.

 

2015-03-07 11.21.56 2015-03-08 10.51.40

What did you eat aka How was the food?

There was lots of food! So much of it, that I cannot even list it all here. There was food all the time: apples, carrots, mandarines, cookies, cake, cereals, various kinds of break with various toppings. Lunch on saturday and sunday was vegan (the pumpkin soup on sunday was great btw!).

And there were a lot of softdrinks and 1337mate and Mischmasch and Coke and sparkling water (good quality sparking water from Vöslauer – Austrian company 😉 ) and much more!

2015-03-08 10.03.00 2015-03-08 10.03.05 2015-03-08 10.03.12

How was the afterparty?

There was a fireshow which was performed by “Feuer und Poesie” – omg, that voice! And omg, that fireshow!

After that we had delicious food from the barbecue.. For even more entertainment throughout the evening there was table tennis, dart and air hockey!

How many people attended the event?

I have no idea about the official number. Right before the event, 94 participants have been officially announced. Some didn’t show up or arrived later but there were still a lot of Magento people 🙂

Most of them were from Germany and the Netherlands, but there were also participants from Switzerland (2), UK (1.5, yeah, David, you’re the 0.5) and Austria (1). Hope I did not forget a country here.

There were a lot of cool Magento developers, but also project managers, sales & marketing guys/gals,… See #mageuc15 tweets for a list of people 🙂

One special thing I’d like to mention is that 3/4 of the MageStackDay-team met there 🙂

 

Did you like it?

Yes! And I hope there will be a #mageuc16!

Special thanks to the amazing team organizing MageUnconference: Fabian Blechschmidt, Rico Neitzel, Tobias Klose, Carmen Bremen and Vinai Kopp!

More information?

www.mageunconference.org
#mageuc15 Tweets

More Blogposts?

Check out these cool Blogposts:

English:

German:

MageEngage: Lerne die Magento Community kennen

David Manners hat eine neue Serie mit Interviews gestartet, um mehr über die coolen Menschen der Magento Community und ihre Freizeitaktivitäten zu erfahren. Das Ziel von MageEngage ist, die Magento Community der Magento Community vorzustellen.

David hat auch einen Beitrag auf MageHero mit seinen Gedanken dazu verfasst.

Für die erste Ausgabe von MageHero hat David mich über meine Aktivitäten im Rettungsdienst beim Österreichischen Roten Kreuz interviewed. Danke für das Interview, David!

Episode 1: Rescue Anna

Zusammenfassung des Interviews:

  • Ich bin seit ich 15 war beim Roten Kreuz
  • Ich habe meine Ausbildung zum Rettungssanitäter mit 17 begonnen und später meine Ausbildung zum Notfallsanitäter gemacht.
  • Eine Dienstschicht (in der Nacht oder am Wochenende) dauert 10-12 Stunden
  • Ich mache zwischen 1 bis 5 Mal im Monat Dienst.
  • Im Rettungsdienst fahren wir zu allen möglichen Dingen von denen man sich vorstellen kann, dafür eine “Rettung” zu rufen: alle möglichen Verletzungen, Unfälle und interne Notfälle.
  • Ich bin ziemlich selbstlos mit der Nutzung meiner Freizeit 🙂

Weitere Dinge, die ich beim Österreichischen Roten Kreuz in Niederösterreich bzw. in Herzogenburg mache und ich nicht im Interview erwähnt habe:

  • Mitglied der IT & Telecom Emergency Response Unit für Internationale Katastrophenhilfe
  • Beziksstellenverantwortliche für Jugendarbeit
  • Sichere Einsatzfahrerin
  • Rotkreuz-Zugskommandant (Führungskräfteausbildung Ebene 3 – Offizier – absolviert)

Mehr Infos über MageEngage:

MageEngage: Getting to know the Magento community

David Manners started a new series of interviews to find out more about the cool people in the Magento community and what they do in their free time. The aim of MageEngage is to introduce the Magento community to the Magento community. There’s also a post on MageHero with Davids thoughts.

In the first episode he interviewed me about my activities as a volunteer at the Austrian Red Cross ambulance service. Thanks for the interview, David!

Episode 1: Rescue Anna

Summary of the interview:

  • I joined the Austrian Red Cross at the age of 15
  • I started my training as EMT when I was 17 and continued later doing my training as paramedic (not the same level as in the US)
  • A duty (during night or on weekends) lasts between 10-12 hours
  • I go for 1 to 5 duties per month
  • We go for everything you can imagine to call an ambulance for: all kinds of injuries, accidents and cases of internal medicine,…
  • I’m pretty selfless with spending my time

Other things I do at the Austrian Red Cross in Lower Austrian and Herzogenburg which i did not mention in the interview (time is short):

  • Member of the IT & Telecom Emergency Response Unit of the Austrian Red Cross for International Disaster Response
  • Responsible for the local Red Cross youth groups
  • Ambulance driver
  • Red Cross officer within the chain of command

Find out more about MageEngage:

Ubuntu Software & Tools

After some troubles and having enough of Windows, I switched to Ubuntu 14.04 LTS on my Lenovo X1 Carbon (2012 Edition) at the end of January 2015.

This is my collection of software and tools which I am using and which were recommended.

Some of the software I use:

  • KeePass 2 + mono + Firefox Plugin
  • PhpStorm
  • Apache, MySQL, PHP, git, composer, n98-magerun
  • Spotify test version
  • Skype (love the compact design compared to the new Windows version)
  • Radio Mobile with Wine (downloading from external works despite some install notes)
  • Wavemon
  • CompizConfig Settings Manager (ccsm)
  • Zsh

Thanks to my dear twitter followers, I also got the following recommendations:

  • Microsoft Office + Wine (thanks Th3Z0ne). Office 2013 does not work by the way (i tried it and was looking for solutions). Office 2010 should work (did not install it yet).
  • Remmina for SSH (already pre-installed, thanks Sander)
  • terminator (thanks Roman): Great tool. After I got used to it, I prefer it to Remmina. I can recommend this How-To.
  • shutter (Roman)
  • virtualbox + vagrant + nfs sharing (Roman)
  • Meld diff (Sander)

to be continued.