Maj for glpi 10.0.14 and php82

This commit is contained in:
Benoit LORAND 2024-03-28 18:20:48 +01:00
parent c2be36c3b1
commit 7185af5c2d
32 changed files with 270 additions and 7725 deletions

View File

@ -1,3 +1,4 @@
cache/
db/
etc/
files/

View File

@ -1,6 +1,7 @@
Ajouter un fichier mysql_settings.ini qui contient
```
MARIADB_AUTO_UPGRADE=1
MYSQL_DATABASE=
MYSQL_USER=
MYSQL_PASSWORD=''

View File

@ -1,29 +0,0 @@
version: '3.5'
services:
web:
container_name: glpi-web
build: web-builder
restart: always
volumes:
- ./etc/:/etc/glpi/
- ./files/:/var/lib/glpi/
- ./log/:/var/log/glpi/
env_file:
- ./mysql_settings.ini
environment:
- PHP_MEMORY_LIMIT=256M
- PHP_UPLOAD_MAX_FILESIZE=10M
- PHP_POST_MAX_SIZE=20M
- PHP_DATE_TIMEZONE=Europe/Paris
depends_on:
- db
db:
image: mariadb
container_name: glpi-db
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
restart: always
env_file:
- ./mysql_settings.ini
volumes:
- ./db/:/var/lib/mysql/

View File

@ -1,83 +0,0 @@
FROM alpine
MAINTAINER Benoit LORAND <benoit.lorand@blorand.org>
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.5
ENV FUSIONINVENTORY_VERSION=9.5+3.0
ENV FIELDS_VERSION=1.12.4
ENV DATAINJECTION_VERSION=2.9.0
RUN \
apk add --no-cache \
runit \
php7-apache2 \
php7 \
mariadb-client \
php7-pecl-apcu \
php7-mysqli \
php7-gd \
php7-intl \
php7-ldap \
php7-xmlrpc \
php7-xml \
php7-exif \
php7-zip \
php7-bz2 \
php7-opcache \
php7-pear \
php7-curl \
php7-dom \
php7-pdo \
php7-json \
php7-session \
php7-ctype \
php7-fileinfo \
php7-mbstring \
php7-simplexml \
php7-iconv \
php7-sodium \
php7-imap \
php7-pdo \
php7-pdo_mysql \
php7-pspell \
php7-phar \
patch
COPY CAS-1.3.8.tgz /root/
RUN pear install /root/CAS-1.3.8.tgz && \
pear install Archive_Tar
COPY httpd.conf /etc/apache2
COPY service/ /etc/service/
COPY glpi_init.sh /root/glpi_init.sh
COPY glpi.cron /var/spool/cron/crontabs/apache
COPY initrc /etc/
COPY glpi_ticket.class.php.patch /root/glpi_ticket.class.php.patch
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
ADD https://github.com/pluginsGLPI/fields/releases/download/${FIELDS_VERSION}/glpi-fields-${FIELDS_VERSION}.tar.bz2 /root/glpi-fields-${FIELDS_VERSION}.tar.bz2
ADD https://github.com/pluginsGLPI/datainjection/releases/download/${DATAINJECTION_VERSION}/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2 /root/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2
RUN \
mkdir -p /root/glpi_template/etc /root/glpi_template/files && \
tar x -f /root/glpi-${GLPI_VERSION}.tgz && \
cp -r /root/glpi/config/. /root/glpi_template/etc/. && \
cp -r /root/glpi/files/. /root/glpi_template/files/. && \
rm -r /root/glpi/config /root/glpi/files && \
mv /root/glpi /var/www/glpi && \
cd /var/www/glpi && \
patch -Np0 -i /root/glpi_ticket.class.php.patch && \
cd /var/www/glpi/plugins && \
tar x -f /root/fusioninventory-${FUSIONINVENTORY_VERSION}.tar.bz2 && \
cd /var/www/glpi/marketplace && \
tar x -f /root/glpi-fields-${FIELDS_VERSION}.tar.bz2 && \
tar x -f /root/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2 && \
chmod a+x /root/glpi_init.sh /etc/initrc && \
chmod 600 /etc/crontabs/apache && \
rm -f /var/www/html/* /root/CAS-1.3.8.tgz /root/glpi-${GLPI_VERSION}.tgz /root/fusioninventory-${FUSIONINVENTORY_VERSION}.tar.bz2 /root/glpi-fields-${FIELDS_VERSION}.tar.bz2 /root/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2 && \
rm -f /root/glpi_ticket.class.php.patch && \
rm -rf /tmp/* /var/tmp/*
ENTRYPOINT ["/etc/initrc"]

View File

@ -1,6 +0,0 @@
GLPI_CONFIG_DIR=/etc/glpi
GLPI_VAR_DIR=/var/lib/glpi
GLPI_LOG_DIR=/var/log/glpi
*/1 * * * * /usr/bin/php7 /var/www/glpi/front/cron.php
0 * * * * cd /var/www/glpi && php bin/console glpi:ldap:synchronize_users -n

View File

@ -1,19 +0,0 @@
--- inc/ticket.class.php.old 2020-07-16 14:26:59.000000000 +0200
+++ inc/ticket.class.php 2020-09-11 18:09:43.200657894 +0200
@@ -3806,7 +3806,7 @@
}
}
- if (empty($delegating)
+/** if (empty($delegating)
&& NotificationTargetTicket::isAuthorMailingActivatedForHelpdesk()) {
echo "<tr class='tab_bg_1'>";
echo "<td>".__('Inform me about the actions taken')."</td>";
@@ -3821,6 +3821,7 @@
echo "</td></tr>";
}
+*/
if (($_SESSION["glpiactiveprofile"]["helpdesk_hardware"] != 0)
&& (count($_SESSION["glpiactiveprofile"]["helpdesk_item_type"]))) {
if (!$tt->isHiddenField('items_id')) {

View File

@ -1,6 +0,0 @@
#!/bin/sh
set -e
rm -r /run/*
mkdir -p /run/apache2
exec /sbin/runsvdir -P /etc/service

View File

@ -1,5 +0,0 @@
#!/bin/sh
. /etc/service/template
msglog green "Starting Apache..."
exec /usr/sbin/httpd -D FOREGROUND

View File

@ -1,6 +0,0 @@
#!/bin/sh
. /etc/service/template
msglog green "Starting glpi_init.sh..."
/root/glpi_init.sh
sleep infinity

File diff suppressed because it is too large Load Diff

BIN
debian/CAS-1.3.8.tgz vendored

Binary file not shown.

50
debian/Dockerfile vendored
View File

@ -1,50 +0,0 @@
FROM php:7.4-apache-buster
MAINTAINER Benoit LORAND <benoit.lorand@blorand.org>
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 \
runit \
cron \
libbz2-dev \
libzip-dev \
libxml2-dev \
libldap2-dev \
libicu-dev \
libpng-dev \
zlib1g-dev \
default-mysql-client \
&& \
pecl install apcu && docker-php-ext-enable apcu && \
docker-php-ext-configure mysqli && docker-php-ext-install mysqli && \
docker-php-ext-configure gd && docker-php-ext-install gd && \
docker-php-ext-configure intl && docker-php-ext-install intl && \
docker-php-ext-configure ldap && docker-php-ext-install ldap && \
docker-php-ext-configure xmlrpc && docker-php-ext-install xmlrpc && \
docker-php-ext-configure exif && docker-php-ext-install exif && \
docker-php-ext-configure zip && docker-php-ext-install zip && \
docker-php-ext-configure bz2 && docker-php-ext-install bz2 && \
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 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/${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 && \
rm -f /var/www/html/* /root/CAS-1.3.8.tgz && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENTRYPOINT ["/usr/bin/runsvdir", "-P", "/etc/service"]

0
debian/README.md vendored
View File

View File

@ -1,26 +0,0 @@
version: '3.5'
services:
web:
container_name: glpi-web
build: .
restart: always
ports:
- 8089:80
volumes:
- ./etc/:/etc/glpi/
- ./files/:/var/lib/glpi/
- ./log/:/var/log/glpi/
env_file:
- ./mysql_settings.ini
depends_on:
- db
db:
image: mariadb
container_name: glpi-db
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
restart: always
env_file:
- ./mysql_settings.ini
volumes:
- ./db/:/var/lib/mysql/

5
debian/glpi.cron vendored
View File

@ -1,5 +0,0 @@
GLPI_CONFIG_DIR=/etc/glpi
GLPI_VAR_DIR=/var/lib/glpi
GLPI_LOG_DIR=/var/log/glpi
*/1 * * * * www-data /usr/local/bin/php /var/www/html/front/cron.php

79
debian/glpi_init.sh vendored
View File

@ -1,79 +0,0 @@
#!/bin/sh
GLPI_TARBALL="/root/glpi-9.5.1.tgz"
FUSION_TARBALL="/root/fusioninventory-9.5.0+1.0.tar.bz2"
NORMAL='\e[39m'
RED='\e[31m'
GREEN='\e[32m'
msglog() {
case "${1}" in
green)
TEXT_COLOR="${GREEN}"
;;
red)
TEXT_COLOR="${RED}"
;;
normal)
TEXT_COLOR="${NORMAL}"
;;
esac
DATE=$(date '+%Y %b %d %H:%M:%S')
echo ${DATE} ${TEXT_COLOR}${2}${NORMAL}
}
waiting_for_db() {
while ! mysqlshow -h db -uroot -p${MYSQL_ROOT_PASSWORD} 2>&1 | grep "^| ${MYSQL_DATABASE}" > /dev/null 2>&1 ; do
msglog red "Waiting for mysql database initilization..."
sleep 5
done
}
if [ -z "$(ls -A /var/www/html)" ] ; then
waiting_for_db
msglog red "Initialazing ${GLPI_TARBALL}..."
cd /root
tar xf ${GLPI_TARBALL}
cp -r /root/glpi/config/. /etc/glpi/.
cp -r /root/glpi/files/. /var/lib/glpi/.
rm -r /root/glpi/config /root/glpi/files
cp -r /root/glpi/. /var/www/html/.
cd /var/www/html/plugins
tar xf ${FUSION_TARBALL}
rm -r /root/glpi
mysql --host=db --user=root --password=${MYSQL_ROOT_PASSWORD} << EOF
use mysql;
GRANT SELECT ON time_zone_name TO '${MYSQL_USER}'@'%';
EOF
cd /var/www/html
php bin/console db:install --config-dir=${GLPI_CONFIG_DIR} -L fr_FR -H db -d ${MYSQL_DATABASE} -u ${MYSQL_USER} -p ${MYSQL_PASSWORD} -n
php bin/console glpi:plugin:install -u glpi fusioninventory -n
php bin/console glpi:plugin:activate fusioninventory -n
rm install/install.php
chown -R www-data:www-data /var/www/html /etc/glpi /var/lib/glpi /var/log/glpi
msglog green "Initialazing complete..."
else
msglog green "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
msglog green "GLPI already up2date"
exit
fi
msglog red "Updating GLPI from ${GLPI_ACTUAL_VERSION} to ${GLPI_VERSION}"
waiting_for_db
php bin/console glpi:maintenance:enable -n
php bin/console glpi:plugin:deactivate fusioninventory -n
cd /root
tar xf ${GLPI_TARBALL}
rm -r glpi/config glpi/files /var/www/html
mv glpi /var/www/html
cd /var/www/html/plugins
tar xf ${FUSION_TARBALL}
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

View File

@ -1,4 +0,0 @@
MYSQL_DATABASE=
MYSQL_USER=
MYSQL_PASSWORD=''
MYSQL_ROOT_PASSWORD=''

View File

@ -1,7 +0,0 @@
#!/bin/sh
. /etc/service/template
msglog green "Starting Cron..."
# 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

View File

@ -1,5 +0,0 @@
#!/bin/sh
. /etc/service/template
msglog green "Starting Apache..."
exec apache2-foreground

View File

@ -1,6 +0,0 @@
#!/bin/sh
. /etc/service/template
msglog green "Starting glpi_init.sh..."
/root/glpi_init.sh
sleep infinity

View File

@ -1,19 +0,0 @@
NORMAL='\e[39m'
RED='\e[31m'
GREEN='\e[32m'
msglog() {
case "${1}" in
green)
TEXT_COLOR="${GREEN}"
;;
red)
TEXT_COLOR="${RED}"
;;
normal)
TEXT_COLOR="${NORMAL}"
;;
esac
DATE=$(date '+%Y %b %d %H:%M:%S')
echo ${DATE} ${TEXT_COLOR}${2}${NORMAL}
}

64
docker-compose.yml Normal file
View File

@ -0,0 +1,64 @@
version: '3.5'
services:
web:
container_name: glpi-web
build: web-builder
restart: always
volumes:
- ./etc/:/etc/glpi/
- ./files/:/var/lib/glpi/
- ./log/:/var/log/glpi/
- /etc/localtime:/etc/localtime:ro
env_file:
- ./mysql_settings.ini
environment:
- PHP_MEMORY_LIMIT=256M
- PHP_UPLOAD_MAX_FILESIZE=20M
- PHP_POST_MAX_SIZE=40M
- PHP_SESSION_GC_MAXLIFETIME=14400
- PHP_DATE_TIMEZONE=Europe/Paris
- PHP_MAX_INPUT_VARS=100000
depends_on:
- db
- redis
cron:
container_name: glpi-cron
image : glpi-web:latest
restart: always
volumes:
- ./etc/:/etc/glpi/
- ./files/:/var/lib/glpi/
- ./log/:/var/log/glpi/
- /etc/localtime:/etc/localtime:ro
env_file:
- ./mysql_settings.ini
environment:
- PHP_MEMORY_LIMIT=256M
- PHP_UPLOAD_MAX_FILESIZE=20M
- PHP_POST_MAX_SIZE=40M
- PHP_SESSION_GC_MAXLIFETIME=14400
- PHP_DATE_TIMEZONE=Europe/Paris
entrypoint: /etc/service/cron
depends_on:
- db
- web
db:
image: mariadb
container_name: glpi-db
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
restart: always
env_file:
- ./mysql_settings.ini
volumes:
- ./db/:/var/lib/mysql/
- /etc/localtime:/etc/localtime:ro
redis:
container_name: glpi-redis
image: redis:latest
volumes:
- ./cache:/data
restart: "always"

81
web-builder/Dockerfile Normal file
View File

@ -0,0 +1,81 @@
FROM alpine
MAINTAINER Benoit LORAND <benoit.lorand@blorand.org>
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=10.0.14
ENV FIELDS_VERSION=1.21.8
ENV DATAINJECTION_VERSION=2.13.5
ENV GLPIINVENTORY_VERSION=1.3.5
RUN \
apk add --no-cache \
php82-apache2 \
php82 \
mariadb-client \
php82-pecl-apcu \
php82-pecl-redis \
php82-mysqli \
php82-gd \
php82-intl \
php82-ldap \
php82-xml \
php82-xmlreader \
php82-xmlwriter \
php82-exif \
php82-zip \
php82-bz2 \
php82-opcache \
php82-pear \
php82-curl \
php82-dom \
php82-pdo \
php82-json \
php82-session \
php82-ctype \
php82-fileinfo \
php82-mbstring \
php82-simplexml \
php82-iconv \
php82-sodium \
php82-imap \
php82-pdo \
php82-pdo_mysql \
php82-pspell \
php82-phar \
patch
COPY CAS-1.3.8.tgz /root/
RUN pear82 install /root/CAS-1.3.8.tgz && \
pear82 install Archive_Tar
COPY httpd.conf /etc/apache2
COPY remoteip.conf /etc/apache2/conf.d
COPY service/ /etc/service/
COPY glpi.cron /var/spool/cron/crontabs/apache
ADD https://github.com/glpi-project/glpi/releases/download/${GLPI_VERSION}/glpi-${GLPI_VERSION}.tgz /root/glpi-${GLPI_VERSION}.tgz
ADD https://github.com/pluginsGLPI/fields/releases/download/${FIELDS_VERSION}/glpi-fields-${FIELDS_VERSION}.tar.bz2 /root/glpi-fields-${FIELDS_VERSION}.tar.bz2
ADD https://github.com/pluginsGLPI/datainjection/releases/download/${DATAINJECTION_VERSION}/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2 /root/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2
ADD https://github.com/glpi-project/glpi-inventory-plugin/releases/download/${GLPIINVENTORY_VERSION}/glpi-glpiinventory-${GLPIINVENTORY_VERSION}.tar.bz2 /root/glpi-glpiinventory-${GLPIINVENTORY_VERSION}.tar.bz2
RUN \
mkdir -p /root/glpi_template/etc /root/glpi_template/files && \
tar -x -f /root/glpi-${GLPI_VERSION}.tgz && \
cp -r /root/glpi/config/. /root/glpi_template/etc/. && \
cp -r /root/glpi/files/. /root/glpi_template/files/. && \
rm -r /root/glpi/config /root/glpi/files && \
mv /root/glpi /var/www/glpi && \
cd /var/www/glpi/marketplace && \
tar x -f /root/glpi-fields-${FIELDS_VERSION}.tar.bz2 && \
tar x -f /root/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2 && \
tar x -f /root/glpi-glpiinventory-${GLPIINVENTORY_VERSION}.tar.bz2 && \
chmod 600 /etc/crontabs/apache && \
rm -f /var/www/html/* /root/CAS-1.3.8.tgz /root/glpi-${GLPI_VERSION}.tgz /root/glpi-fields-${FIELDS_VERSION}.tar.bz2 /root/glpi-datainjection-${DATAINJECTION_VERSION}.tar.bz2 /root/glpi-glpiinventory-${GLPIINVENTORY_VERSION}.tar.bz2 && \
rm -rf /tmp/* /var/tmp/*
COPY logo.png /var/www/glpi/pics/logo.png
WORKDIR /var/www/glpi
ENTRYPOINT ["/etc/service/glpi"]

6
web-builder/glpi.cron Normal file
View File

@ -0,0 +1,6 @@
GLPI_CONFIG_DIR=/etc/glpi
GLPI_VAR_DIR=/var/lib/glpi
GLPI_LOG_DIR=/var/log/glpi
*/1 * * * * /usr/bin/php82 /var/www/glpi/front/cron.php
0 * * * * cd /var/www/glpi && /usr/bin/php82 bin/console glpi:ldap:synchronize_users -n

View File

@ -0,0 +1,27 @@
--- ticket.class.php.orig 2022-04-12 12:24:25.634142162 +0200
+++ ticket.class.php 2022-04-12 12:21:31.000000000 +0200
@@ -3740,6 +3740,7 @@
Plugin::doHook("pre_item_form", ['item' => $this, 'options' => &$options]);
+ echo "<tr><th colspan=2 align=center><p style='color:#ff0000;font-size:300%;'>".__('Support Informatique')."</p></th>";
echo "<tr><th>".__('Describe the incident or request')."</th><th>";
if (Session::isMultiEntitiesMode()) {
echo "(".Dropdown::getDropdownName("glpi_entities", $_SESSION["glpiactive_entity"]).")";
@@ -3789,7 +3790,7 @@
}
}
- if (empty($delegating)
+/** if (empty($delegating)
&& NotificationTargetTicket::isAuthorMailingActivatedForHelpdesk()) {
echo "<tr class='tab_bg_1'>";
echo "<td>".__('Inform me about the actions taken')."</td>";
@@ -3804,6 +3805,7 @@
echo "</td></tr>";
}
+*/
if (($_SESSION["glpiactiveprofile"]["helpdesk_hardware"] != 0)
&& (count($_SESSION["glpiactiveprofile"]["helpdesk_item_type"]))) {
if (!$tt->isHiddenField('items_id')) {

View File

@ -26,7 +26,7 @@
# Set to one of: Full | OS | Minor | Minimal | Major | Prod
# where Full conveys the most information, and Prod the least.
#
ServerTokens OS
ServerTokens Prod
#
# ServerRoot: The top of the directory tree under which the server's
@ -133,7 +133,7 @@ LoadModule headers_module modules/mod_headers.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
#LoadModule remoteip_module modules/mod_remoteip.so
LoadModule remoteip_module modules/mod_remoteip.so
#LoadModule session_module modules/mod_session.so
#LoadModule session_cookie_module modules/mod_session_cookie.so
#LoadModule session_crypto_module modules/mod_session_crypto.so
@ -163,7 +163,7 @@ LoadModule dir_module modules/mod_dir.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule negotiation_module modules/mod_negotiation.so
@ -241,8 +241,8 @@ ServerSignature On
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/glpi"
<Directory "/var/www/glpi">
DocumentRoot "/var/www/glpi/public"
<Directory "/var/www/glpi/public">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
@ -268,6 +268,11 @@ DocumentRoot "/var/www/glpi"
# Controls who can get stuff from this server.
#
Require all granted
RewriteEngine On
# Redirect all requests to GLPI router, unless file exists.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</Directory>
#

10
web-builder/remoteip.conf Normal file
View File

@ -0,0 +1,10 @@
<IfModule remoteip_module>
RemoteIPHeader X-Forwarded-For
RemoteIPProxiesHeader X-Forwarded-By
RemoteIPInternalProxy 172.23.0.0/24
</IfModule>
<IfModule log_config_module>
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"X-Forwarded-For: %{X-Forwarded-For}i\" \"X-Forwarded-By: %{X-Forwarded-By}i\"" combined_fwd
CustomLog /proc/self/fd/1 combined_fwd
</IfModule>

View File

@ -2,6 +2,9 @@
. /etc/service/template
msglog green "Starting Cron..."
/etc/service/php
# Touch cron files to fix 'NUMBER OF HARD LINKS > 1' issue. See https://github.com/phusion/baseimage-docker/issues/198
chown -R apache:apache /var/www/glpi /etc/glpi /var/lib/glpi /var/log/glpi
touch -c /etc/crontab /etc/cron.*/* /var/spool/cron/crontabs/*
exec /usr/sbin/crond -f -L /dev/stdout

View File

@ -26,25 +26,15 @@ while ! mysqlshow -h db -uroot -p${MYSQL_ROOT_PASSWORD} 2>&1 | grep "^| ${MYSQL_
done
}
updatephpini() {
variable=$1
value=$2
file="/etc/php7/php.ini"
start_apache() {
rm -r /run/*
mkdir -p /run/apache2
if [ ! -z "${value}" ] ; then
msglog green "Updating $variable to $value in $file"
if grep "^${variable}" "${file}" > /dev/null 2<&1 ; then
sed -i "s@^\(${variable}\s*=\).*@\1 ${value}@g" "${file}"
else
echo ${variable} = ${value} >> ${file}
fi
fi
msglog green "Starting Apache..."
exec /usr/sbin/httpd -D FOREGROUND
}
updatephpini memory_limit ${PHP_MEMORY_LIMIT}
updatephpini upload_max_filesize ${PHP_UPLOAD_MAX_FILESIZE}
updatephpini post_max_size ${PHP_POST_MAX_SIZE}
updatephpini date.timezone ${PHP_DATE_TIMEZONE}
/etc/service/php
mkdir -p /var/www/glpi
if [ ! -e "/etc/glpi/config_db.php" ] ; then
@ -58,38 +48,38 @@ use mysql;
GRANT SELECT ON time_zone_name TO '${MYSQL_USER}'@'%';
EOF
cd /var/www/glpi
php bin/console db:install --config-dir=${GLPI_CONFIG_DIR} -L fr_FR -H db -d ${MYSQL_DATABASE} -u ${MYSQL_USER} -p ${MYSQL_PASSWORD} -n
php bin/console glpi:plugin:install -u glpi fusioninventory -n
php bin/console glpi:plugin:activate fusioninventory -n
php82 bin/console db:install --config-dir=${GLPI_CONFIG_DIR} -L fr_FR -H db -d ${MYSQL_DATABASE} -u ${MYSQL_USER} -p ${MYSQL_PASSWORD} -n
rm install/install.php
chown -R apache:apache /var/www/glpi /etc/glpi /var/lib/glpi /var/log/glpi
patch -Np0 -i /root/glpi_ticket.class.php.patch
echo "${GLPI_VERSION}" > /etc/glpi/glpi_actual_version
echo "${FUSIONINVENTORY_VERSION}" > /etc/glpi/fusioninventory_actual_version
echo "${FIELDS_VERSION}" > /etc/glpi/fields_actual_version
echo "${DATAINJECTION_VERSION}" > /etc/glpi/datainjection_version
echo "${DATAINJECTION_VERSION}" > /etc/glpi/datainjection_actual_version
echo "${GLPIINVENTORY_VERSION}" > /etc/glpi/glpiinventory_actual_version
msglog green "Initialazing complete..."
else
msglog green "GLPI is already initialized"
GLPI_ACTUAL_VERSION=$(cat /etc/glpi/glpi_actual_version)
FUSIONINVENTORY_ACTUAL_VERSION=$(cat /etc/glpi/fusioninventory_actual_version)
FIELDS_ACTUAL_VERSION=$(cat /etc/glpi/fields_actual_version)
DATAINJECTION_ACTUAL_VERSION=$(cat /etc/glpi/datainjection_version)
if [ "${GLPI_ACTUAL_VERSION}" = "${GLPI_VERSION}" -a "${FUSIONINVENTORY_ACTUAL_VERSION}" = "${FUSIONINVENTORY_VERSION}" -a "${FIELDS_ACTUAL_VERSION}" = "${FIELDS_VERSION}" -a "${DATAINJECTION_ACTUAL_VERSION}" = "${DATAINJECTION_VERSION}" ] ; then
GLPI_ACTUAL_VERSION=$(test -e /etc/glpi/glpi_actual_version && cat /etc/glpi/glpi_actual_version)
FIELDS_ACTUAL_VERSION=$(test -e /etc/glpi/fields_actual_version && cat /etc/glpi/fields_actual_version)
DATAINJECTION_ACTUAL_VERSION=$(test -e /etc/glpi/datainjection_actual_version && cat /etc/glpi/datainjection_actual_version)
GLPIINVENTORY_ACTUAL_VERSION=$(test -e /etc/glpi/glpiinventory_actual_version && cat /etc/glpi/glpiinventory_actual_version)
if [ "${GLPI_ACTUAL_VERSION}" = "${GLPI_VERSION}" -a "${FIELDS_ACTUAL_VERSION}" = "${FIELDS_VERSION}" -a "${DATAINJECTION_ACTUAL_VERSION}" = "${DATAINJECTION_VERSION}" -a "${GLPIINVENTORY_ACTUAL_VERSION}" = "${GLPIINVENTORY_VERSION}" ] ; then
chown -R apache:apache /var/www/glpi /etc/glpi /var/lib/glpi /var/log/glpi
[ -e "/var/www/glpi/install/install.php" ] && rm /var/www/glpi/install/install.php
msglog green "GLPI already up2date"
exit
start_apache
fi
msglog red "Updating GLPI from ${GLPI_ACTUAL_VERSION} to ${GLPI_VERSION}"
waiting_for_db
cd /var/www/glpi
php bin/console glpi:maintenance:enable -n
php bin/console glpi:plugin:deactivate --all -n
php82 bin/console glpi:maintenance:enable -n
php82 bin/console glpi:plugin:deactivate --all # -n
rm /var/www/glpi/install/install.php
php bin/console db:update --config-dir=${GLPI_CONFIG_DIR} -n && \
php82 bin/console db:update --config-dir=${GLPI_CONFIG_DIR} -n && \
( echo "${GLPI_VERSION}" > /etc/glpi/glpi_actual_version ; \
echo "${FUSIONINVENTORY_VERSION}" > /etc/glpi/fusioninventory_actual_version ; \
echo "${FIELDS_VERSION}" > /etc/glpi/fields_actual_version ; \
echo "${DATAINJECTION_VERSION}" > /etc/glpi/datainjection_actual_version )
php bin/console glpi:maintenance:disable -n
echo "${DATAINJECTION_VERSION}" > /etc/glpi/datainjection_actual_version ; \
echo "${GLPIINVENTORY_VERSION}" > /etc/glpi/glpiinventory_actual_version )
php82 bin/console glpi:maintenance:disable -n
chown -R apache:apache /var/www/glpi /etc/glpi /var/lib/glpi /var/log/glpi
fi
start_apache

43
web-builder/service/php Normal file
View File

@ -0,0 +1,43 @@
#!/bin/sh
NORMAL=''
RED=''
GREEN=''
msglog() {
case "${1}" in
green)
TEXT_COLOR="${GREEN}"
;;
red)
TEXT_COLOR="${RED}"
;;
normal)
TEXT_COLOR="${NORMAL}"
;;
esac
DATE=$(date '+%Y %b %d %H:%M:%S')
echo ${DATE} ${TEXT_COLOR}${2}${NORMAL}
}
updatephpini() {
variable=$1
value=$2
file="/etc/php82/php.ini"
if [ ! -z "${value}" ] ; then
msglog green "Updating $variable to $value in $file"
if grep "^${variable}" "${file}" > /dev/null 2<&1 ; then
sed -i "s@^\(${variable}\s*=\).*@\1 ${value}@g" "${file}"
else
echo ${variable} = ${value} >> ${file}
fi
fi
}
updatephpini memory_limit ${PHP_MEMORY_LIMIT}
updatephpini upload_max_filesize ${PHP_UPLOAD_MAX_FILESIZE}
updatephpini post_max_size ${PHP_POST_MAX_SIZE}
updatephpini date.timezone ${PHP_DATE_TIMEZONE}
updatephpini max_input_vars ${PHP_MAX_INPUT_VARS}
updatephpini session.cookie_httponly 1
updatephpini session.gc_maxlifetime ${PHP_SESSION_GC_MAXLIFETIME}