Skip to content
Permalink
Browse files

Merge pull request #117 from Prims47/improve-docker

feat(Docker) - Improve Docker Compose script
  • Loading branch information
eko committed Dec 1, 2019
2 parents bc08cea + d783e0e commit 6bdd6dba05f44382aae61a5b9ef98d1ad62e0777
Showing with 39 additions and 11 deletions.
  1. +8 −7 README.md
  2. +31 −4 docker-compose.yml
@@ -16,7 +16,8 @@ $ 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"
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:

@@ -49,12 +50,12 @@ This results in the following running containers:
> $ docker-compose ps
Name Command State Ports
-----------------------------------------------------------------------------------------------------------
docker-symfony_db_1 docker-entrypoint.sh --def ... Up 0.0.0.0:3306->3306/tcp, 33060/tcp
docker-symfony_elasticsearch_1 /usr/local/bin/docker-entr ... Up 0.0.0.0:9200->9200/tcp, 9300/tcp
docker-symfony_kibana_1 /usr/local/bin/dumb-init - ... Up 0.0.0.0:81->5601/tcp
docker-symfony_logstash_1 /usr/local/bin/docker-entr ... Up 5044/tcp, 9600/tcp
docker-symfony_nginx_1 nginx Up 443/tcp, 0.0.0.0:80->80/tcp
docker-symfony_php_1 php-fpm7 -F Up 0.0.0.0:9000->9001/tcp
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
```

# Read logs
@@ -1,6 +1,7 @@
version: '3.7'
services:
db:
container_name: db
image: mysql
command: ["--default-authentication-plugin=mysql_native_password"]
ports:
@@ -10,43 +11,69 @@ services:
MYSQL_DATABASE: symfony
MYSQL_USER: symfony
MYSQL_PASSWORD: symfony
networks:
- db
php:
container_name: php-fpm
build: ./php-fpm
ports:
- "9000:9001"
volumes:
- ./symfony:/var/www/symfony:cached
- ./logs/symfony:/var/www/symfony/var/log:cached
links:
depends_on:
- db
networks:
- db
- php
nginx:
container_name: nginx
build: ./nginx
ports:
- "80:80"
links:
depends_on:
- php
networks:
- php
volumes:
- ./logs/nginx:/var/log/nginx:cached
- ./symfony:/var/www/symfony:cached
elasticsearch:
container_name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2
environment:
discovery.type: "single-node"
ports:
- "9200:9200"
networks:
elk_stack:
aliases:
- "elasticsearch"
logstash:
container_name: logstash
image: docker.elastic.co/logstash/logstash:7.4.2
depends_on:
- elasticsearch
volumes:
- ./elk/logstash/pipelines.yml:/usr/share/logstash/config/pipelines.yml:cached
- ./elk/logstash/conf.d:/etc/logstash/conf.d:cached
- ./logs/symfony:/var/www/symfony/var/log:cached
- ./logs/nginx:/var/log/nginx:cached
networks:
- elk_stack
kibana:
container_name: kibana
depends_on:
- elasticsearch
image: docker.elastic.co/kibana/kibana:7.4.2
environment:
SERVER_NAME: localhost
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
links:
- elasticsearch
networks:
- elk_stack
ports:
- "81:5601"
networks:
db:
php:
elk_stack:

0 comments on commit 6bdd6db

Please sign in to comment.
You can’t perform that action at this time.