jonathanbossenger / boss-box-lamp

A modern, easy to configure, WordPress ready Vagrant box, perfect for local development.
GNU General Public License v2.0
5 stars 2 forks source link

Boss Box

A modern, easy to configure, WordPress ready Vagrant box, perfect for local development.

Credits

This project was inspired by Scotch Box and built using the Scotch Box Pro build scripts by Nicholas Cerminara. If you like this project, please also consider supporting Nick by purchasing a Scotch Box Pro license at a mere $15.

What's included?

Base Web Server Stack (LAMP)

  1. Ubuntu 16.04 LTS
  2. Apache 2
  3. MySQL 5.7
  4. PHP 7.0

Utilities

  1. Git
  2. Vim
  3. Imagemagick
  4. Curl

Additional Software

  1. PHPUnit
  2. PHPMyadmin
  3. Xdebug
  4. Composer
  5. WP-CLI
  6. Ngrok
  7. Node.js
  8. Memcached
  9. Go
  10. MailHog

Configuration options

  1. Edit sitename, IP address, database name, and MySQL root password
  2. Set Virtual Machine memory size
  3. Ability to enable/disable update checks (when working offline)

Required Software

Make sure you have the following software installed

  1. Vagrant
  2. VirtualBox

Recommended Software

Vagrant Hosts Updater

This plugin will allow your system to manage writing to the hosts file automatically, instead of having to edit /etc/hosts each time.

A note on Vagrant box size

The Boss Box image is approximately 900mb in size. This means that the first time you use it, you'll have to download it to your hard drive, meaning your first vagrant up could take a little while.

Initial Setup (Linux/OSx)

From a terminal window:

Clone the github repo

git clone git@github.com:jonathanbossenger/boss-box-lamp.git

Switch to the boss-box-lamp directory

cd boss-box-lamp

Copy the 'vagrant' folder to your project web root

cp -r vagrant/ /path/to/myproject/webroot/vagrant/

Switch to the project vagrant directory

cd ~/path/to/myproject/webroot/vagrant/

Edit the settings.yaml file in the newly copied /path/to/myproject/webroot/vagrant/ directory as required.

Start BossBox

vagrant up

Basic Vagrant Usage

vagrant up

Start the virtual machine

vagrant halt

Stop the virtual machine

vagrant ssh

Login to the virtual machine via SSH

Create a new WP Site

Login to the virtual machine via SSH

vagrant ssh

Switch to the /var/www/public directory

cd /var/www/public

Download WordPress via the CLI

wp core download

Create the wp-config.php file, replace {database_name} and {password} with the values you set for those fields in your settings.yaml.

wp config create --dbname={database_name} --dbuser=root --dbpass={password}

Run the famous 5 second WP-CLI install, replace {sitename} with the value you set for that field in your settings.yaml and change the rest to suit your needs.

wp core install --url={sitename} --title=Example --admin_user=supervisor --admin_password=strongpassword --admin_email=info@example.com

Browse to your Vagrant IP address or sitename and see your WP instal.

Access

You can access the local site by either the IP address or sitename specified in your settings.yaml (if you have set the relevant /etc/hosts record)

http://192.168.33.10 or http://sitename

PHPMyAdmin

http://192.168.33.10/phpmyadmin or http://sitename/phpmyadmin

MailHog

http://192.168.33.10:8025 or http://sitename:8025

Using Xdebug with PHPStorm

This box has Xdebug installed and is setup to make use of the Zero-configuration Debugging with PhpStorm

  1. Either setup the PHPStorm Bookmarklets or install the Xdebug helper for Chrome
  2. Start debugging from the browser using whichever option you've chosen above
  3. Make sure PHPStorm is listening for incoming debug connections (Run > Start listening for PHP debug connections)
  4. Set breakpoints in your PHPStorm code window
  5. Refresh your project url

On the first run, PHPStorm will ask you to map the debugger to a local path, you should be able to accept the defaults.

PHP.ini settings

Boss box has it's own custom PHP.ini file for overriding the default PHP.ini. You can find this file in the following location.

/etc/php/7.0/apache2/conf.d/user.ini

Enjoy!