Skip to content

Documented the use of Docker with the Symfony server #11261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 67 additions & 11 deletions setup/symfony_server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
- "3600"

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

Expand Down Expand Up @@ -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