DrupalBox is a template Drupal project that can be used to seed (create) a new Drupal project quickly and easily.
The new project will contain:
- A Drupal profile (which can also be based on the OpenAtrium profile).
- Makefiles for downloading the Drupal core, all the needed modules, libraries, patches, etc.
- Scripts for installing a minimal Ubuntu server inside a Docker container, with all the packages and configurations needed for running a Drupal application.
- Scripts, modules, tools and docs that facilitate the development, including a dev–>test–>live workflow.
The aim of this project is to be like a “Drupal-on-Rails” for helping the new Drupal developers to get started and for simplifying the life of the experienced Drupal developers.
Usually a huge number of skills is needed in order to complete successfully a Drupal project, like: server management, web stack management, database management, knowledge of drush, Drupal profiles, frequently used modules, common Drupal development patterns and paradigms, etc. A new Drupal developer cannot possibly get all this skills in a short time, so he is not able to finish properly a Drupal application or it will take him a very long time. This project offers them a Drupal solution that works out of the box, with reasonable settings and configurations, which they can use as a starting point for developing their application.
This project can also simplify the life of the experienced Drupal developers, by allowing them to get started quickly, and then customizing the solution as they wish.
Create a new project
A new project is created by renaming files of the template project and doing find/replace in them.
### clone from github git clone https://github.com/dashohoxha/dbox.git cp -a dbox myproject cd myproject/ # git checkout openatrium ## optionally, use the branch 'openatrium' ### rename the project ./rename-project.sh # see usage ./rename-project.sh labdoo:myproject lbd:proj ### create a git repo git init . git add . git commit -m 'Initial commit.'
rename-project.sh works by renaming files of the
template project and doing find/replace in them. There are two
parameters that are used to customize the template project: the
project name and the project prefix. In the template project
they are represented by labdoo and lbd, which are then replaced
in the new project by the new project’s name and prefix.
Why these strange names? Why not use something like example and xmp, or sample and smp, or template and tmp etc.
The main reason is exactly that they are strange names and so there is no risk of collision with other names used in a project. For example xmp or template or tmp maybe are used on the project for something else as well, and replacing them blindly with a new value may break the application.
Install the new project
Installation is done inside a Docker container. For instructions about installing Docker see: https://docs.docker.com/installation/
- Create a working directory:
- Link the docker directory inside the working directory:
cd workdir/ ln -s ../myproject/docker .
- Modify and customize the settings:
cp docker/settings.sh . vim settings.sh
- Build a Docker image:
docker/build.sh settings.sh tail -f logs/nohup-myproject-master-20150929.out less -r logs/nohup-myproject-master-20150929.out
This will create a docker image, named
myproject:masterwith a minimal ubuntu system and everything that is needed for the normal work of the Drupal application.
- Create a Docker container like this:
It will create a container with port forwarding like this:
-p 80:80 -p 443:443 -p 2201:2201. If you don’t like the default port forwarding, edit
configand modify it, before creating the container.
- Now you can start and stop the container with
docker/stop.sh, enter the shell of the container with
development=trueis set on the settings, then the code of the application inside the container will be linked to the directory
myproject/, so that you can edit and work on it easily.
- If it is installed on a local machine (for testing or
development), add the domain name
/etc/hosts, like this:
This way it can be accessed by typing
https://example.orgon the browser location (not
An easier way to install is by using the script
utils/docker-install.sh which automates the steps above, with
certain conventions for directory names etc.
vim utils/docker-install.sh utils/docker-install.sh --domain=test.example.org or utils/docker-install.sh $(pwd)/settings.sh \ --git_branch=test --domain=test.example.org
This script also installs wsproxy, which allows to run more that one
containers with ports 80/443. For this to work, the variable
config is set to empty, so that docker does not forward the
ports 80 and 443 to the containers. The HTTP request forward to the
correct website container is handled by the wsproxy container,
based on the domain name.
utils/docker-install.sh is handy for making a quick
installation, it is highly recommended to read and understand this
script, because this will be helpful for maintaining the
installation. It is not so long and it is easy to understand.
To change the configuration of the server after it has been built, or in case of using a pre-built image, run:
and give the new settings interactively.
Another option is to edit the configuration settings file and give it as a argument to the script:
docker/enter.sh cp install/settings.sh . vim settings.sh install/config.sh settings.sh
It is also possible to run configuration scripts individually, to change only certain configurations. For example:
These scripts can be found on
- Internal doc files:
- External docs:
- Other docs that may help: