Déplacement du répertoire conteneur vers son nouvel emplacement
This commit is contained in:
parent
4d44a43839
commit
2aad937419
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
|
||||||
Loading…
x
Reference in New Issue
Block a user