ok
This commit is contained in:
parent
f36304ffe1
commit
85adfe7e02
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
centre_observabilite/loki-wal/00000041
Normal file
BIN
centre_observabilite/loki-wal/00000041
Normal file
Binary file not shown.
Binary file not shown.
BIN
centre_observabilite/loki-wal/checkpoint.000039/00000000
Normal file
BIN
centre_observabilite/loki-wal/checkpoint.000039/00000000
Normal file
Binary file not shown.
43
conteneur/Dockerfile
Normal file
43
conteneur/Dockerfile
Normal file
@ -0,0 +1,43 @@
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
# Installation des dépendances
|
||||
RUN apt-get update && apt-get install -y \
|
||||
apache2 \
|
||||
supervisor \
|
||||
wget \
|
||||
curl \
|
||||
unzip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Installation Apache Exporter
|
||||
RUN wget https://github.com/Lusitaniae/apache_exporter/releases/download/v1.0.10/apache_exporter-1.0.10.linux-amd64.tar.gz \
|
||||
&& tar xzf apache_exporter-1.0.10.linux-amd64.tar.gz \
|
||||
&& mv apache_exporter-1.0.10.linux-amd64/apache_exporter /usr/local/bin/ \
|
||||
&& rm -rf apache_exporter-*
|
||||
|
||||
# Installation Promtail
|
||||
RUN wget https://github.com/grafana/loki/releases/download/v2.9.0/promtail-linux-amd64.zip \
|
||||
&& unzip promtail-linux-amd64.zip \
|
||||
&& mv promtail-linux-amd64 /usr/local/bin/promtail \
|
||||
&& chmod +x /usr/local/bin/promtail \
|
||||
&& rm promtail-linux-amd64.zip
|
||||
|
||||
# Copie des configurations
|
||||
COPY configs/apache/httpd.conf /etc/apache2/sites-available/000-default.conf
|
||||
COPY configs/promtail/config.yaml /etc/promtail/config.yaml
|
||||
COPY configs/supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# Configuration Apache pour server-status
|
||||
RUN echo '<Location "/server-status">\n\
|
||||
SetHandler server-status\n\
|
||||
Require all granted\n\
|
||||
</Location>' > /etc/apache2/conf-available/server-status.conf \
|
||||
&& a2enconf server-status \
|
||||
&& a2enmod status
|
||||
|
||||
# Création des répertoires de logs
|
||||
RUN mkdir -p /var/log/apache2 /var/log/promtail
|
||||
|
||||
EXPOSE 80 9117 9080
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||
27
conteneur/configs/apache/httpd.conf
Normal file
27
conteneur/configs/apache/httpd.conf
Normal file
@ -0,0 +1,27 @@
|
||||
# Configuration Apache de base
|
||||
ServerRoot "/etc/apache2"
|
||||
#Listen 80
|
||||
|
||||
# Modules (déjà chargés par défaut dans debian/ubuntu)
|
||||
|
||||
ServerAdmin admin@localhost
|
||||
ServerName localhost
|
||||
|
||||
DocumentRoot "/var/www/html"
|
||||
<Directory "/var/www/html">
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
ErrorLog /var/log/apache2/error.log
|
||||
LogLevel warn
|
||||
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
||||
CustomLog /var/log/apache2/access.log combined
|
||||
|
||||
# Server status pour apache_exporter
|
||||
<Location "/server-status">
|
||||
SetHandler server-status
|
||||
Require all granted
|
||||
</Location>
|
||||
26
conteneur/configs/promtail/config.yaml
Normal file
26
conteneur/configs/promtail/config.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
server:
|
||||
http_listen_port: 9080
|
||||
grpc_listen_port: 0
|
||||
|
||||
positions:
|
||||
filename: /tmp/positions.yaml
|
||||
|
||||
clients:
|
||||
- url: http://192.168.56.61:3100/loki/api/v1/push
|
||||
|
||||
scrape_configs:
|
||||
- job_name: apache_access
|
||||
static_configs:
|
||||
- targets: [localhost]
|
||||
labels:
|
||||
job: apache_access
|
||||
host: apache_all_in_one
|
||||
__path__: /var/log/apache2/access.log
|
||||
|
||||
- job_name: apache_error
|
||||
static_configs:
|
||||
- targets: [localhost]
|
||||
labels:
|
||||
job: apache_error
|
||||
host: apache_all_in_one
|
||||
__path__: /var/log/apache2/error.log
|
||||
31
conteneur/configs/supervisord/supervisord.conf
Normal file
31
conteneur/configs/supervisord/supervisord.conf
Normal file
@ -0,0 +1,31 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
logfile=/var/log/supervisor/supervisord.log
|
||||
pidfile=/var/run/supervisord.pid
|
||||
|
||||
[program:apache2]
|
||||
command=/usr/sbin/apache2ctl -D FOREGROUND
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/apache2/access.log
|
||||
stderr_logfile=/var/log/apache2/error.log
|
||||
priority=1
|
||||
|
||||
[program:apache_exporter]
|
||||
command=/usr/local/bin/apache_exporter --scrape_uri=http://localhost/server-status?auto
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/apache_exporter.log
|
||||
stderr_logfile=/var/log/apache_exporter_error.log
|
||||
priority=2
|
||||
startsecs=5
|
||||
|
||||
[program:promtail]
|
||||
command=/usr/local/bin/promtail -config.file=/etc/promtail/config.yaml
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/promtail/promtail.log
|
||||
stderr_logfile=/var/log/promtail/promtail_error.log
|
||||
priority=3
|
||||
startsecs=5
|
||||
23
conteneur/docker-compose.yml
Normal file
23
conteneur/docker-compose.yml
Normal file
@ -0,0 +1,23 @@
|
||||
services:
|
||||
apache-observability:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: apache_all_in_one
|
||||
ports:
|
||||
- "8080:80"
|
||||
- "9117:9117"
|
||||
- "9080:9080"
|
||||
volumes:
|
||||
- apache-logs:/var/log/apache2
|
||||
networks:
|
||||
- centre_observabilite_observability
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
apache-logs:
|
||||
|
||||
networks:
|
||||
centre_observabilite_observability:
|
||||
external: true
|
||||
name: centre_observabilite_observability
|
||||
@ -1,176 +0,0 @@
|
||||
services:
|
||||
apache-config-init:
|
||||
image: busybox:latest
|
||||
container_name: apache-config-init
|
||||
volumes:
|
||||
- apache-config:/config
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
cat > /config/httpd.conf <<'EOF'
|
||||
ServerRoot "/usr/local/apache2"
|
||||
Listen 80
|
||||
|
||||
LoadModule mpm_event_module modules/mod_mpm_event.so
|
||||
LoadModule authn_file_module modules/mod_authn_file.so
|
||||
LoadModule authn_core_module modules/mod_authn_core.so
|
||||
LoadModule authz_host_module modules/mod_authz_host.so
|
||||
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
|
||||
LoadModule authz_user_module modules/mod_authz_user.so
|
||||
LoadModule authz_core_module modules/mod_authz_core.so
|
||||
LoadModule access_compat_module modules/mod_access_compat.so
|
||||
LoadModule auth_basic_module modules/mod_auth_basic.so
|
||||
LoadModule reqtimeout_module modules/mod_reqtimeout.so
|
||||
LoadModule filter_module modules/mod_filter.so
|
||||
LoadModule mime_module modules/mod_mime.so
|
||||
LoadModule log_config_module modules/mod_log_config.so
|
||||
LoadModule env_module modules/mod_env.so
|
||||
LoadModule headers_module modules/mod_headers.so
|
||||
LoadModule setenvif_module modules/mod_setenvif.so
|
||||
LoadModule version_module modules/mod_version.so
|
||||
LoadModule unixd_module modules/mod_unixd.so
|
||||
LoadModule status_module modules/mod_status.so
|
||||
LoadModule autoindex_module modules/mod_autoindex.so
|
||||
LoadModule dir_module modules/mod_dir.so
|
||||
LoadModule alias_module modules/mod_alias.so
|
||||
|
||||
<IfModule unixd_module>
|
||||
User daemon
|
||||
Group daemon
|
||||
</IfModule>
|
||||
|
||||
ServerAdmin admin@localhost
|
||||
ServerName localhost
|
||||
|
||||
<Directory />
|
||||
AllowOverride none
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
DocumentRoot "/usr/local/apache2/htdocs"
|
||||
<Directory "/usr/local/apache2/htdocs">
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<IfModule dir_module>
|
||||
DirectoryIndex index.html
|
||||
</IfModule>
|
||||
|
||||
<Files ".ht*">
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
ErrorLog /usr/local/apache2/logs/error_log
|
||||
LogLevel warn
|
||||
|
||||
<IfModule log_config_module>
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b" common
|
||||
CustomLog /usr/local/apache2/logs/access_log combined
|
||||
</IfModule>
|
||||
|
||||
<IfModule mime_module>
|
||||
TypesConfig conf/mime.types
|
||||
AddType application/x-compress .Z
|
||||
AddType application/x-gzip .gz .tgz
|
||||
</IfModule>
|
||||
|
||||
# Configuration du module status pour apache_exporter
|
||||
<Location "/server-status">
|
||||
SetHandler server-status
|
||||
Require all granted
|
||||
</Location>
|
||||
EOF
|
||||
echo "Apache config created"
|
||||
restart: "no"
|
||||
|
||||
apache_service:
|
||||
image: httpd:2.4
|
||||
container_name: conteneur_service
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- apache-logs:/usr/local/apache2/logs
|
||||
- apache-config:/usr/local/apache2/conf:ro
|
||||
networks:
|
||||
- observability
|
||||
depends_on:
|
||||
- apache-config-init
|
||||
command: >
|
||||
sh -c "touch /usr/local/apache2/logs/access_log /usr/local/apache2/logs/error_log &&
|
||||
exec httpd-foreground"
|
||||
|
||||
apache_exporter:
|
||||
image: lusotycoon/apache-exporter:v1.0.10
|
||||
container_name: apache_exporter_service
|
||||
command:
|
||||
- '--scrape_uri=http://apache_service/server-status?auto'
|
||||
ports:
|
||||
- "9117:9117"
|
||||
depends_on:
|
||||
- apache_service
|
||||
networks:
|
||||
- observability
|
||||
|
||||
promtail-service-config-init:
|
||||
image: busybox:latest
|
||||
container_name: promtail-service-config-init
|
||||
volumes:
|
||||
- promtail-service-config-vol:/config
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
cat > /config/config.yaml <<'EOF'
|
||||
server:
|
||||
http_listen_port: 9080
|
||||
grpc_listen_port: 0
|
||||
positions:
|
||||
filename: /tmp/positions.yaml
|
||||
clients:
|
||||
- url: http://192.168.56.61:3100/loki/api/v1/push
|
||||
scrape_configs:
|
||||
- job_name: apache_access
|
||||
static_configs:
|
||||
- targets: [localhost]
|
||||
labels:
|
||||
job: apache_access
|
||||
host: conteneur_service
|
||||
__path__: /var/log/apache2/access_log
|
||||
- job_name: apache_error
|
||||
static_configs:
|
||||
- targets: [localhost]
|
||||
labels:
|
||||
job: apache_error
|
||||
host: conteneur_service
|
||||
__path__: /var/log/apache2/error_log
|
||||
EOF
|
||||
echo "Promtail service config created"
|
||||
restart: "no"
|
||||
|
||||
promtail_service:
|
||||
image: grafana/promtail:2.9.0
|
||||
container_name: promtail_service
|
||||
volumes:
|
||||
- apache-logs:/var/log/apache2:ro
|
||||
- promtail-service-config-vol:/etc/promtail:ro
|
||||
command:
|
||||
- '-config.file=/etc/promtail/config.yaml'
|
||||
depends_on:
|
||||
- promtail-service-config-init
|
||||
- apache_service
|
||||
networks:
|
||||
- observability
|
||||
|
||||
volumes:
|
||||
apache-logs:
|
||||
apache-config:
|
||||
promtail-service-config-vol:
|
||||
|
||||
networks:
|
||||
observability:
|
||||
external: true
|
||||
name: observability_observability
|
||||
Loading…
x
Reference in New Issue
Block a user