Sign inSign up

wolvverine/docker-glpi

By wolvverine

Updated about 1 month ago

GLPI docker container

Image
Monitoring & observability
0

4.6K

wolvverine/docker-glpi repository overview

Docker GLPI

Build Status

This images contains an instance of GLPI web application served by nginx and php5-fpm on port 80

:warning: Take care of the changelogs because some breaking changes may happen between versions.

  • nginx and PHP7.2 embedded Dockerfile

    • nginx-72-9.5.5-latest, nginx-72-latest
    • nginx-72-9.5.4-latest, nginx-72-latest

Docker Informations

  • This image expose the following ports
PortUsage
80/tcpHTTP web application

see https part to known about ssl

  • This image takes theses environnements variables as parameters
EnvironmentTypeUsage
TZStringContains the timezone
GLPI_REMOVE_INSTALLERBoolean (yes/no)Set to yes if it's not the first installation of glpi
GLPI_CHMOD_PATHS_FILESBoolean (yes/no)Set to yes to apply chmod/chown on /var/www/files (useful for host mount)
GLPI_INSTALL_PLUGINSStringComma separated list of plugins to install (see below)
PHP_MEMORY_LIMITStringsee PHP memory_limit configuration
PHPFPM_PMStringsee PHPFPM pm configuration
PHPFPM_PM_MAX_CHILDRENIntegersee PHPFPM pm.max_children configuration
PHPFPM_PM_START_SERVERSIntegersee PHPFPM pm.start_servers configuration
PHPFPM_PM_MIN_SPARE_SERVERSIntegersee PHPFPM pm.min_spare_servers configuration
PHPFPM_PM_MAX_SPARE_SERVERSIntegersee PHPFPM pm.max_spare_servers configuration
PHPFPM_PM_PROCESS_IDLE_TIMEOUTMixedsee PHPFPM pm.process_idle_timeout configuration
PHPFPM_PM_MAX_REQUESTIntegersee PHPFPM pm.max_request configuration

The GLPI_INSTALL_PLUGINS variable must contains the list of plugins to install (download and extract) before starting glpi. This environment variable is a comma separated list of plugins definitions. Each plugin definition must be like this "PLUGINNAME|URL". The PLUGINNAME is the name of the first folder in plugin archive and will be the glpi's name of the plugin. The URL is the full URL from which to download the plugin. This url can contains some compressed file extensions, in some case the installer script will not be able to extract it, so you can create an issue with specifying the unhandled file extension. These two items are separated by a pipe symbol.

To summarize, the GLPI_INSTALL_PLUGINS variable must follow the following skeleton GLPI_INSTALL_PLUGINS="name1|url1,name2|url2" For better example see at the end of this file.

  • The following volumes are exposed by this image
VolumeUsage
/var/www/filesThe data path of GLPI
/var/www/configThe configuration path of GLPI

Application Informations

HTTPS - SSL encryption

There are many different possibilities to introduce encryption depending on your setup.

As most of available docker image on the internet, I recommend using a reverse proxy in front of this image. This prevent me to introduce all ssl configurations parameters and also to prevent a limitation of the available parameters.

For example, you can use the popular nginx-proxy and docker-letsencrypt-nginx-proxy-companion containers or Traefik to handle this.

GLPI Cronjob

GLPI require a job to be run periodically. Starting from 3.0.0 release, this image does not provide any solution to handle this. I've choose to remove cron task from this image to respect docker convention and to prevent a clustered deploiement to run the cron on all cluster instances.

As compensation I provide a wrapper script that wrap the batch execution and return a json object with job execution details at /opt/scripts/cronwrapper.py

To ensure correct GLPI running please put this job in your common cron scheduler. On linux you can use the /etc/crontab file with a content similar to this one :

*/15 * * * * root docker ps | grep --quiet 'glpi' && docker exec --user www-data glpi /opt/scripts/cronwrapper.py --forward-stderr
Timezone issues

Timezone is handled at PHP level in the image since 2.4.2 version, but you might encounter issues if you use different timezone in your database engine. Please refer to the GLPI documentations to handle this at database level https://glpi-install.readthedocs.io/en/develop/timezones.html.

Todo

Installation

docker pull wolvverine/docker-glpi:nginx-72-latest

Usage

The first time you run this image, set the GLPI_REMOVE_INSTALLER variable to 'no', then after this first installation set it to 'yes' to remove the installer.

docker run --name glpi --publish 8000:80 --volume data-glpi:/var/www/files --volume data-glpi-config:/var/www/config wolvverine/docker-glpi:nginx-56-latest
Create dedicated network
docker network create glpi-network
Start a MySQL instance
docker run --name mysql -d --net glpi-network -e MYSQL_DATABASE=glpi -e MYSQL_USER=glpi -e MYSQL_PASSWORD=glpi -e MYSQL_ROOT_PASSWORD=root_password mysql
Start a GLPI instance
docker run --name glpi --publish 8000:80 --volume data-glpi:/var/www/files --volume data-glpi-config:/var/www/config --net glpi-network wolvverine/docker-glpi:nginx-56-latest
Cron task on Docker host
*/5 * * * * root docker ps | grep --quiet 'glpi' && docker exec --user www-data glpi python3 /usr/local/bin/cronwrapper.py  --forward-stderr
* */3 * * * root docker ps | grep --quiet 'glpi' && docker exec --user www-data glpi /var/www/bin/console -n glpi:ldap:synchronize_users --only-update-existing
Docker-compose Specific configuration examples
  • Production configuration with already installed GLPI with FusionInventory and dashboard plugin :
version: '2.1'
services:

  glpi:
    image: wolvverine/docker-glpi:nginx-72-latest
    environment:
      GLPI_REMOVE_INSTALLER: 'no'
      GLPI_INSTALL_PLUGINS: "
        fusioninventory|https://github.com/fusioninventory/fusioninventory-for-glpi/releases/download/glpi9.4%2B2.4/fusioninventory-9.4+2.4.tar.bz2,\
        dumpentity|https://forge.glpi-project.org/attachments/download/2089/glpi-dumpentity-1.4.0.tar.gz\
        "
    ports:
      - 127.0.0.1:8008:80
    volumes:
      - data-glpi-files:/var/www/files
      - data-glpi-config:/var/www/config
    depends_on:
      mysqldb:
        condition: service_healthy
    restart: always
    networks:
      glpi-network:
        aliases:
          - glpi

  mysqldb:
    image: mysql
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      interval: 10s
      timeout: 5s
      retries: 5
    restart: always
    command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8
    environment:
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - mysql-glpi-db:/var/lib/mysql
    restart: always
    networks:
      glpi-network:
        aliases:
          - mysqldb

networks:
  glpi-network:
    driver: bridge

volumes:
  data-glpi-files:
  data-glpi-config:
  mysql-glpi-db:

Tag summary

Content type

Image

Digest

sha256:e5ae696a8

Size

266 MB

Last updated

about 1 month ago

docker pull wolvverine/docker-glpi:nginx-84-xdebug-11.0.8-3.8.5-dev