Running Symfony CMF With Gaudi

Emmanuel Quentin
Emmanuel QuentinFebruary 09, 2014

Symfony CMF is a new Content Management Framework based on Symfony 2. This project won the Symfony Open-Source Application Award 2013, and is used at marmelab for a project with more than 900K documents.

Symfony CMF requires several third-party components to be installed: Jackrabbit, MySQL, Apache, and of course PHP. Gaudi simplifies the build of linked components, so it will be hepful to setup and run a Symfony CMF project. Gaudi runs a Docker container for each required components defined in a simple configuration file.
It was instroduced in a previous post.

Symfony CMF

Creating The Configuration File

The .gaudi.yml file lists all components required to run the Symfony CMF Sandbox :

        type: apache
        links: [app]
            8080: 80
            .: /var/www
            fastCgi: app
            documentRoot: /var/www/web
            modules: [rewrite]

        type: php-fpm
        links: [jackrabbit]
        apt_get: [php5-gd, php5-intl]
            9000: 9000
            .: /var/www
            modules: []

        type: jackrabbit
            8082: 8082
            .gaudi/jackrabbit: /opt/jackrabbit/jackrabbit


You may notice that it is similar to the configuration file of the Gaudi Symfony tutorial.

Instead of starting a MySQL server, we start Jackrabbit, and make it listen on port 8082.

As Docker does not keep data when a container is removed, we need to mount a folder from the host machine into /opt/jackrabbit/jackrabbit (where Jackrabbit stores its documents).


The Jackrabbit server is linked to the app application, which runs a PHP-FPM server. During the build of app, we tell Gaudi to:

  • install php5-gd & php5-intl required by Symfony CMF
  • mount the current folder to /var/www
  • listen to the port 9000


The Apache server is called app, and is configured to:

  • mount the current folder to /var/www
  • listen on the 8080 port
  • redirect all requests to the port 80 of the container
  • redirect all Fast-CGI requests to the app application
  • define the DocumentRoot to /var/www/web (required by Symfony)
  • enable mod_rewrite

Starting All Components

To start all the 3 components (Apache2, PHP-FPM & Jackrabbit), just run :


Wich will output something like :

Cleaning front ...
Cleaning app ...
Cleaning jackrabbit ...
Building gaudi/front ...
Building gaudi/app ...
Building gaudi/jackrabbit ...
Starting jackrabbit ...
Application jackrabbit started (
Starting app ...
Application app started (
Starting front ...
Application front started (

Installing Symfony Cmf

Attach the app container to run some commands :

docker attach app
cd /var/www

git clone && mv cmf-sandbox/ . && rm -rf cmf-sandbox
cp app/config/parameters.yml.dist app/config/parameters.yml
cp app/config/phpcr_jackrabbit.yml.dist app/config/phpcr.yml

Configuring Symfony CMF

Docker injects some environment variables for linked containers. In this example, the injected variables in the app container are:


We need to inject some on them in the Symfony configuration by creating a new app/config/parameters.php file:

$container->setParameter('phpcr_backend', [
    "type" => "jackrabbit",
    "url" => getenv('JACKRABBIT_PORT_8082_TCP_ADDR').':'.getenv('JACKRABBIT_PORT_8082_TCP_PORT')."/server/"

Include this file in the app/config/config.yml after - { resource: phpcr.yml } :

    # ...
    - { resource: phpcr.yml }
    - { resource: parameters.php }

Install all dependencies :

composer install

Finaly create the Jackrabbit workspace :

php app/console doctrine:phpcr:workspace:create sandbox
php app/console doctrine:phpcr:repository:init
php app/console -v doctrine:phpcr:fixtures:load

You are now go to go and check the result at http://localhost:8080/hello.

Feel free to give me some feedback or bug report in Gaudi's project.

Did you like this article? Share it!