Git Product home page Git Product logo

docker-symfony's Introduction

docker-symfony

Build Status

Just a little Docker POC in order to have a complete stack for running Symfony into Docker containers using docker-compose tool.

Installation

First, install docker and docker-compose

Clone this repository:

$ git clone https://github.com/hlecuyer/docker-symfony.git

Then choose one of the following:

  • Create new project with the following instructions
$ docker run --rm --interactive --tty --user $UID --volume $PWD:/code --workdir /code roukmoute/symfony-installer new symfony

then

$ sudo chmod -R 777 symfony
  • Or put your Symfony application into symfony folder.

Do not forget to add the line 127.0.0.1 symfony.dev in your /etc/hosts file.

Make sure you replace the value of database_host in symfony/app/config/parameters.yml and symfony/app/config/parameters.yml.dist to the database container alias "db"

Then, run:

$ docker-compose up

You are done, you can visit your Symfony application on the following URL: http://symfony.dev (and access Kibana on http://symfony.dev:81)

You can access the symfony console via bin/cli;

Exemple:

    $ bin/cli doctrine:migration:migrate

You can access composer via bin/composer;

    $ bin/composer install

You can access php via bin/php;

    $ bin/php yout_script.php

Note : you can rebuild all Docker images by running:

$ docker-compose build

How it works?

Here are the docker-compose built images:

  • db: This is the MySQL database container (can be changed to postgresql or whatever in docker-compose.yml file),
  • php: This is the PHP-FPM container including the application volume mounted on,
  • nginx: This is the Nginx webserver container in which php volumes are 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
        -------------------------------------------------------------------------------------------
        docker_db_1            /entrypoint.sh mysqld            Up      0.0.0.0:3306->3306/tcp
        docker_elk_1           /usr/bin/supervisord -n -c ...   Up      0.0.0.0:81->80/tcp
        docker_nginx_1         nginx                            Up      443/tcp, 0.0.0.0:80->80/tcp
        docker_php_1           php5-fpm -F                      Up      9000/tcp

Read logs

You can access Nginx and Symfony application logs in the following directories on your host machine:

  • logs/nginx
  • logs/symfony

Use Kibana!

You can also use Kibana to visualize Nginx & Symfony logs by visiting http://symfony.dev:81.

Code license

You are free to use the code in this repository under the terms of the 0-clause BSD license. LICENSE contains a copy of this license.

docker-symfony's People

Contributors

eko avatar hlecuyer avatar julbrs avatar lrkwz avatar samsch avatar akovalyov avatar b-galati avatar mickadoo avatar phpeek avatar vria avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.