Vagrant box of choice: debian/stretch64 (Debian 9)
Should work on Ubuntu boxes as well.
Generally latest versions available (otherwise specified major.[minor] that matters)
- Apache 2
- PHP 5.6 (php5.6-fpm)
- PHP 7.2 (php7.2-fpm)
- Mysql 5.5.9999 (MariaDB 10)
- MailHog
- Node.js 8
- bower
- curl
- eslint
- git
- gulp
- lynx
- vim
- vue-cli
- yarn
- Midnight Commander
Guest machine timezone: Europe/Moscow
Guest machine locale: en_US.UTF-8
- VirtualBox (5.2.22 at the moment)
- Vagrant (2.2.1 at the moment) — Vagrant service and API understanding
- vagrant-vbguest Vagrant handy plugin which automatically installs the host's VirtualBox Guest Additions on the guest system.
Ansible (2.7.2 at the moment) is required but not in the list, because Vagrant will take care of this dependency on guest machine. For Debian box installation of Ansible latest version solved by pip package installer. Ubuntu does not need it, installation runs via ppa:ansible/ansible repository.
Noteworthy Windows issue: box do not properly initialize due to lack of rsync method folders synchronization.
Fix: in file {Drive|C}:\Users\{your_username}\.vagrant.d\boxes\{box_name}\{box_version}\virtualbox\include\_Vagrantfile
this
config.vm.synced_folder ".", "/vagrant", type: "rsync"
must be changed to
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
Consider this directory where it all will be fired up (as example):
{vagrant_box}
= ~/vagrant_boxes/local-webdev-environment
cd ~/vagrant_boxes
git clone https://github.com/dapertutto/local-webdev-environment.git
Sites config in {vagrant_box}/ansible/roles/webdev/vars/main.yml
Before provisioning sites' home dirs must physically present in {vagrant_box}/sites
({vagrant_box}/sites/test.dev/www
concerning config) — i.e. create them before the provisioning or else it will fail.
Corresponding domains must be added to the host's machine hosts
file:
Windows:\Windows\system32\drivers\etc\hosts
Linux: /etc/hosts
as follows:
127.0.0.1 test.loc www.test.loc
After successful vagrant up
gain access to:
- http://test.loc:8056 — test.loc php 5.6 through php5.6-fpm (and so other sites via port 8056)
- http://test.loc:8072 — test.loc php 7.2 through php7.2-fpm (and so other sites via port 8072)
- http://localhost:8072/phpmyadmin — phpMyAdmin (auth by config, no need to relogin; btw Mysql credential is
root:root
, shoo!). If you encounter pesky alert popup (concerning internal php warnings). Go to the settings page -> Features -> General -> setSend error reports
option to "Never send error reports". - http://127.0.0.1:8025 — MailHog mailcatcher service to test email sending locally
- Composer runs as
composer
in shell - php Xdebug on 9001 port. I'm using Firefox add-on Xdebug Session Cookie to trigger catching by IDE.
After adding (or removing) sites to sites config var in {vagrant_box}/ansible/roles/webdev/vars/main.yml
don't forget to vagrant reload --provision
or vagrant up --provision
, depending on virtual machine state.
Cheers!