The Devilbox

Introduction

  1. In past days replicating the development environment of one machine to another is difficult
  2. We can’t assure each system is exact clone of other system
  3. But by using Devilbox we can create a highly customisable dockerized LAMP stack
  4. No need worry about operating systems if all system have identical .env file then all system work similarly
  5. One of the use case is it will provide identical environment which help developers in different territory can maintain their stack identical
  6. When a new project arrive we can handle the requirement analysis, delivery date, estimate over all cost, task assigning to team, etc
  7. But to setup all developers system identical to dev environment is time consuming process
  8. So this tedious work of configuring all system identical can be easy with the help of Devilbox

Devilbox services

  1. Using Devilbox you are compartmentalizing your code and all other services (stacks) for each specific project
  2. So you can do all projects with different configuration under one Devilbox
  3. We can share the container to other developer also this eradicate the fallacy “it works on my machine” or “Check your system have all required configuration”
  4. Devilbox supports various services like webserver, Relational database, caching, NoSQL with PHP version 5.2 to 7.3
  5. As you noted all the services are available in various version we can debug or refactor our code very quickly. For e.g. if you are planned to upgrade our source code from PHP 5 to PHP 7 and MySQL 5 to MySQL 8 version. You can switch in lesser time

Installation & Configuration

  1. Lets see how to use Devilbox in our linux system
  2. Do git clone of Devilbox repository using the command
    git clone https://github.com/cytopia/devilbox
  3. The above command will download the code necessary to run the Devilbox
  4. Once downloaded change directory to devilbox using shell command cd devilbox/
  5. Inside the directory sample configuration text file is present in the name env-example
  6. Copy that file to .env new file using the command cp env-example .env
  7. Once copied .env, edit it using any editor (I’m using vim. Shell command: vim .env)
  8. In .env file, under the section 1. Choose Images (Version) you will find various version of all services
  9. In section 1.1, lots of PHP versions are there with one version uncommented (The line which don’t start with # is said to be uncommented line and line which starts with # is said to be commented line. So the line which are started with # will be neglected by docker which we will see in upcoming points)
  10. If you need you can change all service layers for example instead of default HTTPD server nginx you can choose apache likewise for database instead of default mariadb can choose mysql or percona or postgres

Lets Compose

  1. Once you configured .env then run the command sudo docker-compose up in terminal (command prompt or shell as root user to avoid permission error)
  2. Wait for a minute once the above command run. You may get error like this

devilbox_bind_1 is up-to-date
Starting devilbox_php_1 ... done
Starting devilbox_httpd_1 ... error

ERROR: for devilbox_httpd_1  Cannot start service httpd: driver failed programming external connectivity on endpoint devilbox_httpd_1 (c7f5ee7c935d4d8789c20a965efcb9697b277f761fcd98472e7d24c254b5433f): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use

ERROR: for httpd  Cannot start service httpd: driver failed programming external connectivity on endpoint devilbox_httpd_1 (c7f5ee7c935d4d8789c20a965efcb9697b277f761fcd98472e7d24c254b5433f): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use
ERROR: Encountered errors while bringing up the project.

  1. This error says already port 80 in use
  2. Most probably this port is used by apache service apache2 in debian based distros or httpd in redhat based distros
  3. So you can use the following command stop the http service sudo systemctl stop apache2
  4. You can check the stopped apache status using command sudo systemctl status apache2
  5. Once again run the command sudo docker-compose up
  6. After running the command if you face the below error i.e. mysql can’t listen port 3306 then it is used by system’s other mysql service
ERROR: for mysql  Cannot start service mysql: driver failed programming 
external connectivity on endpoint devilbox_mysql_1 (d449806d13ea474adc30293ef53e84d91cbae6f5feef7253dce69849c2d7b6e2):
Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already in use ERROR: Encountered errors while bringing up the project.
  1. Run this command sudo systemctl stop mysql to stop already running mysql service
  2. Once again run sudo docker-composer up after few minutes every services of docker will run properly
  3. In you favourite web browser type (or click this) http://localhost/
  4. You will see home page like this
devilbox home screen