Only supports Mac OSX at the moment but everything can be easily adapted to work on other platforms. Assume that you are using PhpStorm as your IDE.
This repository contains a ready-for-development environment to develop against Vanilla.
SQL database.
Defaults to perconadb.
To change that set the environment variable VANILLA_DOCKER_DATABASE to mariadb in your .bash_profile
.
Apache 2 web server.
nginx web server
php-fpm with PHP 7.3
Sphinx search service (service-sphinx.yml).
Before enabling make sure that:
Plugins.Sphinx.Server = sphinx
in your configPlugins.Sphinx.SphinxAPIDir = /sphinx/
in your configln -s configs-available/standard.sphinx.conf sphinx.conf
vanilla_test
.everything.sphinx.conf
config for sphinx.<env name="TEST_SPHINX_HOST" value="sphinx" />
There are a couple of handly scripts to run the re-indexer. You can run them from the command line like so:
docker exec -t sphinx bash /root/index.delta.sh
docker exec -t sphinx bash /root/index.all.sh
If you need to have Sphinx indexes updated regularly run install-sphinx-cron.sh.
sphinx
containerif your environment or tasked to be different you need to change install-sphinx-cron.sh
accordingly
Note that the easiest way to run this script is through docker:
docker exec -t sphinx bash /root/install-sphinx-cron.sh
For this setup to work properly you need to clone all vanilla repositories in the same base directory
Get Docker for OSX and install it.
Docker
> Preferences
> Advanced
my-vanilla-project
, but you can use any name.my-vanilla-project
├── vanilla
├── vanilla-docker
├── ...
vanilla
directory.composer install
which will install Vanilla's dependencies.vanilla-docker
directory.sudo ./mac-setup.sh
which will:
*.vanilla.localhost
to your keychain./etc/hosts
.192.0.2.1
as a loopback IP address.docker-compose up --build
(It will take a while the first time). You'll know it worked if you see something like
Successfully built…
Successfully tagged…
Creating database ... done
Creating php-fpm ... done
Creating httpd ... done
Creating nginx ... done
Attaching to database, php-fpm, httpd, nginx
…
php-fpm | done.
and voila -> dev.vanilla.localhost shows the Vanilla installer.
Run the installer!
vanilla_dev
as the database name since some services are configured to use that database.database
for the host name.root
as the username.To properly stop the containers you need to run docker-compose down
.
Do not forget to run docker-compose up --build
to start up the services every time you restart your computer.
To run additional services (named service-*.yml) you can specify which .yml file to run like so:
docker-compose -f docker-compose.yml -f docker-compose.override.yml -f service-sphinx.yml up --build
You can add as many services as you want that way. You can create a script named custom.boot.sh, with the combination of services that you want, so that it is easier to start the services that you want.
Generally, there should be documentation inside the .yml file of the service that gives you information about it.
For more information: understanding-multiple-compose-files
To start all containers except the database one you can use:
docker-compose -f docker-compose.yml up --build
This will skip docker-compose.override.yml
. Note that by doing so you will probably have to add additional configurations to make sure that the database is reachable from the containers.
To address that issue you have 2 ways of doing it:
192.0.2.1
that is installed by the mac-setup.sh
script if your database is installed directly on your machine.You can also create custom.*.yml file to extends the existing services and add extra-hosts to the services. Example:
custom.dbhost.yml
version: "3"
services:
php-fpm:
extra_hosts:
database: 192.0.2.1
You can then do:
docker-compose -f docker-compose.yml -f custom.dbhost.yml up --build
You can also delete the datastorage volume created by mac-setup.sh
since you won't be using it.
See Make Xdebug work with PhpStorm.
See Make unit tests work within PhpStorm.
Q. Why is everything so slow?
A. You are probably running on the APFS file system that became the standard with macOS High Sierra and which has pretty bad performance with Docker for Mac. Having the database on your host instead of inside docker might help a lot. See #10.