{"id":17283172,"url":"https://github.com/carlosas/docker-for-symfony","last_synced_at":"2025-07-01T08:34:48.223Z","repository":{"id":98894738,"uuid":"99811717","full_name":"carlosas/docker-for-symfony","owner":"carlosas","description":"Docker stack for Symfony 4 - NGINX / PHP7-FPM / MySQL / ELK / Redis / RabbitMQ","archived":false,"fork":false,"pushed_at":"2019-09-15T15:32:02.000Z","size":854,"stargazers_count":87,"open_issues_count":0,"forks_count":30,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-14T10:11:34.599Z","etag":null,"topics":["docker","elk","mysql","nginx","php-fpm","rabbitmq","redis","symfony"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carlosas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-09T13:31:17.000Z","updated_at":"2025-03-27T11:16:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"54aac3c8-41f0-4d0e-9c7a-9ae8c80d493f","html_url":"https://github.com/carlosas/docker-for-symfony","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/carlosas/docker-for-symfony","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlosas%2Fdocker-for-symfony","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlosas%2Fdocker-for-symfony/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlosas%2Fdocker-for-symfony/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlosas%2Fdocker-for-symfony/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carlosas","download_url":"https://codeload.github.com/carlosas/docker-for-symfony/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlosas%2Fdocker-for-symfony/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262928533,"owners_count":23386166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","elk","mysql","nginx","php-fpm","rabbitmq","redis","symfony"],"created_at":"2024-10-15T09:50:41.094Z","updated_at":"2025-07-01T08:34:48.200Z","avatar_url":"https://github.com/carlosas.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker stack for Symfony projects\n\n[![Build Status](https://travis-ci.org/carlosas/docker-for-symfony.svg?branch=master)](https://travis-ci.org/carlosas/docker-for-symfony)\n:octocat:\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](LICENSE)\n[![contributions](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat-square)](https://github.com/carlosas/docker-for-symfony/issues)\n[![HitCount](http://hits.dwyl.com/carlosas/docker-for-symfony.svg)](http://hits.dwyl.com/carlosas/docker-for-symfony)\n\n![](doc/schema.png)\n\n## Basic info\n\n* [nginx](https://nginx.org/)\n* [PHP-FPM](https://php-fpm.org/)\n* [MySQL](https://www.mysql.com/)\n* [Redis](https://redis.io/)\n* [Elasticsearch](https://www.elastic.co/products/elasticsearch)\n* [Logstash](https://www.elastic.co/products/logstash)\n* [Kibana](https://www.elastic.co/products/kibana)\n* [RabbitMQ](https://www.rabbitmq.com/)\n\n## Previous requirements\n\nThis stack needs [docker](https://www.docker.com/) and [docker-compose](https://docs.docker.com/compose/) to be installed.\n\n## Installation\n\n1. Create a `.env` file from `.env.dist` and adapt it according to the needs of the application\n\n    ```sh\n    $ cp .env.dist .env \u0026\u0026 nano .env\n    ```\n\n2.  Due to an Elasticsearch 6 requirement, we may need to set a host's sysctl option and restart ([More info](https://github.com/spujadas/elk-docker/issues/92)):\n\n    ```sh\n    $ sudo sysctl -w vm.max_map_count=262144\n    ```\n\n3. Build and run the stack in detached mode (stop any system's ngixn/apache2 service first)\n\n    ```sh\n    $ docker-compose build\n    $ docker-compose up -d\n    ```\n\n4. Get the bridge IP address\n\n    ```sh\n    $ docker network inspect bridge | grep Gateway | grep -o -E '[0-9\\.]+'\n    # OR an alternative command\n    $ ifconfig docker0 | awk '/inet:/{ print substr($2,6); exit }'\n    ```\n\n5. Update your system's hosts file with the IP retrieved in **step 3**\n\n6. Prepare the Symfony application\n    1. Update Symfony env variables (*.env*)\n\n        ```\n        #...\n        DATABASE_URL=mysql://db_user:db_password@mysql:3306/db_name\n        #...\n        ```\n\n    2. Composer install \u0026 update the schema from the container\n\n        ```sh\n        $ docker-compose exec php bash\n        $ composer install\n        $ symfony doctrine:schema:update --force\n        ```\n7. (Optional) Xdebug: Configure your IDE to connect to port `9001` with key `PHPSTORM`\n\n## How does it work?\n\nWe have the following *docker-compose* built images:\n\n* `nginx`: The Nginx webserver container in which the application volume is mounted.\n* `php`: The PHP-FPM container in which the application volume is mounted too.\n* `mysql`: The MySQL database container.\n* `elk`: Container which uses Logstash to collect logs, send them into Elasticsearch and visualize them with Kibana.\n* `redis`: The Redis server container.\n* `rabbitmq`: The RabbitMQ server/administration container.\n\nRunning `docker-compose ps` should result in the following running containers:\n\n```\n           Name                          Command               State              Ports\n--------------------------------------------------------------------------------------------------\ncontainer_mysql         /entrypoint.sh mysqld            Up      0.0.0.0:3306-\u003e3306/tcp\ncontainer_nginx         nginx                            Up      443/tcp, 0.0.0.0:80-\u003e80/tcp\ncontainer_phpfpm        php-fpm                          Up      0.0.0.0:9000-\u003e9000/tcp\ncontainer_redis         docker-entrypoint.sh redis ...   Up      6379/tcp\ncontainer_rabbit        rabbitmq:3-management            Up      4369/tcp, 5671/tcp, 0.0.0.0:5672-\u003e5672/tcp, 15671/tcp, 25672/tcp, 0.0.0.0:15672-\u003e15672\ncontainer_elk           /usr/bin/supervisord -n -c ...   Up      0.0.0.0:5044-\u003e5044/tcp, 0.0.0.0:5601-\u003e5601/tcp, 0.0.0.0:9200-\u003e9200/tcp, 9300/tcp\n```\n\n## Usage\n\nOnce all the containers are up, our services are available at:\n\n* Symfony app: `http://symfony.dev:80`\n* Mysql server: `symfony.dev:3306`\n* Redis: `symfony.dev:6379`\n* Elasticsearch: `symfony.dev:9200`\n* Kibana: `http://symfony.dev:5601`\n* RabbitMQ: `http://symfony.dev:15672`\n* Log files location: *logs/nginx* and *logs/symfony*\n\n:tada: Now we can stop our stack with `docker-compose down` and start it again with `docker-compose up -d`\n\n---\n\nSoftware based on [eko/docker-symfony](https://github.com/eko/docker-symfony) and [maxpou/docker-symfony](https://github.com/maxpou/docker-symfony)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlosas%2Fdocker-for-symfony","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarlosas%2Fdocker-for-symfony","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlosas%2Fdocker-for-symfony/lists"}