Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

A sweet Docker setup for Vanilla Forums

License

Notifications You must be signed in to change notification settings

nexfoundation/vanilla-docker

 
 

Repository files navigation

Vanilla Docker environment

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.

The containers

database

SQL database.

  • Accessible from the container with the hosts "database".
  • Accessible from the docker host machine with the hosts "database", "localhost", "127.0.0.1'
  • The user is "root" and there is no password.

httpd

Apache 2 web server.

nginx

nginx web server

php-fpm

php-fpm with PHP 7.4 and rsyslogd.

The php-fpm container comes in two flavours, standard and xdebug. The nginx container takes care of routing the request to the appropriate php-fpm flavour based on if your request needs debugging or not.

Both versions integrate rsyslogd to support PHP's syslog(). /var/log/syslog is tailed to stdout and it is prompted by docker-compose in the usual way (docker-compose logs -f, docker-compose up --build, etc)

Sphinx (removed)

Sphinx search service (service-sphinx.yml).

Setup

For this setup to work properly you need to clone all vanilla repositories in the same base directory

  1. Get Docker for OSX and install it.

    • Do not forget to tune up the allocated Memory and CPUs. Docker > Preferences > Advanced
  2. Get Brew, Yarn & Node

  3. Get Composer v1 and install it making sure to specify installation options that install v1 composer (e.g. the --1 version option).

  4. Create a directory for your project. In this example, we'll use my-vanilla-project, but you can use any name.

  5. Move into your project directory.

  6. Clone or download vanilla/vanilla-docker into your project directory.

  7. Clone or download vanilla/vanilla into your project directory.

  8. Clone or download any other project dependencies into your project directory (for example, any of vanilla/addons), and install according to their instructions. Note: All addons, plugins, themes, etc, must be located in the project directory. Everything outside of the project directory will not be made available inside of the Docker container.

  9. You should have the following structure

    my-vanilla-project
    ├── vanilla
    ├── vanilla-docker
    ├── ...
    
  10. Move into the vanilla directory.

  11. Run composer install which will install Vanilla's dependencies.

  12. Move up and over into the vanilla-docker directory.

  13. Run sudo ./mac-setup.sh which will:

    • Add a self signed certificate *.vanilla.localhost to your keychain.
    • Safely update your /etc/hosts.
    • Create a docker volume named "datastorage" which will contain the database data.
  14. Run 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.

  15. Run the installer!

    • It is recommended to use vanilla_dev as the database name since some services are configured to use that database.
    • It is recommended to use database for the host name.
    • It is recommended to use 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.

Running optional services

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

Xdebug

See Make Xdebug work with PhpStorm.

Unit tests

See Make unit tests work within PhpStorm.

F.A.Q

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.

About

A sweet Docker setup for Vanilla Forums

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 38.2%
  • Dockerfile 27.0%
  • Smarty 21.9%
  • PHP 12.9%