Vagrant provides convenient way to set up development environment consistently on different hosts (see more). Typically it uses Virtual Box as a provider with *nix system as guest OS. This allows Magento developers who use Windows machines to run their Magento instance in *nix environment similar to those on Bamboo or production. Project files editing, work with Git and running tests is usually done on host OS (Windows), since this approach provides better user experience. However, in this case project files must be synchronized between host and guest OSs to allow code modifications be visible on the running Magento instance as well as provide access to auto-generated files (e.g. view materialized files, generated classes) in the IDE. So two-way synchronization is required.
Developers, who use Magento installed on Vagrant for daily development in Windows environment, complaint about Magento performance issues. The main reason for performance degradation is that default synchronization (Virtual box shared folders) is used for project files synchronization on host and on guest OSs. PHP requests all source files from the host, also lost of files are created by the Magento instance on the fly in non-production mode, which are immediately synchronized with the host. There are several other types of files synchronization available, but all of them have issues, which spoil developer experience:
Even though there are no out-of-the-box solution which satisfies our developer experience requirements, we can apply hybrid approach, which:
To solve performance degradation problem, local copy of the project should be stored on host (for good indexing performance in IDE) and on the guest (to avoid delays caused by PHP requesting remote files via network). This cannot be achieved with built-in Vagrant synchronization capabilities. However, this can be done using one-way PhpStorm project deployment to remote host or by using rsync. This approach has one drawback: all files generated on the guest, will not be visible to IDE and as a result autocomplete for auto-generated classes will be unavailable. This issue can be overcome by enabling two-way Vagrant synchronization for those files which should be downloaded from guest OS.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。