-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
155 lines (147 loc) · 3.95 KB
/
docker-compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
version: '3.7'
services:
#Base de datos MySQL
db:
container_name: mysql_c
image: ${MYSQL_IMAGE}
volumes:
- type: volume
source: drupaldatabase
target: /var/lib/mysql
environment:
#Variables de entorno para las credenciales de mysql
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
networks:
- milocal
#Conectar el servicio a fluent-bit para recolectar logs
logging:
driver: fluentd
options:
fluentd-async-connect: "true"
fluentd-address: localhost:24224
tag: bd.logs
#Servidor web Nginx
nginx:
container_name: nginx_c
image: ${NGINX_IMAGE}
volumes:
- type: volume
source: staticfiles
target: /var/www/html
environment:
NGINX_BACKEND_PORT: 9000
NGINX_SERVER_NAME: localhost
NGINX_BACKEND_HOST: php
PROJECT_NAME: ${PROJECT_NAME}
networks:
- milocal
ports:
- 80:80
- 443:443
depends_on:
- "php"
- "fluentd"
#Conectar el servicio a fluent-bit para recolectar logs
logging:
driver: fluentd
options:
fluentd-async-connect: "true"
fluentd-address: localhost:24224
tag: nginx.logs
#Servicio php drupal + php-fpm
php:
container_name: drupal_c
image: ${DRUPAL_IMAGE}
volumes:
- type: volume
source: staticfiles
target: /opt/drupal/web
environment:
#Variables de entorno para conectar drupal con la base de datos mysql
MYSQL_USER: ${MYSQL_USER}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_HOST: mysql_c
MYSQL_PORT: 3306
PROJECT_NAME: ${PROJECT_NAME}
PROJECT_BASE_DOMAIN: ${PROJECT_BASE_DOMAIN}
networks:
- milocal
depends_on:
- "db"
#Conectar el servicio a fluent-bit para recolectar logs
logging:
driver: fluentd
options:
fluentd-async-connect: "true"
fluentd-address: localhost:24224
tag: drupal.logs
#Plugin de grafana que recoge los logs de fluent-bit y permite visualizarlos en Grafana
loki:
image: grafana/loki:2.0.0
container_name: loki
volumes:
- ./config/loki.yaml:/etc/config/loki.yaml
ports:
- "3100:3100"
networks:
- milocal
#Fluent-bit, recolector y reenviador de registros.
fluentd:
container_name: fluentd
# Imagen específica de fluent-bit para Loki+Grafana
image: grafana/fluent-bit-plugin-loki
ports:
- 24224:24224
- 24224:24224/udp
- 2020:2020
environment:
#Url necesaria para conectar con Loki
LOKI_URL: http://loki:3100/loki/api/v1/push
volumes:
# Fichero de configuración principal de fluent-bit
- ./fluent-bit/fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
# Fichero de configuración para parsers
- ./fluent-bit/parsers.conf:/fluent-bit/etc/parsers.conf
# Directorio para ficheros proporcionados por calyptia cloud
- ./fluent-bit/calyptia:/tmp/storage
networks:
- milocal
#Herramienta de monitoreo. Visualización de Logs
grafana:
image: grafana/grafana:7.2.2
container_name: grafana
environment:
#Credenciales para entrar en Grafana
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
ports:
- "3000:3000"
networks:
- milocal
depends_on:
- loki
volumes:
# Fichero para proporcionar el datasource (conexión a Loki)
- ./grafana/configs/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml
#Volúmenes para ficheros estáticos (Drupal y MySQL)
volumes:
staticfiles:
driver: local
driver_opts:
type: none
device: ./storage/files
o: bind
drupaldatabase:
driver: local
driver_opts:
type: none
device: ./storage/mysql
o: bind
#Red local
networks:
milocal:
driver: bridge