Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit f62c113

Browse files
author
Alexander Paliarush
committed
Developer experience improvements
- Error reporting and display_errors settings set to developer values - Improved readme - XSD URN generation is executed after Magento installation
1 parent 6ddf0bf commit f62c113

10 files changed

+48
-36
lines changed

Diff for: README.md

+26-13
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@
1414
* [Reinstall Magento](#reinstall-magento)
1515
* [Clear magento cache](#clear-magento-cache)
1616
* [Debugging with XDebug](#debugging-with-xdebug)
17+
* [Multiple Magento instances](#multiple-magento-instances)
1718

1819
## What You get
1920

20-
It is expected that Magento 2 project source code will be located on the host.
21-
This is necessary to allow IDE index project files quickly. All other infrastructure is deployed on the guest machine.
21+
It is expected that Magento 2 project source code will be located and managed on the host. This is necessary to allow quick indexing of project files by IDE. All other infrastructure is deployed on the guest machine.
2222

23-
Current Vagrant configuration aims to solve performance issues of Magento installed on Virtual Box **for development**.
24-
Custom solution is implemented for Windows hosts. See [explanation of the proposed solution](docs/performance-issue-on-windows-hosts.md).
23+
Current Vagrant configuration aims to solve performance issues of Magento installed on Virtual Box **for development**. Custom solution is implemented for Windows hosts. See [explanation of the proposed solution](docs/performance-issue-on-windows-hosts.md).
24+
25+
Environment for Magento EE development is configured as well.
26+
27+
It is easy to [install multiple Magento instances](#multiple-magento-instances) based on different codebases simultaneously.
2528

2629
[Project initialization script](init_project.sh) configures complete development environment:
2730

@@ -40,21 +43,22 @@ Software listed below should be available in [PATH](https://en.wikipedia.org/wik
4043

4144
- [Vagrant 1.8+](https://www.vagrantup.com/downloads.html)
4245
- [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
43-
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git), on Windows must be [v2.7+](http://git-scm.com/download/win). Make sure you have SSH keys generated and associated with your github account, see [manual](https://help.github.com/articles/generating-ssh-keys/).<br />
46+
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). Make sure you have SSH keys generated and associated with your github account, see [how to check](https://help.github.com/articles/testing-your-ssh-connection/) and [how to configure](https://help.github.com/articles/generating-ssh-keys/) if not configured.<br />
4447
:information_source: It is possible to use another way of getting codebase instead of cloning, it does not matter for successful installation. Just put Magento 2 codebase inside of `vagrant-magento/magento2ce`.<br />
45-
:information_source: On Windows hosts make sure to set the following options to avoid issues with incorrect line separators:
48+
:information_source: ![](docs/images/windows-icon.png) On Windows hosts Git must be [v2.7+](http://git-scm.com/download/win), also make sure to set the following options to avoid issues with incorrect line separators:
4649

4750
```
4851
git config --global core.autocrlf false
4952
git config --global core.eol LF
5053
git config --global diff.renamelimit 5000
5154
```
52-
- [PHP](http://php.net/manual/en/install.php) (any version, will be installed automatically on Windows if missing) to allow Magento dependency management with [Composer](https://getcomposer.org/doc/00-intro.md)
55+
- ![](docs/images/linux-icon.png)![](docs/images/osx-icon.png) [PHP](http://php.net/manual/en/install.php) to allow Magento dependency management with [Composer](https://getcomposer.org/doc/00-intro.md)
5356
- [PHP Storm](https://www.jetbrains.com/phpstorm) is optional but recommended.
57+
- ![](docs/images/linux-icon.png)![](docs/images/osx-icon.png) [NFS server](https://en.wikipedia.org/wiki/Network_File_System) must be installed and running on \*nix and OSX hosts. Is usually available, so just try to follow [installation steps](#how-to-install) first.
5458

5559
### Installation steps
5660

57-
1. Open terminal and change directory to the one which you want to contain Magento project. On Windows use Git Bash, which is available after Git installation
61+
1. Open terminal and change directory to the one which you want to contain Magento project. ![](docs/images/windows-icon.png) On Windows use Git Bash, which is available after Git installation
5862

5963
1. Download project with Vagrant configuration:
6064

@@ -73,10 +77,10 @@ Software listed below should be available in [PATH](https://en.wikipedia.org/wik
7377
bash init_project.sh
7478
```
7579

76-
:information_source: On OSX and \*nix hosts NFS will be used by default to sync your project files with guest. On some hosts Vagrant cannot configure NFS properly, in this case it is possible to deploy project without NFS by setting `use_nfs` option in [config.yaml](etc/config.yaml.dist) to `0` <br />
77-
:information_source: On Windows hosts you might face `Composer Install Error: ZipArchive::extractTo(): Full extraction path exceed MAXPATHLEN (260)` exception during `composer install`. This can be fixed in 2 ways: decrease path length to the project directory or set `composer_prefer_source` option in [config.yaml](etc/config.yaml.dist) to `1`
80+
:information_source: ![](docs/images/linux-icon.png)![](docs/images/osx-icon.png) On OSX and \*nix hosts NFS will be used by default to sync your project files with guest. On some hosts Vagrant cannot configure NFS properly, in this case it is possible to deploy project without NFS by setting `use_nfs` option in [config.yaml](etc/config.yaml.dist) to `0` <br />
81+
:information_source: ![](docs/images/windows-icon.png) On Windows hosts you might face `Composer Install Error: ZipArchive::extractTo(): Full extraction path exceed MAXPATHLEN (260)` exception during `composer install`. This can be fixed in 2 ways: decrease path length to the project directory or set `composer_prefer_source` option in [config.yaml](etc/config.yaml.dist) to `1`
7882

79-
1. Use `vagrant-magento` directory as project root in PHP Storm (not `vagrant-magento/magento2ce`). This is important, because in this case PHP Storm will be configured automatically by [init_project.sh](init_project.sh). If NFS files sync is disabled in [config](etc/config.yaml.dist) and on Windows hosts [verify deployment configuration in PHP Storm](docs/phpstorm-configuration-windows-hosts.md)
83+
1. Use `vagrant-magento` directory as project root in PHP Storm (not `vagrant-magento/magento2ce`). This is important, because in this case PHP Storm will be configured automatically by [init_project.sh](init_project.sh). If NFS files sync is disabled in [config](etc/config.yaml.dist) and ![](docs/images/windows-icon.png) on Windows hosts [verify deployment configuration in PHP Storm](docs/phpstorm-configuration-windows-hosts.md)
8084

8185
### Default credentials and settings
8286
Some of default settings are available for override. These settings can be found in the file [etc/config.yaml.dist](etc/config.yaml.dist).
@@ -93,12 +97,16 @@ Upon a successful installation, you'll see the location and URL of the newly-ins
9397
**Codebase and DB access**:
9498
- Path to your Magento installation on the VM:
9599
- Can be retrieved from environment variable: `echo ${MAGENTO_ROOT}`
96-
- On Windows hosts: `/var/www/magento2ce`
97-
- On Mac, \*nix hosts: the same as on host
100+
- ![](docs/images/windows-icon.png) On Windows hosts: `/var/www/magento2ce`
101+
- ![](docs/images/linux-icon.png)![](docs/images/osx-icon.png) On Mac and \*nix hosts: the same as on host
98102
- MySQL DB host: `localhost` (not accessible remotely)
99103
- MySQL DB name: `magento`, `magento_integration_tests`
100104
- MySQL DB user/password: just use `mysql` with no user and password (`root/password` will be used by default)
101105

106+
**Codebase on host**
107+
- CE codebase: `vagrant_project_root/magento2ce`
108+
- EE codebase will be available if path to EE repository is specified in `etc/config.yaml`: `vagrant_project_root/magento2ce/magento2ee`
109+
102110
### GitHub limitations
103111

104112
Be aware that you may encounter GitHub limits on the number of downloads (used by Composer to download Magento dependencies).
@@ -136,3 +144,8 @@ XDebug is already configured to connect to the host machine automatically. So ju
136144
1. Set XDEBUG_SESSION=1 cookie (e.g. using 'easy Xdebug' extension for Firefox). See [XDebug documentation](http://xdebug.org/docs/remote) for more details
137145
1. Start listening for PHP Debug connections in PhpStorm on default 9000 port. See how to [integrate XDebug with PhpStorm](https://www.jetbrains.com/phpstorm/help/configuring-xdebug.html#integrationWithProduct)
138146
1. Set beakpoint or set option in PhpStorm menu 'Run -> Break at first line in PHP scripts'
147+
148+
### Multiple Magento instances
149+
150+
To install several Magento instances based on different code bases, just follow [Installation steps](#installation-steps) to initialize project in another directory on the host.
151+
Unique IP address, SSH port and domain name will be generated for each new instance if not specified manually in `etc/config.yaml`

Diff for: Vagrantfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ Vagrant.configure(VAGRANT_API_VERSION) do |config|
4848
config.vm.synced_folder '.', '/vagrant', disabled: true
4949
config.vm.synced_folder './etc', '/vagrant/etc'
5050
config.vm.synced_folder './scripts', '/vagrant/scripts'
51+
config.vm.synced_folder './.idea', '/vagrant/.idea', create: true
5152
if use_nfs_for_synced_folders
5253
guest_magento_dir = host_magento_dir
53-
config.vm.synced_folder host_magento_dir, guest_magento_dir, type: "nfs"
54+
config.vm.synced_folder host_magento_dir, guest_magento_dir, type: "nfs", create: true
5455
else
5556
guest_magento_dir = '/var/www/magento2ce'
56-
config.vm.synced_folder host_magento_dir + '/var/generation', guest_magento_dir + '/var/generation'
57-
config.vm.synced_folder host_magento_dir + '/app/etc', guest_magento_dir + '/app/etc'
57+
config.vm.synced_folder host_magento_dir + '/var/generation', guest_magento_dir + '/var/generation', create: true
58+
config.vm.synced_folder host_magento_dir + '/app/etc', guest_magento_dir + '/app/etc', create: true
5859
end
5960

6061
shell_script_args = [

Diff for: docs/images/linux-icon.png

3.63 KB
Loading

Diff for: docs/images/osx-icon.png

949 Bytes
Loading

Diff for: docs/images/release_badge.png

-1
This file was deleted.

Diff for: docs/images/release_badge.svg

-1
This file was deleted.

Diff for: docs/images/windows-icon.png

3.87 KB
Loading

Diff for: init_project.sh

+12-18
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ set -ex
1111

1212
bash "${vagrant_dir}/scripts/host/check_requirements.sh"
1313

14+
# Install necessary vagrant plugins if not installed
15+
vagrant_plugin_list=$(vagrant plugin list)
16+
if ! echo ${vagrant_plugin_list} | grep -q 'vagrant-hostmanager' ; then
17+
vagrant plugin install vagrant-hostmanager
18+
fi
19+
if ! echo ${vagrant_plugin_list} | grep -q 'vagrant-vbguest' ; then
20+
vagrant plugin install vagrant-vbguest
21+
fi
22+
if ! echo ${vagrant_plugin_list} | grep -q 'vagrant-host-shell' ; then
23+
vagrant plugin install vagrant-host-shell
24+
fi
25+
1426
# Generate random IP address and host name to prevent collisions, if not specified explicitly in local config
1527
if [ ! -f "${vagrant_dir}/etc/config.yaml" ]; then
1628
cp "${config_path}.dist" ${config_path}
@@ -52,28 +64,10 @@ if [ ! -d ${magento_ce_dir} ]; then
5264
fi
5365
fi
5466

55-
var_generation_dir="${magento_ce_dir}/var/generation"
56-
if [ ! -d ${var_generation_dir} ] ; then
57-
if [[ ${host_os} == "Windows" || $(bash "${vagrant_dir}/scripts/host/get_variable_value.sh" "guest_use_nfs") == 0 ]]; then
58-
mkdir ${var_generation_dir}
59-
fi
60-
fi
61-
6267
# Update Magento dependencies via Composer
6368
cd ${magento_ce_dir}
6469
bash "${vagrant_dir}/scripts/host/composer.sh" install
6570

66-
# Install necessary vagrant plugins if not installed
67-
if ! vagrant plugin list | grep -q 'vagrant-hostmanager' ; then
68-
vagrant plugin install vagrant-hostmanager
69-
fi
70-
if ! vagrant plugin list | grep -q 'vagrant-vbguest' ; then
71-
vagrant plugin install vagrant-vbguest
72-
fi
73-
if ! vagrant plugin list | grep -q 'vagrant-host-shell' ; then
74-
vagrant plugin install vagrant-host-shell
75-
fi
76-
7771
# Create vagrant project
7872
cd ${vagrant_dir}
7973
vagrant up

Diff for: scripts/provision/configure_environment.sh

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ sudo a2dissite 000-default
3030
# Setup PHP
3131
if [ ${use_php7} -eq 1 ]; then
3232
sed -i "s|;include_path = \".:/usr/share/php\"|include_path = \".:/usr/share/php:${guest_magento_dir}/vendor/phpunit/phpunit\"|g" /etc/php/7.0/cli/php.ini
33+
sed -i "s|display_errors = Off|display_errors = On|g" /etc/php/7.0/cli/php.ini
34+
sed -i "s|display_startup_errors = Off|display_startup_errors = On|g" /etc/php/7.0/cli/php.ini
35+
sed -i "s|error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT|error_reporting = E_ALL|g" /etc/php/7.0/cli/php.ini
3336
else
3437
# Uninstall PHP 7 pre-installed in the box
3538
apt-get remove -y php*

Diff for: scripts/provision/install_magento.sh

+3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ if [ ${use_nfs_for_synced_folders} -eq 0 ]; then
8282
chown -R vagrant:vagrant ${guest_magento_dir}
8383
fi
8484

85+
# Generate XSD references for PHP Storm
86+
php bin/magento dev:urn-catalog:generate /vagrant/.idea/misc.xml
87+
8588
set +x
8689
echo "
8790
Magento application was deployed to ${guest_magento_dir} and installed successfully

0 commit comments

Comments
 (0)