All Projects β†’ maxpou β†’ Docker Symfony

maxpou / Docker Symfony

Licence: mit
🐳 A docker multicontainer with NGINX, PHP7-FPM, MySQL and ELK (Elasticsearch Logstash and Kibana)

Projects that are alternatives of or similar to Docker Symfony

Stacker
Stacker - The environment for local web development, ready for use.
Stars: ✭ 356 (-72.72%)
Mutual labels:  mysql, symfony, docker-compose, nginx
Docker Nginx Php Mysql
Docker running Nginx, PHP-FPM, MySQL & PHPMyAdmin
Stars: ✭ 1,322 (+1.3%)
Mutual labels:  mysql, docker-compose, nginx
Docker Laravel
🐳 Docker Images for Laravel development
Stars: ✭ 101 (-92.26%)
Mutual labels:  mysql, docker-compose, nginx
Kickoff Docker Php
🐳 🐘 πŸš€ Easily setup a PHP project with Docker
Stars: ✭ 213 (-83.68%)
Mutual labels:  mysql, docker-compose, nginx
Docker Lnmp
πŸ‹Docker-compose(Linux,Nginx,MySQL,PHP7,Redis)
Stars: ✭ 244 (-81.3%)
Mutual labels:  mysql, docker-compose, nginx
Php Docker Boilerplate
🍲 PHP Docker Boilerplate for Symfony, Wordpress, Joomla or any other PHP Project (NGINX, Apache HTTPd, PHP-FPM, MySQL, Solr, Elasticsearch, Redis, FTP)
Stars: ✭ 503 (-61.46%)
Mutual labels:  mysql, symfony, nginx
Symfony 4 Docker Env
Docker Environment for Symfony. PHP-FPM, NGINX SSL Proxy, MySQL, LEMP
Stars: ✭ 119 (-90.88%)
Mutual labels:  mysql, docker-compose, nginx
Devilbox
A modern Docker LAMP stack and MEAN stack for local development
Stars: ✭ 3,598 (+175.71%)
Mutual labels:  mysql, docker-compose, nginx
Docker Laravel
🐳 Build a simple laravel development environment with docker-compose.
Stars: ✭ 415 (-68.2%)
Mutual labels:  mysql, docker-compose, nginx
Vagrant Php Dev Box
PHP 7 vagrant development box with nginx, php-fpm, MySQL, Symfony, Laravel, ... on Ubuntu 16.04
Stars: ✭ 473 (-63.75%)
Mutual labels:  mysql, symfony, nginx
Docker Skeleton Php
A simple Docker PHP development environment
Stars: ✭ 40 (-96.93%)
Mutual labels:  mysql, symfony, nginx
Docker Magento Mutagen
Mage2click Docker-based development environment for Magento with mutagen.io sync for files on macOS
Stars: ✭ 64 (-95.1%)
Mutual labels:  docker-compose, nginx
Docker Examples
There are many like it, but this one is mine.
Stars: ✭ 66 (-94.94%)
Mutual labels:  mysql, symfony
Directus Docker
Directus 6 Docker β€” Legacy Container [EOL]
Stars: ✭ 68 (-94.79%)
Mutual labels:  mysql, docker-compose
Docker Tutorial
Code for a creating a docker app with Flask and MySQL tutorial
Stars: ✭ 73 (-94.41%)
Mutual labels:  mysql, docker-compose
Bookstoreapp Distributed Application
Ecommerce project is being developed using Spring Boot Microservices and Spring Cloud (Backend) and React (Frontend). Splitting the Ecommerce functionality into various individual microservices so that they can be distributed, scale really well and make use of resources efficiently.
Stars: ✭ 63 (-95.17%)
Mutual labels:  mysql, docker-compose
Dockerfiles
lots of dockerfiles, based on alpine
Stars: ✭ 69 (-94.71%)
Mutual labels:  docker-compose, nginx
Docker Compose Lamp
A basic LAMP stack environment built using Docker Compose.
Stars: ✭ 1,284 (-1.61%)
Mutual labels:  mysql, docker-compose
Sanic Nginx Docker Example
Sanic + Nginx + Docker basic example
Stars: ✭ 77 (-94.1%)
Mutual labels:  docker-compose, nginx
Shorty
πŸ”— A URL shortening service built using Flask and MySQL
Stars: ✭ 78 (-94.02%)
Mutual labels:  mysql, nginx

Docker Symfony (PHP7-FPM - NGINX - MySQL - ELK)

Build Status

Docker-symfony gives you everything you need for developing Symfony application. This complete stack run with docker and docker-compose (1.7 or higher).

Installation

  1. Create a .env from the .env.dist file. Adapt it according to your symfony application

    cp .env.dist .env
    
  2. Build/run containers with (with and without detached mode)

    $ docker-compose build
    $ docker-compose up -d
    
  3. Update your system host file (add symfony.local)

    # UNIX only: get containers IP address and update host (replace IP according to your configuration) (on Windows, edit C:\Windows\System32\drivers\etc\hosts)
    $ sudo echo $(docker network inspect bridge | grep Gateway | grep -o -E '([0-9]{1,3}\.){3}[0-9]{1,3}') "symfony.local" >> /etc/hosts
    

    Note: For OS X, please take a look here and for Windows read this (4th step).

  4. Prepare Symfony app

    1. Update app/config/parameters.yml

      # path/to/your/symfony-project/app/config/parameters.yml
      parameters:
          database_host: db
      
    2. Composer install & create database

      $ docker-compose exec php bash
      $ composer install
      # Symfony2
      $ sf doctrine:database:create
      $ sf doctrine:schema:update --force
      # Only if you have `doctrine/doctrine-fixtures-bundle` installed
      $ sf doctrine:fixtures:load --no-interaction
      # Symfony3
      $ sf3 doctrine:database:create
      $ sf3 doctrine:schema:update --force
      # Only if you have `doctrine/doctrine-fixtures-bundle` installed
      $ sf3 doctrine:fixtures:load --no-interaction
      
  5. Enjoy :-)

Usage

Just run docker-compose up -d, then:

Customize

If you want to add optionnals containers like Redis, PHPMyAdmin... take a look on doc/custom.md.

How it works?

Have a look at the docker-compose.yml file, here are the docker-compose built images:

  • db: This is the MySQL database container,
  • php: This is the PHP-FPM container in which the application volume is mounted,
  • nginx: This is the Nginx webserver container in which application volume is mounted too,
  • elk: This is a ELK stack container which uses Logstash to collect logs, send them into Elasticsearch and visualize them with Kibana.

This results in the following running containers:

$ docker-compose ps
           Name                          Command               State              Ports            
--------------------------------------------------------------------------------------------------
dockersymfony_db_1            /entrypoint.sh mysqld            Up      0.0.0.0:3306->3306/tcp      
dockersymfony_elk_1           /usr/bin/supervisord -n -c ...   Up      0.0.0.0:81->80/tcp          
dockersymfony_nginx_1         nginx                            Up      443/tcp, 0.0.0.0:80->80/tcp
dockersymfony_php_1           php-fpm                          Up      0.0.0.0:9000->9000/tcp      

Useful commands

# bash commands
$ docker-compose exec php bash

# Composer (e.g. composer update)
$ docker-compose exec php composer update

# SF commands (Tips: there is an alias inside php container)
$ docker-compose exec php php /var/www/symfony/app/console cache:clear # Symfony2
$ docker-compose exec php php /var/www/symfony/bin/console cache:clear # Symfony3
# Same command by using alias
$ docker-compose exec php bash
$ sf cache:clear

# Retrieve an IP Address (here for the nginx container)
$ docker inspect --format '{{ .NetworkSettings.Networks.dockersymfony_default.IPAddress }}' $(docker ps -f name=nginx -q)
$ docker inspect $(docker ps -f name=nginx -q) | grep IPAddress

# MySQL commands
$ docker-compose exec db mysql -uroot -p"root"

# F***ing cache/logs folder
$ sudo chmod -R 777 app/cache app/logs # Symfony2
$ sudo chmod -R 777 var/cache var/logs var/sessions # Symfony3

# Check CPU consumption
$ docker stats $(docker inspect -f "{{ .Name }}" $(docker ps -q))

# Delete all containers
$ docker rm $(docker ps -aq)

# Delete all images
$ docker rmi $(docker images -q)

FAQ

  • Got this error: ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running? If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable. ?
    Run docker-compose up -d instead.

  • Permission problem? See this doc (Setting up Permission)

  • How to config Xdebug? Xdebug is configured out of the box! Just config your IDE to connect port 9001 and id key PHPSTORM

Contributing

First of all, thank you for contributing β™₯
If you find any typo/misconfiguration/... please send me a PR or open an issue. You can also ping me on twitter.
Also, while creating your Pull Request on GitHub, please write a description which gives the context and/or explains why you are creating it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].