Click Rain Breeze
A PHP CLI tool for managing LAMP projects within a Vagrant environment, (*1)
Introduction
Breeze is a toolset for quickly spinning up websites in a virtual development environment. Inspired by early versions of Laravel Homestead, Breeze seeks to eliminate or simplify the steps needed to start development on a PHP project. It provides a Vagrant environment with pre-configured software (Ubuntu 14.04, Apache, MySQL, PHP, Git, etc) as well as single configuration file for managing all of your sites, so creating a development site is as simple as copy/pasting and running a few simple commands., (*2)
Breeze is especially helpful for maintaining websites that currently exist on your servers. Setting up an existing website in a development environment can be a pain, but Breeze automates common tasks like creating virtual hosts, replicating databases, and pulling down fresh versions of site assets. Tasks that used to take several minutes now take seconds, which means you can spend more time writing code and solving problems., (*3)
Prerequisites
Before launching your Breeze environment, you will need to install the following software on your system:, (*4)
Remote Environments
Breeze provides some tooling for "pulling" databases and files from a server into your local development environment. Breeze is opinionated about how it expects to interact with your remote environments. To use Breeze's features for syncing databases and remote files, you will need the ability to access your remote servers over SSH using an identity file for authentication. Common tools such as rsync
and mysqldump
are also required in your remote environments for some operations., (*5)
Installation and Setup
Before launching your Breeze environment, you will need to install VirtualBox, Vagrant, PHP, and Composer on your system. If you are using Windows, you will need to use Git BASH or an equivalent terminal. Also, if you're using Windows, there are a few caveats to using Breeze that are outlined below., (*6)
Install the Ubuntu Box
Breeze uses an Ubuntu box as it's virtualized environment. Use Vagrant to add the box:, (*7)
vagrant box add ubuntu/trusty64
Install Breeze
Install Breeze globally using composer:, (*8)
composer global require clickrain/breeze dev-master
Make sure that composer bin
directory is in your path:, (*9)
export PATH=~/.composer/vendor/bin:$PATH
Typing breeze
in a terminal and hitting ENTER
should show a list of Breeze commands. Now to initialize the Breeze configuration, run the following command:, (*10)
breeze init
This will install a directory called .breeze
in your home directory. This is where your main Breeze.yaml
configuration file will reside, along with some other files that Breeze will use., (*11)
Setup Autocompletion
It's highly recommended that you setup autocompletion for Breeze. Add the following to your .bash_profile
:, (*12)
eval $(breeze _completion --generate-hook --program breeze)
Source your .bash_profile
file to begin using immediately:, (*13)
source ~/.bash_profile
Now typing breeze
followed by the TAB
key should provide a list of available commands and options., (*14)
Mac OSX Users: You may need to configure bash completion on OSX if you haven't already. Follow instructions at https://github.com/bobthecow/git-flow-completion/wiki/Install-Bash-git-completion to get autocompletion configured correctly., (*15)
Start your Breeze Machine
You can start your Breeze machine with breeze up
. The first time you run this command, Breeze will provision your machine and get it ready for you to start developing!, (*16)
Configuring Breeze
When you initialize Breeze using breeze init
, a starter configuration file ~/.breeze/Breeze.yaml
is created. You can edit this file to make changes to your Breeze machine., (*17)
Breeze also allows you to quickly edit your Breeze.yaml
configuration file just by typing breeze edit
in your terminal. (You may need to setup your default editor in order for this to work.), (*18)
Example Configuration File
Below is an example breeze config file. This config file is explained in detail below:, (*19)
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/workspace
to: /var/www/vhosts
ports:
- send: 9999
to: 9999
servers:
- id: web1
user: james
host: web1.example.net
port: 22
sites:
- id: example.com
aliases: [example.dev]
path: /var/www/vhosts/example.com
document_root: httpdocs
server: web1
server_path: /var/www/vhosts/example.com
uploads_path: public/uploads
databases:
- id: example
local_name: example
local_user: example
local_password: secret
remote_name: example_prod
remote_user: example_prod
remote_password: prodsecret
remote_host: localhost
remote_port: 3306
server: web1
VM Configuration
The following configuration items are available to configure your virtual machine., (*20)
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
Here's a brief description of each item:, (*21)
Key |
Description |
ip |
Private network IP address of the machine |
memory |
Machine memory in MB |
cpus |
Processors assigned to this machine |
provider |
Vagrant provider - Breeze is currently only tested using virtualbox
|
authorize |
This file is copied to the Breeze guest's authorized_keys for simplified SSH access |
keys |
A list of keys to copy to the Breeze guest machine |
Folders
The folders config section describes how folders on the host machine are mapped to the guest (Breeze) machine., (*22)
folders:
- map: ~/workspace
to: /var/www/vhosts
In the above example, the /home/user/workspace
directory on the host machine is mapped to /var/www/vhosts
in Breeze., (*23)
Ports
By default, the following ports are automatically forwarded from the Breeze guest machine to your host machine:, (*24)
-
HTTP: port 8000 → port 80
-
HTTPS: port 44300 → port 443
-
MySQL: port 33060 → port 3306
The ports config section allows you to forward additional ports from your host machine to the Breeze guest machine., (*25)
ports:
- send: 9999
to: 9999
Servers
The following is an example entry in the folders configuration section:, (*26)
servers:
- id: web1
user: james
host: web1.example.net
port: 4561
Here's a breakdown of what each item means:, (*27)
Key |
Description |
id |
Unique identifier for the server. You'll use this to reference this server in your sites and database configurations |
user |
Name of the user that you use to SSH into this server |
host |
Hostname of this server (can also be an IP address) |
port |
SSH port for this server |
Hint: Consider using similar naming conventions for your Breeze servers as you do in your host machine's SSH config file. For example, when searching using breeze search <phrase>
, the generated git clone
commands will use the Breeze server id as host identifier. If that matches your host machine's SSH configuration, cloning the repo will be a simple copy-paste from the search output., (*28)
Sites
The following is an example sites configuration:, (*29)
sites:
- id: example.com
aliases: [example.dev]
path: /var/www/vhosts/example.com
document_root: httpdocs
server: web1
server_path: /var/www/vhosts/example.com
uploads_path: public/uploads
Here's a breakdown of what each item means:, (*30)
Key |
Description |
id |
Unique identifier for the site. You'll use this to reference this site from the Breeze CLI tool |
aliases |
An array of virtual host aliases that can be used to access this site. Used to generate a virtual host file |
path |
Path on the Breeze to the site project files. Path is on the Breeze guest machine
|
document_root |
Document root of the site. Leave blank if the document root is the same as the path
|
server |
id of the server that this site is hosted on (if this site isn't hosted in production anywhere, this can be left alone) |
server_path |
Path of the site on the the server
|
uploads_path |
Directory in this site that contains assets that are uploaded (and typically not version controlled) |
Databases
The following is an example database configuration:, (*31)
databases:
- id: example
local_name: example
local_user: example
local_password: secret
remote_name: example_prod
remote_user: example_prod
remote_password: prodsecret
remote_host: localhost
remote_port: 3306
server: web1
Here's a breakdown of each configuration item:, (*32)
Key |
Description |
id |
Unique identifier for the database. You'll use this to reference this database from the Breeze CLI tool |
local_name |
The name of the database on the Breeze guest VM |
local_user |
The username for this database on the Breeze guest VM |
local_password |
The password used to access the database on the Breeze guest VM |
remote_name |
The name of the database on a remote server |
remote_user |
The username for this database on the remote server |
remote_password |
The password used to access the database on the remote server |
remote_port |
The port used to access the database on the remote server |
server |
id of the server that access to the database. Breeze will SSH into this server in order to dump the database |
SSH Configuration
To simplify work that may require SSH (ssh, scp, rsync, etc), you may add the following to your ~/.ssh/config
file:, (*33)
Host breeze
HostName 127.0.0.1
Port 2222
KeepAlive yes
ServerAliveInterval 60
User vagrant
This will allow you to type ssh breeze
and SSH directly into your machine (as long as SSH keys are setup correctly)., (*34)
Breeze Commands
The following is a list of available Breeze commands., (*35)
Breeze Utility Commands
init
Initialize the Breeze configuration files in ~/.breeze
, (*36)
breeze init
edit
Edit the Breeze config file in your default editor, (*37)
breeze edit
config:ssh
Generate an SSH config file within the Breeze guest machine based on configured servers, (*38)
breeze config:ssh
Vagrant Commands
The following commands act as helpers to run Vagrant commands against the Breeze VM with some slight alterations., (*39)
up
Start the Breeze machine (proxies to vagrant up
). Optionally provision by passing the --provision
flag., (*40)
breeze up [--provision]
status
Display the status of the Breeze machine (proxies to vagrant status
), (*41)
breeze status
provision
Provision the Breeze machine (proxies to vagrant provision
), (*42)
breeze provision
reload
Reboot the Breeze machine (proxies to vagrant reload
), (*43)
breeze reload
halt
Halt the Breeze machine (proxies to vagrant halt
), (*44)
breeze halt
reload
Restart the Breeze machine (proxies to vagrant reload
), (*45)
breeze reload
suspend
Suspend the Breeze machine (proxies to vagrant suspend
), (*46)
breeze suspend
resume
Resume a suspended Breeze machine (proxies to vagrant resume
), (*47)
breeze resume
ssh
Login to the Breeze machine via SSH (proxies to vagrant ssh
), (*48)
breeze ssh
destroy
This command will destroy the Breeze machine, (*49)
breeze destroy
Site Commands
site:create
Create and enable a virtual host for the given <site>
., (*50)
breeze site:create [--force] [--] <site>
If you add the option --force
, this command will override any existing configuration file for this <site>
., (*51)
site:delete
Delete the virtual host file for the given <site>
., (*52)
breeze site:create [--force] [--] <site>
If you add the option --purge
, this command will completely delete all files for this site , both on the guest and the host, so use with caution!, (*53)
site:list
List sites that are in the Breeze config, (*54)
breeze site:list
site:pull-rsync
Pull site files from the remote server via rsync for the given <site>
, (*55)
breeze site:pull-git <site>
site:sync-uploads
Pull uploads from the remote server via rsync for the given <site>
, (*56)
breeze site:sync-uploads <site>
Database Commands
db:create
Create the given <database>
on the Breeze guest VM, (*57)
breeze db:create <database>
db:drop
Drop the given <database>
from the Breeze guest VM, (*58)
breeze db:drop <database>
db:dump
Dump the given <database>
on the Breeze guest VM to output, (*59)
breeze db:dump <database>
Pass the --remote
option to dump the remote database, (*60)
db:pull
Pull the given <database>
from the remote server into the database on the Breeze guest VM, (*61)
breeze db:pull <database>
Note: this will overwrite the existing database on the Breeze VM, (*62)
Web Commands
web:reload
Reload the Breeze Apache server, (*63)
breeze web:reload
web:restart
Restart the Breeze Apache server, (*64)
breeze web:restart
Appendix: Windows Setup and Notes
SSH Issues
There are currently some outstanding issues with Breeze on Windows that prevent it from functioning correctly. However, you can use nearly all of Breeze's features by SSH'ing directly into Breeze (either with vagrant ssh
from the Breeze project directory or by setting up your SSH configuration file and running ssh breeze
) and then running all your Breeze commands from within that terminal., (*65)
Composer Installation
In order to install Breeze, you will need to get composer up and running. This can be a little tricky, but it's made easier by this tool:, (*66)
https://github.com/composer/windows-setup, (*67)
License
Breeze is open-source software and licensed under the MIT license., (*68)