|
| 1 | +# Vagrant for Magento CE, optimized for Windows hosts |
| 2 | + |
| 3 | +## What You get |
| 4 | + |
| 5 | +The current Vagrant configuration aims to solve performance issues of Magento installed on Virtual Box, when the host is Windows. |
| 6 | +See [explanation of the proposed solution](docs/performance-issue-on-windows-hosts.md). |
| 7 | + |
| 8 | +With current configuration Vagrant will: |
| 9 | + |
| 10 | + 1. Run Ubuntu box |
| 11 | + 1. Install and configure all software necessary for Magento 2 |
| 12 | + 1. Install all necessary libraries |
| 13 | + 1. Install the Magento 2 application |
| 14 | + |
| 15 | +## Usage |
| 16 | + |
| 17 | +If you never used Vagrant before, read [Vagrant Docs](https://docs.vagrantup.com/v2/) |
| 18 | + |
| 19 | +### Prerequisites |
| 20 | +- [Vagrant](https://www.vagrantup.com/downloads.html) is installed and available globally in command line |
| 21 | +- [VirtualBox](https://www.virtualbox.org/wiki/Downloads) |
| 22 | +- [Composer](https://getcomposer.org/doc/00-intro.md) is installed and is available globally in command line |
| 23 | +- Make sure you have SSH keys generated and associated with your github account, see [manual](https://help.github.com/articles/generating-ssh-keys/). |
| 24 | +:information_source: You can use another way of getting codebase instead of cloning, it does not matter for successful installation. |
| 25 | + |
| 26 | +### To install the whole image from scratch |
| 27 | + |
| 28 | + 1. Run in command line from the directory which contains your projects: |
| 29 | + |
| 30 | + ``` |
| 31 | + git clone git@github.com:paliarush/vagrant-magento.git vagrant-magento |
| 32 | + git clone git@github.com:magento/magento2.git magento2ce |
| 33 | + cd magento2ce |
| 34 | + mkdir -p var/generation |
| 35 | + composer install --prefer-source |
| 36 | + cd ../vagrant-magento |
| 37 | + vagrant up |
| 38 | + ``` |
| 39 | + 1. At some point you will be prompted to [set up synchronization with PHP Storm](docs/phpstorm-configuration.md) |
| 40 | + and install Magento using: |
| 41 | + |
| 42 | + ``` |
| 43 | + vagrant provision --provision-with install_magento |
| 44 | + ``` |
| 45 | + |
| 46 | +###To reinstall Magento |
| 47 | +To save some time and get clear Magento installation, you can skip installation of software like web server or php. |
| 48 | +The following command will clear Magento DB, Magento caches and reinstall Magento instance. |
| 49 | +
|
| 50 | +Go to 'vagrant-magento' created earlier and run in command line: |
| 51 | +
|
| 52 | +``` |
| 53 | +vagrant provision --provision-with install_magento |
| 54 | +``` |
| 55 | +
|
| 56 | +### After installation |
| 57 | +
|
| 58 | +Upon a successful installation, you'll see the location and URL of the newly-installed Magento 2 application: |
| 59 | +``` |
| 60 | +Magento application was deployed in /var/www/magento2 and installed |
| 61 | +Access front store at http://${HOST}/ |
| 62 | +Access admin panel at http://${HOST}/${backend_frontame}/ |
| 63 | +``` |
| 64 | +
|
| 65 | +`/var/www/magento2` is a path to your Magento installation on the VM. |
| 66 | +
|
| 67 | +### Default credentials |
| 68 | +
|
| 69 | +``` |
| 70 | +db host: localhost (not accessible remotely) |
| 71 | +db user/password: magento/magento |
| 72 | +db name: magento |
| 73 | + |
| 74 | +also available db user/password: root/password |
| 75 | + |
| 76 | +Magento admin user/password: admin/123123q |
| 77 | +``` |
| 78 | +
|
| 79 | +### Hostname |
| 80 | +
|
| 81 | +The hostname of the Magento application is derived from hostname of the VM defined in the `Vagrantfile`: |
| 82 | +``` |
| 83 | +config.vm.hostname = "magento2.vagrant" |
| 84 | +``` |
| 85 | +
|
| 86 | +Change this value in the `Vagrantfile` if you want to use different hostname. |
| 87 | +
|
| 88 | +If Vagrant can't determine hostname of the VM for some reason, it will use its IP address (also specified in `Vagrantfile`). |
| 89 | +
|
| 90 | +Also make sure you update your system `hosts` file with a record that links the IP address and hostname of the VM. |
| 91 | +For the following `Vagrantfile` |
| 92 | +``` |
| 93 | +... |
| 94 | +config.vm.network :private_network, ip: '192.168.10.11' |
| 95 | +config.vm.hostname = "magento2.vagrant" |
| 96 | +... |
| 97 | +``` |
| 98 | +Specify the following in your `hosts` file: |
| 99 | +``` |
| 100 | +192.168.10.11 magento2.vagrant |
| 101 | +``` |
| 102 | +
|
| 103 | +### GitHub Limitations |
| 104 | +
|
| 105 | +Be aware that you may encounter GitHub limits on the number of downloads (used by Composer to download Magento dependencies). |
| 106 | +
|
| 107 | +These limits may significantly slow down the installation since all of the libraries will be cloned from GitHub repositories instead of downloaded as ZIP archives. In the worst case, these limitations may even terminate the installation. |
| 108 | +
|
| 109 | +If you have a GitHub account, you can bypass these limitations by using an OAuth token in the Composer configuration. See [API rate limit and OAuth tokens](https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens) for more information. |
| 110 | +
|
| 111 | +For the Vagrant configuration you may specify your token in `local.config/github.oauth.token` file after cloning the repository. The file is a basic text file and is ignored by Git, so you'll need to create it yourself. Simply write your OAuth token in this file making sure to avoid any empty spaces, and it will be read during deployment. You should see the following message in the Vagrant log: |
| 112 | +``` |
| 113 | +Installing GitHub OAuth token from /vagrant/local.config/github.oauth.token |
| 114 | +``` |
| 115 | +
|
| 116 | +## Related Repositories |
| 117 | +
|
| 118 | +- https://github.com/buskamuza/magento2-product-vagrant |
0 commit comments