devilbox/docs/Quickstart.md

220 lines
6.3 KiB
Markdown
Raw Normal View History

2017-06-14 07:25:57 +00:00
# Devilbox Documentation
[Overview](README.md) |
Quickstart |
[Install](Install.md) |
[Update](Update.md) |
[Configure](Configure.md) |
[Run](Run.md) |
[Usage](Usage.md) |
2017-06-21 07:19:51 +00:00
[OS](OS.md) |
2017-06-14 07:25:57 +00:00
[Backups](Backups.md) |
[Examples](Examples.md) |
[Technical](Technical.md) |
[Hacking](Hacking.md) |
[FAQ](FAQ.md)
---
## Quickstart
1. [Installation](#1-installation)
2. [Update](#2-update)
2017-06-26 11:05:15 +00:00
1. [Tagged release](#21-tagged-release)
2. [Master branch](#22-master-branch)
2017-06-14 07:25:57 +00:00
3. [Configuration](#3-configuration)
2017-06-26 11:05:15 +00:00
1. [.env](#31-env)
2. [Services](#32-services)
2017-06-14 07:25:57 +00:00
4. [Run](#4-run)
2017-06-26 11:05:15 +00:00
1. [Run all](#41-run-all)
2. [Run selection](#42-run-selection)
2017-06-14 07:25:57 +00:00
5. [Project setup](#5-project-setup)
2017-06-26 11:05:15 +00:00
1. [General setup](#51-general-setup)
2. [Specific Frameworks](#52-specific-frameworks)
2017-06-17 11:09:30 +00:00
6. [Enter the PHP Docker container](#6-enter-the-php-docker-container)
2017-06-14 07:25:57 +00:00
---
## 1. Installation
Installing the devilbox is as easy as this:
2017-06-14 07:25:57 +00:00
```shell
$ git clone https://github.com/cytopia/devilbox
$ cd devilbox/
$ cp env-example .env
```
To find out in more detail for different operating systems have a look at **[Install](Install.md)**.
2017-06-14 07:25:57 +00:00
## 2. Update
You will have the choice to stay on stable git tags or on the latest master branch. Both options have slightly different update procedures. View the quick instructions below and for more information have a look at **[Update](Update.md)**
2017-06-14 07:25:57 +00:00
#### 2.1 Tagged release
```shell
$ docker-compose stop
2017-06-20 10:15:32 +00:00
$ docker-compose rm
2017-06-14 07:25:57 +00:00
$ git fetch --all
$ git checkout "$(git describe --abbrev=0 --tags)"
```
#### 2.2 Master branch
```shell
$ docker-compose stop
2017-06-20 10:15:32 +00:00
$ docker-compose rm
2017-06-14 07:25:57 +00:00
$ git fetch --all
$ git pull origin master
$ ./update-docker.sh
```
2017-06-22 09:32:43 +00:00
2017-06-14 07:25:57 +00:00
## 3. Configuration
The devilbox will work out-of-the box after the above installation routine has been done. However there are lots of options to configure. Read up on it on **[Configure](Configure.md)**. A brief overview is shown below.
2017-06-14 07:25:57 +00:00
#### 3.1 .env
Edit all general settings inside the .env file (file paths, what version to run, debug, timezeon, etc). The `.env` file is well documented and self-explanatory.
2017-06-14 07:25:57 +00:00
```shell
$ vim .env
```
**Important:** When changing any path variables, you will have to stop all container, delete them so that they can be re-created during the next startup.
```shell
$ docker-compose stop
# Remove the stopped container (IMPORTANT!)
# After the removal it will be re-created during next run
$ docker-compose rm -f
```
2017-06-14 07:25:57 +00:00
#### 3.2 Services
Additionally to configure the devilbox in general, you can also configure each service separately by adding/altering service specific configuration files.
**Example:** Configure PHP 5.6
2017-06-14 07:25:57 +00:00
```shell
$ cd cfg/
$ echo "max_execution_time = 180" > php-fpm-5.6/config.ini
```
**Example:** Configure MySQL 5.5
2017-06-14 07:25:57 +00:00
```shell
$ cd cfg/
$ echo "[mysqld]\nslow_query_log = 1" > mysql-5.5/config.cnf
```
2017-06-22 09:32:43 +00:00
2017-06-14 07:25:57 +00:00
## 4. Run
Starting up the devilbox is done via docker-compose commands. You will have the choice to start-up everything or just a selection of the services you need. To get more more information about this view **[Run](Run.md)**.
2017-06-14 07:25:57 +00:00
#### 4.1 Run all
```shell
$ docker-compose up -d
```
#### 4.2 Run selection
```shell
$ docker-compose up -d httpd php mysql redis
```
2017-06-22 09:32:43 +00:00
2017-06-14 07:25:57 +00:00
## 5. Project setup
The heart of the devilbox is the easy configuration of an unlimitted numbder of projects. Most stuff configures itself automatically in the background, but a few things are still left up to you. The following will give you a kick-start for setting up a few projects. To find out in more detail view **[Usage](Usage.md)**.
2017-06-17 11:09:30 +00:00
#### 5.1 General setup
2017-06-14 07:25:57 +00:00
**Assumption:**
1. HOST_PATH_TO_HTTPD_DATADIR=**./data/www**
2. TLD_SUFFIX=**loc**
2017-06-14 07:25:57 +00:00
3. Three Projects: project1, project2 and wordpress
**Folder setup on your Host system:**
| VirtualHost directory | DocumentRoot directory | URL |
|-----------------------|-----------------------------|------------------------|
| <code>./data/www/<b>project1</b></code> | <code>./data/www/project1/<b>htdocs</b></code> | `http://project1.loc` |
| <code>./data/www/<b>project2</b></code> | <code>./data/www/project2/<b>htdocs</b></code> | `http://project2.loc` |
| <code>./data/www/<b>wordpress</b></code>| <code>./data/www/wordpress/<b>htdocs</b></code> | `http://wordpress.loc` |
2017-06-14 07:25:57 +00:00
Each VirtualHost will serve files from the **htdocs/** folder.
**DNS setup on your Host system:**
| Project folder | `/etc/hosts` entry |
|----------------|----------------------------|
| project1 | `127.0.0.1 project1.loc` |
| project2 | `127.0.0.1 project2.loc` |
| wordpress | `127.0.0.1 wordpress.loc`|
2017-06-14 07:25:57 +00:00
Some frameworks have a nested www directory and require you to use a symlink instead of explicitly setting a **htdocs/** folder. See the CakePHP folder setup below:
```shell
$ ls -l
drwxrwxr-x 2 cytopia 4096 Jun 14 08:29 cakephp
lrwxrwxrwx 1 cytopia 11 Jun 14 08:29 htdocs -> cakephp/app/webroot/
```
2017-06-17 11:09:30 +00:00
#### 5.2 Specific Frameworks
One example of the above mentioned nested directory structure is CakePHP. Its actual www dats is serveed from:
2017-06-17 11:09:30 +00:00
```shell
<project>/cake/app/webroot
```
instead of
```shell
<project>/htdocs
```
You can easily achieve this by symlinking this folder to `htdocs`:
```shell
$ ls -l <project>/
drwxrwxr-x 2 cytopia 4096 Jun 14 08:29 cakephp
lrwxrwxrwx 1 cytopia 11 Jun 14 08:29 htdocs -> cakephp/app/webroot/
```
To quickly find setup instructions for your framework of choice head over to **[Examples](Examples.md)**:
> 2. [Project setup](Examples.md#2-project-setup)
2017-08-16 07:21:48 +00:00
> 1. [Setup CakePHP](Examples.md#21-setup-cakephp)
> 2. [Setup Drupal](Examples.md#22-setup-drupal)
2017-10-03 10:45:37 +00:00
> 3. [Setup Joomla](Examples.md#23-setup-joomla)
> 4. [Setup Laravel](Examples.md#24-setup-laravel)
> 5. [Setup Phalcon](Examples.md#25-setup-phalcon)
> 6. [Setup Symfony](Examples.md#26-setup-symfony)
> 7. [Setup Wordpress](Examples.md#27-setup-wordpress)
> 8. [Setup Yii](Examples.md#28-setup-yii)
> 9. [Setup Zend](Examples.md#29-setup-zend)
2017-06-17 11:09:30 +00:00
## 6. Enter the PHP Docker container
The PHP Docker container is your workhorse which has many tools pre-installed and you can do every task inside instead of doing it on the docker host. Entering the container is done via a shipped script:
```shell
host> ./shell.sh
2017-06-17 11:09:30 +00:00
devilbox@php-7.0.19 in /shared/httpd $
```
2018-03-01 13:06:00 +00:00
Or on windows
```shell
path> ./shell.bat
devilbox@php-7.0.19 in /shared/httpd $
```
2017-06-17 11:09:30 +00:00
See **[Usage](Usage.md)** for a detailed explanation.