devilbox/docs/Quickstart.md
2017-06-20 12:16:27 +02:00

4.0 KiB

Devilbox Documentation

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


Quickstart

  1. Installation
  2. Update
  3. Tagged release
  4. Master branch
  5. Configuration
  6. .env
  7. Services
  8. Run
  9. Run all
  10. Run selection
  11. Project setup
  12. General setup
  13. Specific Frameworks
  14. Enter the PHP Docker container

1. Installation

$ git clone https://github.com/cytopia/devilbox
$ cd devilbox/
$ cp env-example .env

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

3.1 .env

Edit all general settings inside the .env file (file paths, what version to run, debug, timezeon, etc)

$ vim .env

3.2 Services

Configure PHP 5.6

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

Configure MySQL 5.5

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

4. Run

4.1 Run all

$ docker-compose up -d

4.2 Run selection

$ docker-compose up -d httpd php mysql redis

5. Project setup

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

Some frameworks use a deep nested directory to serve their actual www data such as:

<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/

See Examples for more info about how to setup different frameworks.

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.