• Stars
    star
    1,299
  • Rank 36,217 (Top 0.8 %)
  • Language
    Dockerfile
  • License
    BSD Zero Clause L...
  • Created over 9 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Run a Symfony application using Docker & docker-compose

docker-symfony

Build Status

This is a complete stack for running Symfony 5 (latest version), PHP8 and ELK stack using docker-compose tool.

Installation

First, clone this repository:

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

Next, put your Symfony application into symfony folder and do not forget to add symfony.localhost in your /etc/hosts file.

Make sure you adjust database_host in parameters.yml to the database container alias "db" (for Symfony < 4) Make sure you adjust DATABASE_URL in env to the database container alias "db" (for Symfony >= 4)

Then, run:

$ docker-compose up

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

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,
  • elasticsearch: This is the Elasticsearch server used to store our web server and application logs,
  • logstash: This is the Logstash tool from Elastic Stack that allows to read logs and send them into our Elasticsearch server,
  • kibana: This is the Kibana UI that is used to render logs and create beautiful dashboards.

This results in the following running containers:

> $ docker-compose ps
             Name                           Command               State                 Ports
-----------------------------------------------------------------------------------------------------------
mysql                            docker-entrypoint.sh --def ...   Up      0.0.0.0:3306->3306/tcp, 33060/tcp
elasticsearch                    /usr/local/bin/docker-entr ...   Up      0.0.0.0:9200->9200/tcp, 9300/tcp
kibana                           /usr/local/bin/dumb-init - ...   Up      0.0.0.0:81->5601/tcp
logstash                         /usr/local/bin/docker-entr ...   Up      5044/tcp, 9600/tcp
nginx                            nginx                            Up      443/tcp, 0.0.0.0:80->80/tcp
php-fpm                          php-fpm7 -F                      Up      0.0.0.0:9000->9001/tcp

Environment Customizations

You can customize the exposed ports and other parameters changing the docker-compose .env file.

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.localhost:81.

Use xdebug!

Start by updating your docker-compose .env file with PHP_XDEBUG_MODE=debug (or any other configuration you need as seen in the Xdebug documentation). You will need to re-build the php container for this value to take effect.

Configure your IDE to use port 5902 for XDebug. Docker versions below 18.03.1 don't support the Docker variable host.docker.internal.
In that case you'd have to swap out host.docker.internal with your machine IP address in php-fpm/xdebug.ini.

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.

More Repositories

1

gocache

☔️ A complete Go cache library that brings you multiple ways of managing your caches
Go
1,803
star
2

monday

⚡️ A dev tool for microservice developers to run local applications and/or forward others from/to Kubernetes SSH or TCP
Go
1,315
star
3

pihole-exporter

A Prometheus exporter for PI-Hole's Raspberry PI ad blocker
Go
729
star
4

authz

🛡️ Authorization backend that comes with a UI for RBAC and ABAC permissions
Go
158
star
5

FeedBundle

A Symfony bundle to build RSS feeds from your entities
PHP
138
star
6

monday-app

A GUI application for Monday original CLI application: https://github.com/eko/monday
JavaScript
51
star
7

tado-exporter

A Prometheus exporter for tado smart heating solution
Rust
48
star
8

GoogleTranslateBundle

A Symfony bundle to deals with Google Translate API
PHP
44
star
9

gofast

A simple micro-framework written in Go
Go
39
star
10

graphql-go-structure

An example of a graphql-go based structured project.
Go
28
star
11

graphql-go-upload

A middleware for GraphQL-Go to allow file upload and field data using multipart/form-data in mutations
Go
19
star
12

slackbot

This is a Slack Robot written in Go.
Go
15
star
13

book

A simple pandoc and markdown template repository for writing a book
Makefile
12
star
14

dotfiles

My personal configuration files
Vim Script
11
star
15

InstagramBundle

A Symfony bundle to interact with Instagram API
PHP
9
star
16

foREST

RESTful PHP 5.3 API Light Framework
PHP
8
star
17

git-notifier

A Golang Git notifier for Mac OS X.
Go
5
star
18

flowbot

A Flowdock robot library written in Go
Go
3
star
19

vagrant-vm

Puppet
2
star
20

python-websocket

A Python WebSocket server
Python
2
star
21

atom-pull-request

This package allows you to quickly prepare your pull request by driving you directly on your pull request creation page of your current Git project and by pre-defining source/target branches.
JavaScript
2
star
22

SonataDatagridBundle

This is a development repository
PHP
1
star
23

authz-php-sdk

Authz PHP SDK
PHP
1
star