diff --git a/setup/symfony_server.rst b/setup/symfony_server.rst index 5f991b827fa..2f13761fe3d 100644 --- a/setup/symfony_server.rst +++ b/setup/symfony_server.rst @@ -244,6 +244,72 @@ server provides a ``run`` command to wrap them as follows: # stop the web server (and all the associated commands) when you are finished $ symfony server:stop +Docker Integration +------------------ + +The local Symfony server provides full `Docker`_ integration for projects that +use it. First, make sure to expose the container ports: + +.. code-block:: yaml + + # docker-compose.override.yaml + services: + database: + ports: + - "3306" + + redis: + ports: + - "6379" + + # ... + +Then, check your service names and update them if needed (Symfony creates +environment variables following the name of the services so they can be +autoconfigured): + +.. code-block:: yaml + + # docker-compose.yaml + services: + # DATABASE_URL + database: ... + # MONGODB_DATABASE, MONGODB_SERVER + mongodb: ... + # REDIS_URL + redis: ... + # ELASTISEARCH_HOST, ELASTICSEARCH_PORT + elasticsearch: ... + # RABBITMQ_DSN + rabbitmq: ... + +If you can't or don't want to update the service names, you must remap the env +vars so Symfony can find them. For example, if you want to keep a service called +``mysql`` instead of renaming it to ``database``, the env var will be called +``MYSQL_URL`` instead of the ``DATABASE_URL`` env var used in the Symfony +application, so you add the following to the ``.env.local`` file: + +.. code-block:: bash + + # .env.local + MYSQL_URL=${DATABASE_URL} + # ... + +Now you can start the containers and all their services will be exposed. Browse +any page of your application and check the "Symfony Server" section in the web +debug toolbar. You'll see that "Docker Compose" is "Up". + +SymfonyCloud Integration +------------------------ + +The local Symfony server provides full, but optional, integration with +`SymfonyCloud`_, a service optimized to run your Symfony applications on the +cloud. It provides features such as creating environments, backups/snapshots, +and even access to a copy of the production data from your local machine to help +debug any issues. + +`Read SymfonyCloud technical docs`_. + Bonus Features -------------- @@ -282,18 +348,8 @@ commands from the Symfony server: # creates a new project based on the Symfony Demo application $ symfony new --demo my_project_name -SymfonyCloud Integration ------------------------- - -The local Symfony server provides full, but optional, integration with -`SymfonyCloud`_, a service optimized to run your Symfony applications on the -cloud. It provides features such as creating environments, backups/snapshots, -and even access to a copy of the production data from your local machine to help -debug any issues. - -`Read SymfonyCloud technical docs`_. - .. _`symfony.com/download`: https://symfony.com/download .. _`different ways of installing Symfony`: https://symfony.com/download +.. _`Docker`: https://en.wikipedia.org/wiki/Docker_(software) .. _`SymfonyCloud`: https://symfony.com/cloud/ .. _`Read SymfonyCloud technical docs`: https://symfony.com/doc/master/cloud/intro.html