Skip to content
This repository was archived by the owner on Feb 18, 2021. It is now read-only.

Commit d924589

Browse files
committed
Added README
1 parent ce9e828 commit d924589

File tree

1 file changed

+201
-0
lines changed

1 file changed

+201
-0
lines changed

README.md

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
![Dashbrew Logo](https://raw.githubusercontent.com/mdkholy/mdkholy.github.io/master/assets/img/etc/dashbrew-logo-640.png)
2+
3+
## What is Dashbrew?
4+
5+
Dashbrew is a [Vagrant](http://www.vagrantup.com/) build aims at providing a powerful PHP development environment that can be used as a replacement for local development stacks such as MAMP, XAMPP, and others. It provides an easy way to manage, organize and develop PHP projects and comes with a unique dashboard that allows managing various environment aspects. It also comes preinstalled with [all software and tools](https://github.com/mdkholy/dashbrew-basebox#installed-components) needed to start developing right out of the box.
6+
7+
Dashbrew makes use of [phpbrew](https://github.com/phpbrew/phpbrew) — the wonderful PHP version management utility — to allow developing both web and command-line projects on different PHP versions and configurations on the same development environment.
8+
9+
## How it works?
10+
11+
### The Vagrant Base box
12+
13+
Dashbrew uses a pre-configured vagrant box that runs Ubuntu 14.04.1 LTS (Trusty Tahr) and comes preinstalled with [all components](https://github.com/mdkholy/dashbrew-basebox#installed-components) needed to run Dashbrew environment (e.g. monit, php, apache, mysql, phpbrew). The base box is built using [Packer](https://www.packer.io/).
14+
15+
For more information on the Packer template used to build the base box and the components that comes pre-installed in it, please visit the [dashbrew-basebox](https://github.com/mdkholy/dashbrew-basebox) repository.
16+
17+
### Dashbrew provisioner
18+
19+
The Vagrant virtual machine is provisioned using a custom provisioning system (i.e. Dashbrew provisioner) written in pure PHP. This eliminates the need to learn complex provisioning systems (e.g. Puppet or Chef) in order to extend or modify the provisioning process.
20+
21+
Dashbrew provisioner is a PHP command-line application built on top of Symfony components and is used to perform several tasks on the virtual machine based on your configurations. Examples for these tasks include:
22+
23+
* Installing system software packages, ruby gems or npm modules
24+
* Installing PHP versions and extensions
25+
* Managing projects and apache virtual hosts
26+
27+
## Getting Started
28+
29+
### Software Requirements
30+
31+
Before launching your Dashbrew environment, you must install VirtualBox and Vagrant. Both of these software packages provide easy-to-use visual installers for all popular operating systems.
32+
33+
* [Vagrant >= 1.6.5](http://www.vagrantup.com/)
34+
* [VirtualBox 4.3.x](https://www.virtualbox.org/)
35+
* The [Dashbrew base box](https://github.com/mdkholy/Dashbrew-Basebox) is built using VirtualBox 4.3.18 but if you would like to run it on another VirtualBox 4.3.x version, you will need to install [vagrant-vbguest plugin](https://github.com/dotless-de/vagrant-vbguest).
36+
* [Vagrant Hosts Provisioner plugin](https://github.com/mdkholy/vagrant-hosts-provisioner) for managing the /etc/hosts file of both the host and guest machines.
37+
* ``$ vagrant plugin install vagrant-hosts-provisioner``
38+
39+
### Adding The Vagrant Box
40+
41+
Once VirtualBox and Vagrant have been installed, you should add the ``mdkholy/dashbrew`` box to your Vagrant installation using the following command in your terminal. It will take a few minutes to download the box, depending on your Internet connection speed:
42+
43+
```
44+
$ vagrant box add mdkholy/dashbrew
45+
```
46+
47+
### Clone The Dashbrew Repository
48+
49+
Once the box has been added to your Vagrant installation, you should clone this repository. Consider cloning the repository into a central directory where you keep all of your projects, as Dashbrew will serve as the host to all of your PHP projects.
50+
51+
```
52+
$ git clone --recursive git://github.com/mdkholy/dashbrew.git
53+
```
54+
55+
***Note:*** The ``--recursive`` is required to clone the repository with all its dependencies (i.e. git submodules).
56+
57+
### The First Vagrant Up
58+
59+
Once you have cloned the Dashbrew Repository, start the Vagrant environment by running ``vagrant up`` command from the Dashbrew directory in your terminal. Vagrant will setup the virtual machine and boot it for the first time. This could take a while on the first run.
60+
61+
### Launch the Dashbrew Dashboard
62+
63+
Once the ``vagrant up`` command is finished, you can now launch the Dashbrew Dashboard by visiting [http://dashbrew.dev/](http://dashbrew.dev/) in your browser. Here is a screenshot of what it looks like.
64+
65+
![Dashbrew Dashboard](https://raw.githubusercontent.com/mdkholy/mdkholy.github.io/master/assets/img/etc/dashbrew-dashboard-1024.png)
66+
67+
## Configuration
68+
69+
Dashbrew environment can be configured via a configuration file located in ``config/environment.yaml`` (***Note:*** This file is not included in the repository by default, so you will need to create it). This file allows managing different components on your environment such as php versions, system packages, ruby gems, npm modules, etc.
70+
71+
A sample config file is located in ``config/environment.yaml.sample``, if you would like to use it, just rename it to ``environment.yaml``.
72+
73+
### PHP builds
74+
75+
Dashbrew allows having multiple PHP versions installed on the same environment (thanks to [phpbrew](https://github.com/phpbrew/phpbrew)). A PHP version installation is refered to as a PHP build and every build must have a unique name to identify it.
76+
77+
You can define as many PHP builds as you may like in the environment configuration file under ``php::builds`` property, you can even have multiple builds for the same PHP version but with different extensions and configurations.
78+
79+
Here is a sample ``php::builds`` definition:
80+
```
81+
php::builds:
82+
5.3.29:
83+
variants: dev
84+
extensions:
85+
xdebug:
86+
enabled: true
87+
version: stable
88+
fpm:
89+
port: 9002
90+
autostart: true
91+
5.6.0:
92+
default: true
93+
variants: dev
94+
extensions:
95+
xdebug:
96+
enabled: true
97+
version: stable
98+
xhprof:
99+
enabled: true
100+
version: latest
101+
fpm:
102+
port: 9003
103+
autostart: true
104+
```
105+
106+
For more information on how to configure Dashbrew environment, please visit [the wiki page](https://github.com/mdkholy/dashbrew/wiki/configuration).
107+
108+
## Adding Projects
109+
110+
In order to add a project to Dashbrew, all your project files needs to be under ``public/`` directory which is the root directory of the apache web server.
111+
112+
Every project needs a project configurations file in order to be added to Dashbrew. This file needs to be created in the project's root directory with the name ``.dashbrew`` and must be a valid YAML file. This file allows configuring different project aspects such as the php version it runs on and the apache virtual host entry needed for launching it.
113+
114+
So lets say you have the following project structure (under ``public/`` directory):
115+
```
116+
myproject/
117+
|-- assets/
118+
|-- lib/
119+
|-- index.php
120+
```
121+
122+
Create a new file called ``.dashbrew`` under ``myproject/`` directory like this:
123+
```
124+
myproject/
125+
|-- assets/
126+
|-- lib/
127+
|-- .dashbrew
128+
|-- index.php
129+
```
130+
131+
Edit ``.dashbrew`` file with the following configurations:
132+
```
133+
---
134+
myproject:
135+
title: My Project
136+
php:
137+
build: system
138+
vhost:
139+
servername: myproject.dev
140+
serveraliases:
141+
- www.myproject.dev
142+
ssl: true
143+
```
144+
145+
Run ``vagrant provision`` so that Dashbrew can find your project and make the nesseccary changes. Then visit [http://myproject.dev/](http://myproject.dev/) in your browser and you should see the output of the ``index.php``.
146+
147+
What we done here is that we added a new project that:
148+
149+
* runs on system php
150+
* can be accessed via ``myproject.dev`` or ``www.myproject.dev``
151+
* has SSL enabled so that it could be accessed using https
152+
153+
For more information on adding projects, please visit [the wiki page](https://github.com/mdkholy/dashbrew/wiki/Projects).
154+
155+
## Shared Configuration Files
156+
157+
These are configuration files primarily used by software installed on the guest machine and are shared with the host machine in order to facilitate editing them. Examples of these files are the Apache configuration file, MySQL configuration file and PHP INI files for each PHP build.
158+
159+
Dashbrew uses a bi-directional synchronization logic to keep the shared configuration files in sync between the host and guest machines. Synchronization of these files is done during [the provisioning process](#applying-your-changes).
160+
161+
All shared configuration files are located under ``config/`` directory and are organized in subfolders according their relevant software.
162+
163+
Here is a [list of the currently supported configuration files](https://github.com/mdkholy/dashbrew/wiki/SharedConfigurationFiles).
164+
165+
## Applying Your Changes
166+
167+
Whenever you make changes to the Dashbrew environment (e.g. changing a configuration file, adding/removing projects), you need to run ``vagrant provision`` in order to apply your changes. Dashbrew provisioner will provide you with useful info and debug (if enabled) messages during the provisioning process.
168+
169+
## Default Environment Information
170+
171+
### Virtual Machine
172+
173+
* IP Address: ``192.168.10.10``
174+
* Base Memory: ``1024``
175+
* CPUs: ``1``
176+
177+
178+
### SSH
179+
180+
* Port: ``22``
181+
* Username: ``vagrant``
182+
* Password: ``vagrant``
183+
* Private Key: *The default insecure private key that ships with Vagrant*
184+
185+
186+
### MySQL
187+
188+
* Port: ``3306``
189+
* Root Username: ``root``
190+
* Root Password: ``root``
191+
192+
## Need Help?
193+
194+
* Don't hesitate to open a new issue on GitHub if you run into trouble.
195+
* The [Dashbrew Wiki](https://github.com/mdkholy/dashbrew/wiki) also contains documentation that may help.
196+
197+
## Want to help?
198+
199+
If you would like to help, take a look at the list of issues. Fork the project, create a feature branch, and send us a pull request.
200+
201+
I created this for my own development purposes, but I welcome pull requests and suggestions to turn this into a useful resource for the entire community.

0 commit comments

Comments
 (0)