Skip to content

Update Symfony server docs to be more highlighted #11428

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 1 commit into from
Closed
Changes from all 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
33 changes: 17 additions & 16 deletions setup/symfony_server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,24 +264,25 @@ use it. First, make sure to expose the container ports:

# ...

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):
.. note::

.. code-block:: yaml
Symfony creates environment variables following the **name of the ``docker-compose`` services**.

# docker-compose.yaml
services:
# DATABASE_URL
database: ...
# MONGODB_DATABASE, MONGODB_SERVER
mongodb: ...
# REDIS_URL
redis: ...
# ELASTISEARCH_HOST, ELASTICSEARCH_PORT
elasticsearch: ...
# RABBITMQ_DSN
rabbitmq: ...
Here is the list of services you can autoconfigure with their environment variable name:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are always setting env vars. So, if your MySQL container is named db, env vars will be prefixed with DB_. The only specificity of naming it DATABASE_ is that Symfony Flex uses that by default. But having the possibility to choose the prefix is important when using more than 1 container of the same type.

Copy link
Contributor Author

@Pierstoval Pierstoval Apr 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is not really the behavior I expected 😄 It's even better 😃

Would you suggest I add another line with the db service using the DB_URL env var, as a mark of example?

It could be more interesting to have more details about the exact checks that are done.

I would guess that it only changes the host+port part in the URL/DSN, but is this even close to truth? Could you give more specific details about the internals of these automated checks so the docs can be more self-explanatory using better examples that fit all cases? 🙂


.. code-block:: yaml

# docker-compose.yaml
services:
database: # DATABASE_URL

mongodb: # MONGODB_DATABASE, MONGODB_SERVER

redis: # REDIS_URL

elasticsearch: # ELASTISEARCH_HOST, ELASTICSEARCH_PORT

rabbitmq: # RABBITMQ_DSN

If your ``docker-compose.yaml`` file doesn't use the environment variable names
expected by Symfony (e.g. you use ``MYSQL_URL`` instead of ``DATABASE_URL``)
Expand Down