Skip to content

Local multi-site webdev environment based on Vagrant via VirtualBox provisioned by Ansible

License

Notifications You must be signed in to change notification settings

dapertutto/local-webdev-environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local multi-site webdev environment based on Vagrant via VirtualBox provisioned by Ansible

Vagrant box of choice: debian/stretch64 (Debian 9)

Should work on Ubuntu boxes as well.

What will be installed and configured ⚒️

Generally latest versions available (otherwise specified major.[minor] that matters)

Guest machine timezone: Europe/Moscow

Guest machine locale: en_US.UTF-8

Prerequisites ⚠️

  • 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"

Usage 💻

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 -> set Send 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!

May the almighty Cat be with you 😺

About

Local multi-site webdev environment based on Vagrant via VirtualBox provisioned by Ansible

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published