Skip to content
Snippets Groups Projects
Commit 3c1c7928 authored by Marco Malavolti's avatar Marco Malavolti
Browse files

Fixed stdout/stderr for Apache & Cron

parent 191daff4
No related branches found
No related tags found
No related merge requests found
...@@ -5,22 +5,28 @@ ARG CHROME_VERSION=126.0.6478.126-1 ...@@ -5,22 +5,28 @@ ARG CHROME_VERSION=126.0.6478.126-1
ARG CHROMEDRIVER_VERSION=126.0.6478.126 ARG CHROMEDRIVER_VERSION=126.0.6478.126
ARG PYFF_VERSION=2.1.2 ARG PYFF_VERSION=2.1.2
#COPY --from=hairyhenderson/gomplate:v3.11.5 /gomplate /bin/gomplate
ARG UID=1000 ARG UID=1000
ARG GID=1000 ARG GID=1000
USER root USER root:root
RUN groupadd -g $GID -o eccs RUN groupadd -g ${GID} -o eccs \
RUN useradd -u $UID -g $GID -rms /bin/bash eccs && useradd -u ${UID} -g ${GID} -rms /bin/bash eccs \
&& apt-get update \
RUN apt-get update \ && apt-get install -y apt-utils net-tools vim cron wget gpg gpg-agent unzip ca-certificates \
&& apt-get install -y apt-utils net-tools vim cron wget gpg gpg-agent unzip ca-certificates \
build-essential python3-dev libxml2-dev libxml2-dev libxslt1-dev logrotate \ build-essential python3-dev libxml2-dev libxml2-dev libxslt1-dev logrotate \
apache2 php supervisor uwsgi uwsgi-plugin-python3 libapache2-mod-proxy-uwsgi libxml2-utils \ apache2 php supervisor uwsgi uwsgi-plugin-python3 libapache2-mod-proxy-uwsgi libxml2-utils \
python3 python3-pip python3-click python3-flask python3-flask-restful \ python3 python3-pip python3-click python3-flask python3-flask-restful \
python3-requests python3-selenium python3-urllib3 --no-install-recommends \ python3-requests python3-selenium python3-urllib3 --no-install-recommends \
&& sed -i -e 's/"syntax on/syntax on/g' /etc/vim/vimrc && sed -i -e 's/"syntax on/syntax on/g' /etc/vim/vimrc
#This command is used to replace the default values for ErrorLog and CustomLog in the httpd.conf file with a pipe command to redirect logs to both file and console
RUN sed -ri \
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/1/fd/1!g' \
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/1/fd/2!g' \
"/etc/apache2/sites-enabled/000-default.conf" \
&& sed -ri \
-e 's/^LogFormat.*\scombined$/LogFormat "[apache2] %h %t \\"%r\\" %>s \\"%{Referer}i\\" \\"%{User-Agent}i\\"" combined/g' \
"/etc/apache2/apache2.conf"
# Install PyFF # Install PyFF
RUN python3 -m pip install pyff==${PYFF_VERSION} --break-system-packages RUN python3 -m pip install pyff==${PYFF_VERSION} --break-system-packages
...@@ -31,6 +37,28 @@ RUN wget "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stabl ...@@ -31,6 +37,28 @@ RUN wget "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stabl
&& apt install -y ./google-chrome-stable_current_amd64.deb --no-install-recommends \ && apt install -y ./google-chrome-stable_current_amd64.deb --no-install-recommends \
&& rm google-chrome-stable_current_amd64.deb && rm google-chrome-stable_current_amd64.deb
# Configure LogRotate
COPY eccs-logrotate.conf /etc/logrotate.d/eccs
RUN chmod 0644 /etc/logrotate.d/eccs
# Configure CRON
COPY eccs_cron /etc/cron.d/eccs
RUN chmod 0644 /etc/cron.d/eccs
# Configure Apache2 for ECCS API
COPY eccs.conf /etc/apache2/conf-available/eccs.conf
RUN ln -s /etc/apache2/conf-available/eccs.conf /etc/apache2/conf-enabled/eccs.conf \
&& ln -s /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf \
&& ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load \
&& ln -s /etc/apache2/mods-available/proxy_uwsgi.load /etc/apache2/mods-enabled/proxy_uwsgi.load
# Configure Supervisor to run Cron, Apache and UWSGI
COPY supervisord.conf /etc/supervisor/supervisord.conf
RUN mkdir -p /var/run/supervisord
COPY start.sh /start.sh
RUN chmod +x /start.sh
USER eccs:eccs USER eccs:eccs
# Get ECCS # Get ECCS
...@@ -48,31 +76,12 @@ COPY --chown=eccs:eccs pyff-config/ pyff-config/ ...@@ -48,31 +76,12 @@ COPY --chown=eccs:eccs pyff-config/ pyff-config/
COPY --chown=eccs:eccs api.py clean7daysOldFiles.sh cleanAndRunEccs.sh eccs.ini eccs.py eccs_properties.py eccs-wsgi.py get-sps-metadata.sh retryFailedChecks.py runEccs.py utils.py ./ COPY --chown=eccs:eccs api.py clean7daysOldFiles.sh cleanAndRunEccs.sh eccs.ini eccs.py eccs_properties.py eccs-wsgi.py get-sps-metadata.sh retryFailedChecks.py runEccs.py utils.py ./
COPY --chown=eccs:eccs input/ input/ COPY --chown=eccs:eccs input/ input/
COPY --chown=eccs:eccs web/ web/ COPY --chown=eccs:eccs web/ web/
RUN mkdir -m 755 output html logs selenium-logs \ RUN mkdir -m 0755 output html logs selenium-logs \
&& chown -R eccs:eccs output html logs selenium-logs && chown -R eccs:eccs output html logs selenium-logs
USER root:root
COPY eccs-logrotate.conf /etc/logrotate.d/eccs
RUN chmod 644 /etc/logrotate.d/eccs
COPY eccs_cron /etc/cron.d/eccs
COPY pyff_cron /etc/cron.d/pyff
# Install ECCS API
COPY eccs.conf /etc/apache2/conf-available/eccs.conf
RUN ln -s /etc/apache2/conf-available/eccs.conf /etc/apache2/conf-enabled/eccs.conf \
&& ln -s /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf \
&& ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load \
&& ln -s /etc/apache2/mods-available/proxy_uwsgi.load /etc/apache2/mods-enabled/proxy_uwsgi.load
EXPOSE 80 EXPOSE 80
EXPOSE 443 EXPOSE 443
#SUPERVISOR USER root:root
COPY supervisord.conf /etc/supervisor/supervisord.conf
RUN mkdir -p /var/run/supervisord
COPY start.sh /start.sh
RUN chmod +x /start.sh
CMD ["/start.sh"] CMD ["/start.sh"]
0 0 * * * /usr/sbin/logrotate /etc/logrotate.d/eccs 0 0 * * * root (echo "[start LogRotate]" && /usr/sbin/logrotate -v /etc/logrotate.d/eccs && echo "[end LogRotate]") > /proc/1/fd/1 2>&1
0 3 * * * /usr/bin/touch /home/eccs/eccs.ini 0 3 * * * eccs /usr/bin/touch /home/eccs/eccs.ini
0 4 * * * /bin/bash /home/eccs/cleanAndRunEccs.sh > /home/eccs/logs/eccs-cron.log 2>&1 0 3 * * * root (echo "[start PyFF]" && /usr/local/bin/pyff --loglevel=DEBUG /home/eccs/pyff-config/sps-metadata.xml && echo "[end PyFF]") > /proc/1/fd/1 2>&1
0 10 * * * /bin/bash /home/eccs/clean7daysOldFiles.sh > /home/eccs/logs/eccs-clean.log 2>&1 0 4 * * * eccs /bin/bash /home/eccs/cleanAndRunEccs.sh > /home/eccs/logs/eccs-cron.log 2>&1
0 10 * * * eccs /bin/bash /home/eccs/clean7daysOldFiles.sh > /proc/1/fd/1 2>&1
...@@ -50,8 +50,8 @@ echo "docker exec -it -u root eccs bash" ...@@ -50,8 +50,8 @@ echo "docker exec -it -u root eccs bash"
echo "" echo ""
echo "Run ECCS manually for today:" echo "Run ECCS manually for today:"
echo "" echo ""
echo "docker exec -it -w /home/eccs eccs ./cleanAndRunEccs.sh > logs/eccs-cron.log 2>&1" echo "docker exec -it -u eccs -w /home/eccs eccs ./cleanAndRunEccs.sh > logs/eccs-cron.log 2>&1"
echo "" echo ""
echo "Delete all results of today" echo "Delete all results of today"
echo "" echo ""
echo "docker exec -it -w /home/eccs/ eccs rm -rf html/$(date +%Y-%m-%d) output/eccs_$(date +%Y-%m-%d).log logs/*_$(date +%Y-%m-%d).log" echo "docker exec -it -u eccs -w /home/eccs/ eccs rm -rf html/$(date +%Y-%m-%d) output/eccs_$(date +%Y-%m-%d).log logs/*_$(date +%Y-%m-%d).log"
...@@ -4,15 +4,14 @@ nodaemon=true ...@@ -4,15 +4,14 @@ nodaemon=true
pidfile=/var/run/supervisord/supervisord.pid pidfile=/var/run/supervisord/supervisord.pid
logfile=/dev/stdout logfile=/dev/stdout
logfile_maxbytes = 0 logfile_maxbytes = 0
loglevel=info loglevel=warn
user=root user=root
[unix_http_server] [unix_http_server]
file=/var/run/supervisor.sock file=/var/run/supervisor.sock
chmod=0777
[supervisorctl] [supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket serverurl=unix:///var/run/supervisor.sock
[rpcinterface:supervisor] [rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
...@@ -46,9 +45,3 @@ stderr_logfile=/dev/stdout ...@@ -46,9 +45,3 @@ stderr_logfile=/dev/stdout
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
autostart=true autostart=true
autorestart=true autorestart=true
#[program:rsyslog]
#command=/usr/sbin/rsyslogd -n
#stdout_logfile=/dev/stdout
#stdout_logfile_maxbytes=0
This diff is collapsed.
...@@ -13,11 +13,11 @@ $lastDate = str_replace($str2strip, "", $lastFile); ...@@ -13,11 +13,11 @@ $lastDate = str_replace($str2strip, "", $lastFile);
$data = array(); $data = array();
$data[ 'firstDate' ] = $firstDate; $data[ 'firstDate' ] = $firstDate;
$data[ 'lastDate' ] = $lastDate; $data[ 'lastDate' ] = $lastDate;
$data[ 'idp' ] = htmlspecialchars($_GET[ "idp" ]); $data[ 'idp' ] = htmlspecialchars($_GET[ "idp" ] ?? null);
$data[ 'reg_auth' ] = htmlspecialchars($_GET[ "reg_auth" ]); $data[ 'reg_auth' ] = htmlspecialchars($_GET[ "reg_auth" ] ?? null);
$data[ 'date' ] = (htmlspecialchars($_GET[ "date" ]) ? htmlspecialchars($_GET[ "date" ]) : $lastDate); $data[ 'date' ] = (htmlspecialchars($_GET[ "date" ] ?? null) ? htmlspecialchars($_GET[ "date" ]) : $lastDate);
$data[ 'status' ] = htmlspecialchars($_GET[ "status" ]); $data[ 'status' ] = htmlspecialchars($_GET[ "status" ] ?? null);
$data[ 'check_result' ] = htmlspecialchars($_GET[ "check_result" ]); $data[ 'check_result' ] = htmlspecialchars($_GET[ "check_result" ] ?? null);
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment