Correction de bug dans glpi_init.sh

Remplacement de supervisor par runit
Correction de cron qui ne semble pas s'exécuter normalement
This commit is contained in:
root 2020-08-06 10:03:42 +02:00
parent 9cda96d277
commit 815cc5ed55
10 changed files with 51 additions and 20 deletions

View File

@ -5,11 +5,13 @@ WORKDIR /root
ENV GLPI_CONFIG_DIR=/etc/glpi
ENV GLPI_VAR_DIR=/var/lib/glpi
ENV GLPI_LOG_DIR=/var/log/glpi
ENV GLPI_VERSION=9.5.1
ENV FUSIONINVENTORY_VERSION=9.5.0+1.0
RUN \
apt-get update && \
apt-get install --no-install-recommends -y \
supervisor \
runit \
cron \
libbz2-dev \
libzip-dev \
@ -33,14 +35,12 @@ docker-php-ext-configure opcache && docker-php-ext-install opcache
COPY CAS-1.3.8.tgz /root/
RUN pear install /root/CAS-1.3.8.tgz
COPY supervisor/supervisord.conf /etc/supervisor/
COPY supervisor/conf.d/apache2.conf /etc/supervisor/conf.d/
COPY supervisor/conf.d/cron.conf /etc/supervisor/conf.d/
COPY supervisor/conf.d/glpi_init.conf /etc/supervisor/conf.d/
#COPY supervisor/ /etc/supervisor/
COPY service/ /etc/service/
COPY glpi_init.sh /root/glpi_init.sh
COPY glpi.cron /etc/cron.d/glpi
ADD https://github.com/glpi-project/glpi/releases/download/9.5.1/glpi-9.5.1.tgz /root/glpi-9.5.1.tgz
ADD https://github.com/fusioninventory/fusioninventory-for-glpi/releases/download/glpi9.5.0%2B1.0/fusioninventory-9.5.0+1.0.tar.bz2 /root/fusioninventory-9.5.0+1.0.tar.bz2
ADD https://github.com/glpi-project/glpi/releases/download/${GLPI_VERSION}/glpi-${GLPI_VERSION}.tgz /root/glpi-${GLPI_VERSION}.tgz
ADD https://github.com/fusioninventory/fusioninventory-for-glpi/releases/download/glpi${FUSIONINVENTORY_VERSION}/fusioninventory-${FUSIONINVENTORY_VERSION}.tar.bz2 /root/fusioninventory-${FUSIONINVENTORY_VERSION}.tar.bz2
RUN \
chmod a+x /root/glpi_init.sh && \
@ -48,5 +48,5 @@ rm -f /var/www/html/* /root/CAS-1.3.8.tgz && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENTRYPOINT ["supervisord", "--nodaemon", "--configuration", "/etc/supervisor/supervisord.conf"]
#ENTRYPOINT ["supervisord", "--nodaemon", "--configuration", "/etc/supervisor/supervisord.conf"]
ENTRYPOINT ["/usr/bin/runsvdir", "-P", "/etc/service"]

View File

@ -1 +1 @@
* * * * * www-data /usr/local/bin/php /var/www/html/front/cron.php &>/dev/null
*/1 * * * * www-data /usr/local/bin/php /var/www/html/front/cron.php

View File

@ -12,6 +12,7 @@ echo "Starting glpi configuration..."
}
if [ -z $(ls -A /var/www/html) ] ; then
init_db
echo "Initilazing ${GLPI_TARBALL}"
cd /root
tar xf ${GLPI_TARBALL}
@ -35,6 +36,14 @@ EOF
else
echo "GLPI is already initialized"
cd /var/www/html
GLPI_ACTUAL_VERSION=$(awk -F", '" '/^define\(.GLPI_VERSION/ { print $2 }' inc/define.php | sed 's/\([0-9\.]*\).*/\1/')
FUSIONINVENTORY_ACTUAL_VERSION=$(awk -F', "' '/^define \(.PLUGIN_FUSIONINVENTORY_VERSION/ { print $2 }' plugins/fusioninventory/setup.php | sed 's/\([0-9\.+]*\).*/\1/')
if [ "${GLPI_ACTUAL_VERSION}" = "${GLPI_VERSION}" -a "${FUSIONINVENTORY_ACTUAL_VERSION}" = "${FUSIONINVENTORY_VERSION}" ] ; then
echo GLPI already up2date
exit
fi
init_db
php bin/console glpi:maintenance:enable -n
php bin/console glpi:plugin:deactivate fusioninventory -n
cd /root
tar xf ${GLPI_TARBALL}
@ -45,5 +54,6 @@ else
rm /var/www/html/install/install.php
cd /var/www/html
php bin/console db:update --config-dir=${GLPI_CONFIG_DIR} -n
php bin/console glpi:maintenance:disable -n
chown -R www-data:www-data /var/www/html /etc/glpi /var/lib/glpi /var/log/glpi
fi

2
service/apache2/run Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exec apache2-foreground

6
service/cron/run Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# Touch cron files to fix 'NUMBER OF HARD LINKS > 1' issue. See https://github.com/phusion/baseimage-docker/issues/198
touch -c /etc/crontab /etc/cron.*/* /var/spool/cron/crontabs/*
exec /usr/sbin/cron -f

3
service/glpi_init/run Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
/root/glpi_init.sh
sleep infinity

View File

@ -1,4 +1,7 @@
[program:apache2]
command=apache2-foreground
autostart=true
autorestart=true
command = apache2-foreground
autostart = true
autorestart = true
redirect_stderr = true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,4 +1,7 @@
[program:cron]
command=cron -f -L 15
autostart=true
autorestart=true
command = cron -f
autostart = true
autorestart = true
redirect_stderr = true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,5 +1,8 @@
[program:glpi_init]
command=/root/glpi_init.sh
command = /root/glpi_init.sh
startsecs = 0
autorestart = false
startretries = 1
redirect_stderr = true
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes = 0

View File

@ -1,9 +1,10 @@
; supervisor config file
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
logfile = /var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
user = root
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or