Using Symfony in a Docker Production Environment

I want to implement a Symfony application on Docker using Docker-Compose. I will have at least the following containers:

  • Nginx
  • Rabbitmq Server
  • PHP-FPM
  • MySQL
  • Solr

We currently have a development environment using the above setup.

The Symfony application is stored locally (host), and then the volumes are used in the PHP-FPM container so that it can read the application - this works well. We are bashin the php-fpm container to run the linker / application / console commands.

We also manually launch users (Symfony commands) who consume messages from the rabbitmq server.

What are my options in production?

1) , , ? , php-fpm , - - , , . / ?

2) , ? ,

3) - ?

- , - , - haproxy - - - multi-symfony ?

+4
1

. , " ".

Nginx + PHP-FPM .

( dev prod), docker-compose SYMFONY_ENV = dev . , //, . , -, //.

/ webapp,   bash script ( "docker run -d myimage php_entrypoint.sh", :

  • cdn, db- ..
  • (php-fpm , supervisord )

- :

#$OPTIMIZE is an ENV-propagated or a calulated variable

su -c "php composer.phar install $OPTIMIZE" webmgr

cp -f web/HTACCESS_${SYMFONY_ENV} web/.htaccess

/usr/bin/supervisord -c /etc/supervisord/supervisord.conf

, supervisord, , / [program:], , php, php-fpm, CLI/consumer. php, . , supervisord "" .

Webapp , docker-compose.yml , symfony. docker-compose.yml

webapp_fpm:
  image: ...  
  volumes:
    - ./symfony:/var/www/html
    - ./docker-conf/supervisord:/etc/supervisord
    - /var/log/appname/symfony:/var/log/symfony
  entrypoint: "/bin/bash php_entrypoint.sh"
+2

Source: https://habr.com/ru/post/1672831/


All Articles