Skip to content

Commit

Permalink
Merge pull request #35 from Wolvverine/develop
Browse files Browse the repository at this point in the history
Merge from developer branch
  • Loading branch information
Wolvverine authored May 7, 2024
2 parents 81564ca + 87f2fce commit 29d12c5
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 92 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/github-actions-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
glpiversion: [10.0.6,10.0.7]
imagevariant: [nginx-74,nginx-82]
glpiversion: [10.0.15]
imagevariant: [nginx-82]
phpxdebug: [yes,no]
steps:
-
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ env:
# READ!!! https://docs.travis-ci.com/user/encryption-keys/#note-on-escaping-certain-symbols
matrix:
# Provide a list of GLPI version to build
- GLPI_VERSION=10.0.5 IMAGE_VARIANT=nginx-74 UPDATE_README=1 UPDATE_LATEST=1
- GLPI_VERSION=10.0.5 IMAGE_VARIANT=nginx-74 UPDATE_README=1 GLPI_PHP_XDEBUG=yes
- GLPI_VERSION=10.0.14 IMAGE_VARIANT=nginx-82 UPDATE_README=1 UPDATE_LATEST=1
- GLPI_VERSION=10.0.14 IMAGE_VARIANT=nginx-82 UPDATE_README=1 GLPI_PHP_XDEBUG=yes

before_install:
- sudo apt update
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile_nginx-82
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ ENV PHPFPM_PM_MAX_SPARE_SERVERS 8
ENV PHPFPM_PM_PROCESS_IDLE_TIMEOUT 120s
ENV PHPFPM_PM_MAX_REQUEST 2000

ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8


# Install dependencies
RUN set -ex; \
PHP_XDEBUG=$(echo "${PHP_XDEBUG}" | tr '[:upper:]' '[:lower:]') ; \
Expand All @@ -57,7 +61,7 @@ RUN set -ex; \
tar \
tzdata \
; \
pip3 install \
pip3 install --break-system-packages \
j2cli \
jinja2-getenv-extension \
; \
Expand Down
93 changes: 50 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@ This images contains an instance of GLPI web application served by nginx and php

## Supported tags, image variants and respective Dockerfile links

* nginx and PHP7.4 embedded [Dockerfile](https://github.com/Wolvverine/docker-glpi/blob/master/Dockerfile_nginx-74)
* nginx and PHP8.2 embedded [Dockerfile](https://github.com/Wolvverine/docker-glpi/blob/master/Dockerfile_nginx-82)

* `nginx-74-9.5.9-3.5.1`
* `nginx-74-10.0.3-3.5.1`
* `nginx-82-10.0.14-3.7`

* Development versions with and without Xdebug:

* `nginx-74-9.5.9-3.5.1-develop`
* `nginx-74-10.0.3-3.5.1-develop`
* `nginx-74-xdebug-9.5.9-3.5.1-develop`
* `nginx-74-xdebug-10.0.3-3.5.1-develop`

* `nginx-82-10.0.14-3.7-develop`
* `nginx-82-xdebug-10.0.14-3.7-develop`


## Docker Informations
Expand All @@ -35,28 +32,31 @@ This images contains an instance of GLPI web application served by nginx and php

* This image takes theses environnements variables as parameters

| Environment | Type | Usage | Default |
| ------------------------------ | ---------------- | ------------------------------------------------------------------------- | -------- |
| TZ | String | Contains the timezone | |
| GLPI_REMOVE_INSTALLER | Boolean (yes/no) | Set to yes if it's not the first installation of glpi | no |
| GLPI_CHMOD_PATHS_FILES | Boolean (yes/no) | Set to yes to apply chmod/chown on /var/www/files (useful for host mount) | no |
| GLPI_INSTALL_PLUGINS | String | Comma separated list of plugins to install (see below) | |
| PHP_MEMORY_LIMIT | String | see PHP memory_limit configuration | 64M |
| PHP_UPLOAD_MAX_FILESIZE | String | see PHP upload filesize configuration | 16M |
| PHP_MAX_EXECUTION_TIME | String | see PHP max execution time configuration | 3600 |
| PHP_POST_MAX_SIZE | String | see PHP post_max_size configuration | 20M |
| PHP_OPCACHE_MEM_CONSUMPTION | String | see PHP opcache_mem_consumption configuration | 256 |
| PHPFPM_PM | String | see PHPFPM pm configuration | dynamic |
| PHPFPM_PM_MAX_CHILDREN | Integer | see PHPFPM pm.max_children configuration | 30 |
| PHPFPM_PM_START_SERVERS | Integer | see PHPFPM pm.start_servers configuration | 4 |
| PHPFPM_PM_MIN_SPARE_SERVERS | Integer | see PHPFPM pm.min_spare_servers configuration | 4 |
| PHPFPM_PM_MAX_SPARE_SERVERS | Integer | see PHPFPM pm.max_spare_servers configuration | 8 |
| PHPFPM_PM_PROCESS_IDLE_TIMEOUT | Mixed | see PHPFPM pm.process_idle_timeout configuration | 120s |
| PHPFPM_PM_MAX_REQUEST | Integer | see PHPFPM pm.max_request configuration | 2000 |
| ------------------------------ | ---------------- | ------------------------------------------------------------------------- | -------- |
| PHPFPM_XDEBUG_CLIENT_PORT | Integer | Contains xdebug client host port | |
| PHPFPM_XDEBUG_CLIENT_HOST | String | Contains xdebug client host IP or DNS name | |
| ______________________________ | ________________ | _________________________________________________________________________ | ________ |
| Environment | Type | Usage | Default |
| ------------------------------ | ---------------- | ------------------------------------------------------------------------- | ----------- |
| TZ | String | Contains the timezone | |
| GLPI_REMOVE_INSTALLER | Boolean (yes/no) | Set to yes if it's not the first installation of glpi | no |
| GLPI_CHMOD_PATHS_FILES | Boolean (yes/no) | Set to yes to apply chmod/chown on /var/www/files (useful for host mount) | no |
| GLPI_INSTALL_PLUGINS | String | Comma separated list of plugins to install (see below) | |
| PHP_MEMORY_LIMIT | String | see PHP memory_limit configuration | 64M |
| PHP_UPLOAD_MAX_FILESIZE | String | see PHP upload filesize configuration | 16M |
| PHP_MAX_EXECUTION_TIME | String | see PHP max execution time configuration | 3600 |
| PHP_POST_MAX_SIZE | String | see PHP post_max_size configuration | 20M |
| PHP_OPCACHE_MEM_CONSUMPTION | String | see PHP opcache_mem_consumption configuration | 256 |
| PHPFPM_PM | String | see PHPFPM pm configuration | dynamic |
| PHPFPM_PM_MAX_CHILDREN | Integer | see PHPFPM pm.max_children configuration | 30 |
| PHPFPM_PM_START_SERVERS | Integer | see PHPFPM pm.start_servers configuration | 4 |
| PHPFPM_PM_MIN_SPARE_SERVERS | Integer | see PHPFPM pm.min_spare_servers configuration | 4 |
| PHPFPM_PM_MAX_SPARE_SERVERS | Integer | see PHPFPM pm.max_spare_servers configuration | 8 |
| PHPFPM_PM_PROCESS_IDLE_TIMEOUT | Mixed | see PHPFPM pm.process_idle_timeout configuration | 120s |
| PHPFPM_PM_MAX_REQUEST | Integer | see PHPFPM pm.max_request configuration | 2000 |
| PHP_MAX_INPUT_VARS | Integer | see PHPF max_input_vars | 3000 |
| LANG | String | Contains the locale | en_US.UTF-8 |
| LC_ALL | String | Contains the locale | en_US.UTF-8 |
| ------------------------------ | ---------------- | ------------------------------------------------------------------------- | ----------- |
| PHPFPM_XDEBUG_CLIENT_PORT | Integer | Contains xdebug client host port | |
| PHPFPM_XDEBUG_CLIENT_HOST | String | Contains xdebug client host IP or DNS name | |
| ______________________________ | ________________ | _________________________________________________________________________ | ___________ |

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".
Expand All @@ -69,10 +69,19 @@ For better example see at the end of this file.

* The following volumes are exposed by this image

| Volume | Usage |
| ------------------ | ------------------------------------------------ |
| /var/www/files | The data path of GLPI |
| /var/www/config | The configuration path of GLPI |
| Volume | Usage |
| ------------------ | --------------------------------------------- |
| /var/www/files | The data path of GLPI |
| /var/www/config | The configuration path of GLPI |
| __________________________________________________________________ |

Optional for developers:

| Volume | Usage |
| -------------------- | -------------------------------------------- |
| /var/www/plugins | The installed manual plugins path |
| /var/www/marketplace | The installed plugins from marketplace path |
| ___________________________________________________________________ |


## Application Informations
Expand Down Expand Up @@ -117,18 +126,17 @@ Please refer to the GLPI documentations to handle this at database level https:/
## Installation

```
docker pull wolvverine/docker-glpi:nginx-72-latest
docker pull wolvverine/docker-glpi:nginx-82-10.0.14-3.7
```


## 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.

### Without database link (you can use an ip address or a domain name in the installer gui)

```
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
docker run --name glpi --publish 8000:80 --volume data-glpi:/var/www/files --volume data-glpi-config:/var/www/config wolvverine/docker-glpi:nginx-82-10.0.14-3.7
```

### With database link (if you have any MySQL/MariaDB as a docker container)
Expand All @@ -148,7 +156,7 @@ docker run --name mysql -d --net glpi-network -e MYSQL_DATABASE=glpi -e MYSQL_US
#### 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
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-82-10.0.14-3.7
```

#### Cron task on Docker host
Expand All @@ -160,18 +168,17 @@ docker run --name glpi --publish 8000:80 --volume data-glpi:/var/www/files --vol

### Docker-compose Specific configuration examples

* Production configuration with already installed GLPI with FusionInventory and dashboard plugin :
* Production configuration with already installed GLPI and dashboard plugin :

```
version: '2.1'
services:
glpi:
image: wolvverine/docker-glpi:nginx-74-latest
image: wolvverine/docker-glpi:nginx-82-10.0.14-3.7
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:
Expand All @@ -187,7 +194,7 @@ services:
glpi-network:
aliases:
- glpi
mysqldb:
image: mysql
healthcheck:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6
3.8.1
4 changes: 1 addition & 3 deletions install scripts/install_upgrade_glpi_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -a
set -x

containername="glpi"
imagetag="nginx-74-10.0.3-3.5.1"
imagetag="nginx-82-10.0.14-3.8.1"
imagename="wolvverine/docker-glpi"
restartpolicy="unless-stopped"

Expand Down Expand Up @@ -32,8 +32,6 @@ docker run --restart "$restartpolicy" --detach --name "$containername" \
-e GLPI_CHMOD_PATHS_FILES=yes -e GLPI_REMOVE_INSTALLER=yes \
-e GLPI_ENABLE_CRONJOB=yes -e TZ="Europe/Warsaw" \
-e GLPI_INSTALL_PLUGINS="\
behaviors|https://github.com/yllen/behaviors/releases/download/v2.7.1/glpi-behaviors-2.7.1.tar.gz,\
pdf|https://github.com/yllen/pdf/releases/download/v2.1.0/glpi-pdf-2.1.0.tar.gz,\
vip|https://github.com/InfotelGLPI/vip/releases/download/1.8.1/glpi-vip-1.8.1.tar.bz2,\
statecheck|https://github.com/ericferon/glpi-statecheck/releases/download/v2.3.7/statecheck-v2.3.7.tar.gz" \
"$imagename:$imagetag"
Expand Down
91 changes: 91 additions & 0 deletions install scripts/install_upgrade_glpi_with_mariadb_docker.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
@ECHO OFF
REM GLPI Install Environment
REM names containers
SET GLPI_container=GLPI
SET DB_Container=MariaDB
REM GLPI Docker repository and dockerhub tags
SET docker_repository=wolvverine/docker-glpi
SET docker_tag=nginx-82-10.0.14-3.8.1

REM aktualne tagi dla kontenera GLPI
REM www_server-php_version-glpi_version-container_version
REM nginx-82-10.0.14-3.8
REM nginx-82-xdebug-10.0.14-3.8
REM https://hub.docker.com/r/wolvverine/docker-glpi/tags

REM Database Docker repository and dockerhub tags
SET docker_DB_repository=mariadb
SET docker_DB_tag=latest

REM Password and user for DB
SET password=your_db_password

REM External ports for containers
SET GLPI_port=6080
SET DB_port=6303


REM ####################################################################

ECHO Volumes for container %GLPI_container%
docker volume create %GLPI_container%-config
docker volume create %GLPI_container%-plugins
docker volume create %GLPI_container%-marketplace

ECHO Dedicated internal network for containers: %GLPI_container% and %DB_Container%
docker network create %GLPI_container%-network

ECHO Remove old container %GLPI_container% and pull new image
docker stop %GLPI_container%
docker rm %GLPI_container% && ^
docker pull %docker_repository%:%docker_tag%

ECHO Running %GLPI_container% container
docker run --restart unless-stopped --name %GLPI_container% ^
--publish %GLPI_port%:80 ^
--volume %GLPI_container%-files:/var/www/files ^
--volume "%GLPI_container%"-config:/var/www/config ^
--volume "%GLPI_container%"-plugins:/var/www/plugins ^
--volume "%GLPI_container%"-marketplace:/var/www/marketplace ^
--net "%GLPI_container%"-network ^
-e GLPI_CHMOD_PATHS_FILES=yes ^
-e GLPI_REMOVE_INSTALLER=no ^
-e GLPI_ENABLE_CRONJOB=yes ^
-e PHP_MEMORY_LIMIT=128M ^
-e TZ="Europe/Warsaw" ^
-e GLPI_INSTALL_PLUGINS="" ^
-d %docker_repository%:%docker_tag%

REM ####################################################################
ECHO MARIADB

ECHO Volume for %DB_Container% container
docker volume create %DB_Container%-%GLPI_container%-data

ECHO Remove old %DB_Container% container and pull new image
docker stop %DB_Container%
docker rm %DB_Container% && ^
docker pull %docker_DB_repository%:%docker_DB_tag%

ECHO Running %DB_Container% container
docker run --restart always --name %DB_Container% --net %GLPI_container%-network ^
-p %DB_port%:3306 ^
--volume %DB_Container%-%GLPI_container%-data:/var/lib/mysql ^
-e MYSQL_ROOT_PASSWORD=%password% ^
-d %docker_DB_repository%:%docker_DB_tag%

ECHO Commands in %DB_Container% container - wait
REM TODO wait for full start container server
timeout 60 > NUL
ECHO Check databases
docker exec -it %DB_Container% mariadb-check --all-databases --check-upgrade --auto-repair -u root --password=%password%
ECHO Upgrade databases
docker exec -it %DB_Container% mariadb-upgrade -u root --password=%password%
ECHO Timezone
docker exec -it %DB_Container% sh -c "export TZ='Europe/Warsaw'"
docker exec -it %DB_Container% sh -c "rm /etc/localtime"
docker exec -it %DB_Container% sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone"
timeout 5 > NUL
start "" http://localhost:%GLPI_port%
start "" \\wsl$\docker-desktop-data\data\docker\volumes
PAUSE
11 changes: 7 additions & 4 deletions install scripts/install_upgrade_mariadb_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ imagename="mariadb"
imagetag="latest"
restartpolicy="unless-stopped"
glpicontainername="glpi"
dbpassword="your_db_root_password"

#first time
docker volume create "$containername"-"$glpicontainername"-data
Expand All @@ -23,11 +24,13 @@ docker run --detach --restart $restartpolicy --name "$containername" \
-p 3306:3306 \
--volume "$containername"-"$glpicontainername"-data:/var/lib/mysql:Z \
--volume "$containername"-"$glpicontainername"-config:/etc/mysql:Z \
-e MYSQL_ROOT_PASSWORD='xxxxxxxxxxxxxx' \
-e MYSQL_ROOT_PASSWORD="$dbpassword" \
$imagename:$imagetag

docker exec -it $containername mysqlcheck -u root -p --all-databases --check-upgrade --auto-repair
docker exec -it $containername mysql_upgrade -u root -p
echo "Wait for start container $containername ."
sleep 60
docker exec -it $containername mariadb-check --all-databases --check-upgrade --auto-repair -u root --password="$dbpassword"
docker exec -it $containername mariadb-upgrade -u root --password="$dbpassword"
docker exec -it $containername /bin/sh -c "export TZ='Europe/Warsaw'"
docker exec -it $containername /bin/sh -c "rm /etc/localtime"
docker exec -it $containername /bin/sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone"
docker exec -it $containername /bin/sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone"
2 changes: 1 addition & 1 deletion install scripts/plugins_repo_list.csv
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ reports,yllen,reports
statecheck,ericferon,glpi-statecheck
treeview,pluginsGLPI,treeview
typology,InfotelGLPI,typology
vip,InfotelGLPI,vip
vip,InfotelGLPI,vip
Loading

0 comments on commit 29d12c5

Please sign in to comment.