Compare commits
2 Commits
eee26a9b80
...
a0eb45ac03
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0eb45ac03 | ||
|
|
bded2893ab |
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-index/index_20446/1766617200
Normal file
BIN
centre_observabilite/loki-index/index_20446/1766617200
Normal file
Binary file not shown.
BIN
centre_observabilite/loki-index/index_20446/1766617200.snapshot
Normal file
BIN
centre_observabilite/loki-index/index_20446/1766617200.snapshot
Normal file
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/00000204
Normal file
BIN
centre_observabilite/loki-wal/00000204
Normal file
Binary file not shown.
Binary file not shown.
BIN
centre_observabilite/loki-wal/checkpoint.000203/00000000
Normal file
BIN
centre_observabilite/loki-wal/checkpoint.000203/00000000
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
# Installation des dépendances de base
|
||||
# Installation des dépendances de base + PostgreSQL
|
||||
RUN apt-get update && apt-get install -y \
|
||||
apache2 \
|
||||
supervisor \
|
||||
@ -10,6 +10,8 @@ RUN apt-get update && apt-get install -y \
|
||||
gnupg \
|
||||
lsb-release \
|
||||
openjdk-17-jdk \
|
||||
postgresql-13 \
|
||||
postgresql-contrib \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Installation de Tomcat 10
|
||||
@ -20,7 +22,7 @@ RUN cd /opt && \
|
||||
rm apache-tomcat-10.1.47.tar.gz && \
|
||||
chmod +x /opt/tomcat/bin/*.sh
|
||||
|
||||
# Variables d'environnement Tomcat
|
||||
# Variables d'environnement
|
||||
ENV CATALINA_HOME=/opt/tomcat
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
|
||||
ENV PATH=$PATH:$CATALINA_HOME/bin
|
||||
@ -44,12 +46,64 @@ RUN wget https://github.com/grafana/loki/releases/download/v2.9.0/promtail-linux
|
||||
&& chmod +x /usr/local/bin/promtail \
|
||||
&& rm promtail-linux-amd64.zip
|
||||
|
||||
# Suppression et recréation des répertoires PostgreSQL
|
||||
RUN rm -rf /var/lib/postgresql/13/main && \
|
||||
mkdir -p /var/run/postgresql \
|
||||
/var/lib/postgresql/13/main \
|
||||
/var/log/postgresql \
|
||||
/var/log/apache2 \
|
||||
/var/log/promtail \
|
||||
/opt/tomcat/logs \
|
||||
/var/log/supervisor \
|
||||
/docker-entrypoint-initdb.d && \
|
||||
chown -R postgres:postgres /var/run/postgresql /var/lib/postgresql /var/log/postgresql
|
||||
|
||||
# Initialisation de PostgreSQL
|
||||
RUN su - postgres -c "/usr/lib/postgresql/13/bin/initdb -D /var/lib/postgresql/13/main" && \
|
||||
echo "host all all 0.0.0.0/0 md5" >> /var/lib/postgresql/13/main/pg_hba.conf && \
|
||||
echo "listen_addresses='*'" >> /var/lib/postgresql/13/main/postgresql.conf
|
||||
|
||||
# Copie des scripts SQL
|
||||
COPY database/schema.sql /docker-entrypoint-initdb.d/01-schema.sql
|
||||
COPY database/data.sql /docker-entrypoint-initdb.d/02-data.sql
|
||||
|
||||
# Script pour créer la base de données et exécuter les scripts SQL
|
||||
RUN echo '#!/bin/bash\n\
|
||||
echo "Waiting for PostgreSQL to start..."\n\
|
||||
for i in {1..30}; do\n\
|
||||
if su - postgres -c "psql -c \"SELECT 1;\"" >/dev/null 2>&1; then\n\
|
||||
echo "PostgreSQL is ready!"\n\
|
||||
break\n\
|
||||
fi\n\
|
||||
echo "Waiting... ($i/30)"\n\
|
||||
sleep 1\n\
|
||||
done\n\
|
||||
\n\
|
||||
echo "Creating database and user..."\n\
|
||||
su - postgres -c "psql -c \"SELECT 1 FROM pg_database WHERE datname = '\''archiweb_db'\''\" | grep -q 1 || psql -c \"CREATE DATABASE archiweb_db;\""\n\
|
||||
su - postgres -c "psql -c \"SELECT 1 FROM pg_roles WHERE rolname = '\''archiweb_user'\''\" | grep -q 1 || psql -c \"CREATE USER archiweb_user WITH PASSWORD '\''archiweb_password'\'';\""\n\
|
||||
su - postgres -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE archiweb_db TO archiweb_user;\""\n\
|
||||
su - postgres -c "psql -d archiweb_db -c \"GRANT ALL ON SCHEMA public TO archiweb_user;\""\n\
|
||||
\n\
|
||||
echo "Executing SQL scripts..."\n\
|
||||
if [ -f /docker-entrypoint-initdb.d/01-schema.sql ]; then\n\
|
||||
echo "Running schema.sql..."\n\
|
||||
su - postgres -c "psql -d archiweb_db -f /docker-entrypoint-initdb.d/01-schema.sql"\n\
|
||||
fi\n\
|
||||
\n\
|
||||
if [ -f /docker-entrypoint-initdb.d/02-data.sql ]; then\n\
|
||||
echo "Running data.sql..."\n\
|
||||
su - postgres -c "psql -d archiweb_db -f /docker-entrypoint-initdb.d/02-data.sql"\n\
|
||||
fi\n\
|
||||
\n\
|
||||
echo "Database setup complete!"' > /usr/local/bin/init-database.sh && \
|
||||
chmod +x /usr/local/bin/init-database.sh
|
||||
|
||||
# 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
|
||||
# Configuration Apache
|
||||
RUN echo '<Location "/server-status">\n\
|
||||
SetHandler server-status\n\
|
||||
Require all granted\n\
|
||||
@ -66,12 +120,9 @@ RUN echo '<VirtualHost *:80>\n\
|
||||
ProxyPassReverse /api http://localhost:8080/api\n\
|
||||
</VirtualHost>' > /etc/apache2/sites-available/000-default.conf
|
||||
|
||||
# Création des répertoires de logs
|
||||
RUN mkdir -p /var/log/apache2 /var/log/promtail /opt/tomcat/logs
|
||||
|
||||
# Copie du WAR (à placer dans le contexte de build)
|
||||
# Copie du WAR
|
||||
COPY archiweb-api-1.0.0.war /opt/tomcat/webapps/api.war
|
||||
|
||||
EXPOSE 80 8080 9100 9117 9080
|
||||
EXPOSE 80 8080 9100 9117 9080 5432
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||
|
||||
@ -4,23 +4,44 @@ user=root
|
||||
logfile=/var/log/supervisor/supervisord.log
|
||||
pidfile=/var/run/supervisord.pid
|
||||
|
||||
[program:postgresql]
|
||||
command=/usr/lib/postgresql/13/bin/postgres -D /var/lib/postgresql/13/main
|
||||
user=postgres
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=1
|
||||
stdout_logfile=/var/log/postgresql/postgresql.log
|
||||
stderr_logfile=/var/log/postgresql/postgresql-error.log
|
||||
startsecs=5
|
||||
stopwaitsecs=30
|
||||
|
||||
[program:init-database]
|
||||
command=/usr/local/bin/init-database.sh
|
||||
autostart=true
|
||||
autorestart=false
|
||||
priority=5
|
||||
stdout_logfile=/var/log/postgresql/init-database.log
|
||||
stderr_logfile=/var/log/postgresql/init-database-error.log
|
||||
startsecs=0
|
||||
|
||||
[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
|
||||
priority=10
|
||||
startsecs=5
|
||||
|
||||
[program:tomcat]
|
||||
command=/opt/tomcat/bin/catalina.sh run
|
||||
command=/bin/bash -c 'sleep 20 && /opt/tomcat/bin/catalina.sh run'
|
||||
environment=JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64",CATALINA_HOME="/opt/tomcat"
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/opt/tomcat/logs/catalina.out
|
||||
stderr_logfile=/opt/tomcat/logs/catalina.out
|
||||
priority=1
|
||||
startsecs=30
|
||||
priority=15
|
||||
startsecs=35
|
||||
stopwaitsecs=30
|
||||
|
||||
[program:node_exporter]
|
||||
@ -31,7 +52,8 @@ stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
priority=2
|
||||
priority=20
|
||||
startsecs=5
|
||||
|
||||
[program:apache_exporter]
|
||||
command=/usr/local/bin/apache_exporter --scrape_uri=http://localhost/server-status?auto
|
||||
@ -39,7 +61,7 @@ autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/apache_exporter.log
|
||||
stderr_logfile=/var/log/apache_exporter_error.log
|
||||
priority=2
|
||||
priority=20
|
||||
startsecs=5
|
||||
|
||||
[program:promtail]
|
||||
@ -48,5 +70,5 @@ autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/promtail/promtail.log
|
||||
stderr_logfile=/var/log/promtail/promtail_error.log
|
||||
priority=3
|
||||
priority=25
|
||||
startsecs=5
|
||||
|
||||
@ -19,6 +19,7 @@ CREATE TABLE utilisateur
|
||||
nom VARCHAR(100),
|
||||
prenom VARCHAR(100),
|
||||
email VARCHAR(255),
|
||||
token_reinitialisation VARCHAR(255),
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT ux_u_login UNIQUE (login),
|
||||
CONSTRAINT ux_u_email UNIQUE (email)
|
||||
|
||||
@ -9,14 +9,17 @@ services:
|
||||
- "9117:9117"
|
||||
- "9101:9100"
|
||||
- "9080:9080"
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- apache-logs:/var/log/apache2
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- centre_observabilite_observability
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
apache-logs:
|
||||
postgres-data:
|
||||
|
||||
networks:
|
||||
centre_observabilite_observability:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user