@@ -244,6 +244,72 @@ server provides a ``run`` command to wrap them as follows:
244
244
# stop the web server (and all the associated commands) when you are finished
245
245
$ symfony server:stop
246
246
247
+ Docker Integration
248
+ ------------------
249
+
250
+ The local Symfony server provides full `Docker `_ integration for projects that
251
+ use it. First, make sure to expose the container ports:
252
+
253
+ .. code-block :: yaml
254
+
255
+ # docker-compose.override.yaml
256
+ services :
257
+ database :
258
+ ports :
259
+ - " 3306"
260
+
261
+ redis :
262
+ ports :
263
+ - " 6379"
264
+
265
+ # ...
266
+
267
+ Then, check your service names and update them if needed (Symfony creates
268
+ environment variables following the name of the services so they can be
269
+ autoconfigured):
270
+
271
+ .. code-block :: yaml
272
+
273
+ # docker-compose.yaml
274
+ services :
275
+ # DATABASE_URL
276
+ database : ...
277
+ # MONGODB_DATABASE, MONGODB_SERVER
278
+ mongodb : ...
279
+ # REDIS_URL
280
+ redis : ...
281
+ # ELASTISEARCH_HOST, ELASTICSEARCH_PORT
282
+ elasticsearch : ...
283
+ # RABBITMQ_DSN
284
+ rabbitmq : ...
285
+
286
+ If you can't or don't want to update the service names, you must remap the env
287
+ vars so Symfony can find them. For example, if you want to keep a service called
288
+ ``mysql `` instead of renaming it to ``database ``, the env var will be called
289
+ ``MYSQL_URL `` instead of the ``DATABASE_URL `` env var used in the Symfony
290
+ application, so you add the following to the ``.env.local `` file:
291
+
292
+ .. code-block :: bash
293
+
294
+ # .env.local
295
+ MYSQL_URL=${DATABASE_URL}
296
+ # ...
297
+
298
+ Now you can start the containers and all their services will be exposed. Browse
299
+ any page of your application and check the "Symfony Server" section in the web
300
+ debug toolbar. You'll see that "Docker Compose" is "Up".
301
+
302
+ SymfonyCloud Integration
303
+ ------------------------
304
+
305
+ The local Symfony server provides full, but optional, integration with
306
+ `SymfonyCloud `_, a service optimized to run your Symfony applications on the
307
+ cloud. It provides features such as creating environments, backups/snapshots,
308
+ and even access to a copy of the production data from your local machine to help
309
+ debug any issues.
310
+
311
+ `Read SymfonyCloud technical docs `_.
312
+
247
313
Bonus Features
248
314
--------------
249
315
@@ -282,18 +348,8 @@ commands from the Symfony server:
282
348
# creates a new project based on the Symfony Demo application
283
349
$ symfony new --demo my_project_name
284
350
285
- SymfonyCloud Integration
286
- ------------------------
287
-
288
- The local Symfony server provides full, but optional, integration with
289
- `SymfonyCloud `_, a service optimized to run your Symfony applications on the
290
- cloud. It provides features such as creating environments, backups/snapshots,
291
- and even access to a copy of the production data from your local machine to help
292
- debug any issues.
293
-
294
- `Read SymfonyCloud technical docs `_.
295
-
296
351
.. _`symfony.com/download` : https://symfony.com/download
297
352
.. _`different ways of installing Symfony` : https://symfony.com/download
353
+ .. _`Docker` : https://en.wikipedia.org/wiki/Docker_(software)
298
354
.. _`SymfonyCloud` : https://symfony.com/cloud/
299
355
.. _`Read SymfonyCloud technical docs` : https://symfony.com/doc/master/cloud/intro.html
0 commit comments