devilbox/docs/Quickstart.md
2017-06-26 13:05:15 +02:00

5.8 KiB

Devilbox Documentation

Overview | Quickstart | Install | Update | Configure | Run | Usage | OS | Backups | Examples | Technical | Hacking | FAQ


Quickstart

  1. Installation
  2. Update
    1. Tagged release
    2. Master branch
  3. Configuration
    1. .env
    2. Services
  4. Run
    1. Run all
    2. Run selection
  5. Project setup
    1. General setup
    2. Specific Frameworks
  6. Enter the PHP Docker container

1. Installation

Installing the devilbox is as easy as this:

$ 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.

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

2.1 Tagged release

$ docker-compose stop
$ docker-compose rm
$ git fetch --all
$ git checkout "$(git describe --abbrev=0 --tags)"

2.2 Master branch

$ docker-compose stop
$ docker-compose rm
$ git fetch --all
$ git pull origin master
$ ./update-docker.sh

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. A brief overview is shown below.

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.

$ vim .env

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

$ cd cfg/
$ echo "max_execution_time = 180" > php-fpm-5.6/config.ini

Example: Configure MySQL 5.5

$ cd cfg/
$ echo "[mysqld]\nslow_query_log = 1" > mysql-5.5/config.cnf

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.

4.1 Run all

$ docker-compose up -d

4.2 Run selection

$ docker-compose up -d httpd php mysql redis

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.

5.1 General setup

Assumption:

  1. HOST_PATH_TO_HTTPD_DATADIR=./data/www
  2. TLD_SUFFIX=local
  3. Three Projects: project1, project2 and wordpress

Folder setup on your Host system:

VirtualHost directory DocumentRoot directory URL
./data/www/project1 ./data/www/project1/htdocs http://project1.local
./data/www/project2 ./data/www/project2/htdocs http://project2.local
./data/www/wordpress ./data/www/wordpress/htdocs http://wordpress.local

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.local
project2 127.0.0.1 project2.local
wordpress 127.0.0.1 wordpress.local

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:

$ ls -l
drwxrwxr-x 2 cytopia 4096 Jun 14 08:29 cakephp
lrwxrwxrwx 1 cytopia   11 Jun 14 08:29 htdocs -> cakephp/app/webroot/

5.2 Specific Frameworks

One example of the above mentioned nested directory structure is CakePHP. Its actual www dats is serveed from:

<project>/cake/app/webroot

instead of

<project>/htdocs

You can easily achieve this by symlinking this folder to htdocs:

$ 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:

  1. Introduction
  2. Setup CakePHP
  3. Setup Drupal
  4. Setup Phalcon
  5. Setup Symfony
  6. Setup Wordpress
  7. Setup Yii
  8. Setup Zend

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:

host> ./bash.sh
devilbox@php-7.0.19 in /shared/httpd $

See Usage for a detailed explanation.