Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
facd74b
Create main.yml
aguyonp Mar 9, 2021
f8f3ddb
Update docker-compose.yml
aguyonp Mar 9, 2021
a13a336
Update mysql.env
aguyonp Mar 9, 2021
4031010
Update main.yml
aguyonp Mar 9, 2021
e80746e
Update README.md
aguyonp Mar 9, 2021
2d59669
Update README.md
aguyonp Mar 9, 2021
373f2d9
Rename mysql.env to mariadb.env
aguyonp Mar 9, 2021
298f475
Rename main.yml to docker.yml
aguyonp Mar 9, 2021
64e91f0
Update docker-compose.yml
aguyonp Mar 9, 2021
f11f485
Update docker.yml
aguyonp Mar 9, 2021
2198e8d
Update docker.yml
aguyonp Mar 9, 2021
cd4d9a0
Update docker.yml
aguyonp Mar 9, 2021
28d16da
Create glpi-install.sh
aguyonp Mar 9, 2021
8498ed6
Update glpi-start.sh
aguyonp Mar 9, 2021
b15a758
Update Dockerfile
aguyonp Mar 9, 2021
bd8d9d6
Update docker.yml
aguyonp Mar 9, 2021
9e08de9
Update Dockerfile
aguyonp Mar 9, 2021
c9bb601
Update Dockerfile
aguyonp Mar 9, 2021
01aecb0
Update docker.yml
aguyonp Mar 9, 2021
a97cce8
Update glpi-install.sh
aguyonp Mar 9, 2021
f9e55cc
Update glpi-install.sh
aguyonp Mar 9, 2021
1305513
Update README.md
aguyonp Mar 9, 2021
c88f835
Update README.md
aguyonp Mar 9, 2021
5cef3db
Create README.md
aguyonp Mar 9, 2021
c1ec345
Update docker.yml
aguyonp Mar 9, 2021
90f4083
Add package apache2-utils
aguyonp Mar 11, 2021
065f013
Update mariadb.env variable
aguyonp Mar 15, 2021
3ec82c6
update volumes in docker-compose example
aguyonp Mar 16, 2021
425249f
update volumes in docker-compose and version
aguyonp Mar 16, 2021
ccc7dcb
update docker-compose version
aguyonp Mar 16, 2021
77c1cc4
Update Dockerfile
aguyonp Sep 27, 2021
0f01a6c
Create testing.yml
aguyonp Mar 27, 2023
6b293ba
Update testing.yml
aguyonp Mar 27, 2023
ebcd949
Update testing.yml
aguyonp Mar 27, 2023
5405480
Update testing.yml
aguyonp Mar 27, 2023
6dcca3d
Update testing.yml
aguyonp Mar 27, 2023
51e563a
Update testing.yml
aguyonp Mar 27, 2023
75985fb
Update testing.yml
aguyonp Mar 27, 2023
37c55fc
Create check_glpi_version.yml
aguyonp Mar 27, 2023
7283796
Create check_glpi_version.py
aguyonp Mar 27, 2023
e4c587c
Update check_glpi_version.yml
aguyonp Mar 27, 2023
d1a1b4e
Update check_glpi_version.yml
aguyonp Mar 27, 2023
99523e2
Update check_glpi_version.yml
aguyonp Mar 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/check_glpi_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Check GLPI Version

on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:

jobs:
check_version:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests beautifulsoup4

- name: Download last GLPI version artifact
uses: actions/download-artifact@v2
with:
name: last_glpi_version
path: ./last_glpi_version.txt
continue-on-error: true

- name: Check GLPI version
run: python check_glpi_version.py

- name: Store new version
if: ${{ success() }}
run: |
echo "NEW_GLPI_VERSION=$(cat new_glpi_version.txt)" >> $GITHUB_ENV

- name: Run build for new version
if: ${{ success() }}
run: |
echo "Build process starts for new GLPI version ${{ env.NEW_GLPI_VERSION }}"
# Ajoutez ici les étapes pour lancer le build avec la nouvelle version

- name: Upload new last GLPI version artifact
if: ${{ success() }}
uses: actions/upload-artifact@v2
with:
name: last_glpi_version
path: ./last_glpi_version.txt
23 changes: 23 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Docker GLPI Build

#on: [push]
on: [workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: docker login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: docker build glpi
run: |
docker build . -t aguyonnet/glpi:$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep tag_name | cut -d '"' -f 4) -t aguyonnet/glpi:latest
- name: docker push
run: |
docker push aguyonnet/glpi:$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep tag_name | cut -d '"' -f 4)
docker push aguyonnet/glpi:latest
39 changes: 39 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Mise à jour automatique du programme

on:
schedule:
- cron: '0 * * * *' # Exécute la pipeline toutes les heures
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Extraire la valeur HTML spécifique
run: |
wget -O - https://glpi-project.org/fr/telecharger-glpi/ | grep "<p style=\"text-align: center;\">GLPI VERSION" | sed -n 's/.*GLPI VERSION \([0-9.]*\).*/\1/p' > current_version.txt
export PROGRAM_VERSION_LATEST=$(cat current_version.txt)

- name: Checkout repository
uses: actions/checkout@v2

- name: Configurer Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"

- name: Comparer et mettre à jour la version
run: |
export PROGRAM_VERSION=$(grep "PROGRAM_VERSION" .github/variables/repository-variables.env | sed -n 's/.*PROGRAM_VERSION=\([0-9.]*\).*/\1/p')
echo "PROGRAM_VERSION=$PROGRAM_VERSION"
echo "PROGRAM_VERSION_LATEST=$PROGRAM_VERSION_LATEST"

if [ "$PROGRAM_VERSION" != "$PROGRAM_VERSION_LATEST" ]; then
sed -i "s/PROGRAM_VERSION=$PROGRAM_VERSION/PROGRAM_VERSION=$PROGRAM_VERSION_LATEST/" .github/variables/repository-variables.env
git add .github/variables/repository-variables.env
git commit -m "Mise à jour de la version de GLPI à $PROGRAM_VERSION_LATEST"
git push
else
echo "La version de GLPI est déjà à jour"
exit 1
fi
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#On choisit une debian
FROM debian:10.4
FROM debian:10

MAINTAINER DiouxX "github@diouxx.be"
MAINTAINER Aguyonnet "f.guyonantoine@gmail.com"

#Ne pas poser de question à l'installation
ENV DEBIAN_FRONTEND noninteractive

#Installation d'apache et de php7.3 avec extension
RUN apt update \
&& apt install --yes --no-install-recommends \
apt-utils \
apache2 \
apache2-utils \
php7.3 \
php7.3-mysql \
php7.3-ldap \
Expand All @@ -32,9 +34,10 @@ jq \
&& rm -rf /var/lib/apt/lists/*

#Copie et execution du script pour l'installation et l'initialisation de GLPI
COPY glpi-start.sh /opt/
RUN chmod +x /opt/glpi-start.sh
COPY glpi-start.sh glpi-install.sh /opt/
RUN chmod +x /opt/glpi-start.sh /opt/glpi-install.sh
RUN bash /opt/glpi-install.sh
ENTRYPOINT ["/opt/glpi-start.sh"]

#Exposition des ports
EXPOSE 80 443
EXPOSE 80
119 changes: 34 additions & 85 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,34 @@
# Project to deploy GLPI with docker

![Docker Pulls](https://img.shields.io/docker/pulls/diouxx/glpi) ![Docker Stars](https://img.shields.io/docker/stars/diouxx/glpi) [![](https://images.microbadger.com/badges/image/diouxx/glpi.svg)](http://microbadger.com/images/diouxx/glpi "Get your own image badge on microbadger.com") ![Docker Cloud Automated build](https://img.shields.io/docker/cloud/automated/diouxx/glpi)

# Table of Contents
- [Project to deploy GLPI with docker](#project-to-deploy-glpi-with-docker)
- [Table of Contents](#table-of-contents)
- [Introduction](#introduction)
- [Deploy with CLI](#deploy-with-cli)
- [Deploy GLPI](#deploy-glpi)
- [Deploy GLPI with existing database](#deploy-glpi-with-existing-database)
- [Deploy GLPI with database and persistence container data](#deploy-glpi-with-database-and-persistence-container-data)
- [Deploy a specific release of GLPI](#deploy-a-specific-release-of-glpi)
- [Deploy with docker-compose](#deploy-with-docker-compose)
- [Deploy without persistence data ( for quickly test )](#deploy-without-persistence-data--for-quickly-test)
- [Deploy with persistence data](#deploy-with-persistence-data)
- [mysql.env](#mysqlenv)
- [docker-compose .yml](#docker-compose-yml)
- [Environnment variables](#environnment-variables)
- [TIMEZONE](#timezone)

![Docker Pulls](https://img.shields.io/docker/pulls/aguyonnet/glpi) ![Docker Stars](https://img.shields.io/docker/stars/aguyonnet/glpi)
# Introduction

Install and run an GLPI instance with docker.

# Deploy with CLI

## Deploy GLPI
```sh
docker run --name mysql -e MYSQL_ROOT_PASSWORD=diouxx -e MYSQL_DATABASE=glpidb -e MYSQL_USER=glpi_user -e MYSQL_PASSWORD=glpi -d mysql:5.7.23
docker run --name glpi --link mysql:mysql -p 80:80 -d diouxx/glpi
```

## Deploy GLPI with existing database
```sh
docker run --name glpi --link yourdatabase:mysql -p 80:80 -d diouxx/glpi
```

## Deploy GLPI with database and persistence data

For an usage on production environnement or daily usage, it's recommanded to use container with volumes to persistent data.

* First, create MySQL container with volume

```sh
docker run --name mysql -e MYSQL_ROOT_PASSWORD=diouxx -e MYSQL_DATABASE=glpidb -e MYSQL_USER=glpi_user -e MYSQL_PASSWORD=glpi --volume /var/lib/mysql:/var/lib/mysql -d mysql:5.7.23
```

* Then, create GLPI container with volume and link MySQL container

```sh
docker run --name glpi --link mysql:mysql --volume /var/www/html/glpi:/var/www/html/glpi -p 80:80 -d diouxx/glpi
```

Enjoy :)

## Deploy a specific release of GLPI
Default, docker run will use the latest release of GLPI.
For an usage on production environnement, it's recommanded to set specific release.
Here an example for release 9.1.6 :
```sh
docker run --name glpi --hostname glpi --link mysql:mysql --volume /var/www/html/glpi:/var/www/html/glpi -p 80:80 --env "VERSION_GLPI=9.1.6" -d diouxx/glpi
```
Edit the glpi-install.sh specify a version in the VERSION_GLPI var, then launch a build

# Deploy with docker-compose

## Deploy without persistence data ( for quickly test )
```yaml
version: "3.2"
version: "3.5"

services:
#Mysql Container
mysql:
image: mysql:5.7.23
container_name: mysql
hostname: mysql
#mariadb Container
mariadb:
image: mariadb:latest
container_name: mariadb
hostname: mariadb
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=glpidb
- MYSQL_USER=glpi_user
- MYSQL_PASSWORD=glpi
- mariadb_ROOT_PASSWORD=password
- mariadb_DATABASE=glpidb
- mariadb_USER=glpi_user
- mariadb_PASSWORD=glpi

#GLPI Container
glpi:
image: diouxx/glpi
image: aguyonnet/glpi
container_name : glpi
hostname: glpi
ports:
Expand All @@ -91,53 +37,56 @@ services:

## Deploy with persistence data

To deploy with docker compose, you use *docker-compose.yml* and *mysql.env* file.
You can modify **_mysql.env_** to personalize settings like :
To deploy with docker compose, you use *docker-compose.yml* and *mariadb.env* file.
You can modify **_mariadb.env_** to personalize settings like :

* MySQL root password
* mariadb root password
* GLPI database
* GLPI user database
* GLPI user password


### mysql.env
### mariadb.env
```
MYSQL_ROOT_PASSWORD=diouxx
MYSQL_ROOT_PASSWORD=aguyonnet
MYSQL_DATABASE=glpidb
MYSQL_USER=glpi_user
MYSQL_PASSWORD=glpi
```

### docker-compose .yml
```yaml
version: "3.2"
version: "3.5"

services:
#Mysql Container
mysql:
image: mysql:5.7.23
container_name: mysql
hostname: mysql
#mariadb Container
mariadb:
image: mariadb:latest
container_name: mariadb-glpi
hostname: mariadb
volumes:
- /var/lib/mysql:/var/lib/mysql
- glpi-db:/var/lib/mysql
env_file:
- ./mysql.env
- ./mariadb.env
restart: always

#GLPI Container
glpi:
image: diouxx/glpi
image: aguyonnet/glpi
container_name : glpi
hostname: glpi
ports:
- "80:80"
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/www/html/glpi/:/var/www/html/glpi
- glpi-data:/var/www/html/glpi
environment:
- TIMEZONE=Europe/Brussels
- TIMEZONE=Europe/Paris
restart: always
volumes:
glpi-db:
glpi-data:
```

To deploy, just run the following command on the same directory as files
Expand All @@ -153,13 +102,13 @@ If you need to set timezone for Apache and PHP

From commande line
```sh
docker run --name glpi --hostname glpi --link mysql:mysql --volumes-from glpi-data -p 80:80 --env "TIMEZONE=Europe/Brussels" -d diouxx/glpi
docker run --name glpi -p 80:80 --env "TIMEZONE=Europe/Paris" -d aguyonnet/glpi
```

From docker-compose

Modify this settings
```yaml
environment:
TIMEZONE=Europe/Brussels
TIMEZONE=Europe/Paris
```
31 changes: 31 additions & 0 deletions check_glpi_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
import requests
from bs4 import BeautifulSoup

url = "https://glpi-project.org/fr/telecharger-glpi/"
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
version_tag = soup.find('p', {'style': 'text-align: center;'})

if not version_tag:
print("GLPI version tag not found.")
exit(1)

version_text = version_tag.text.strip()
current_version = version_text.split(" ")[-1]

try:
with open("last_glpi_version.txt", "r") as f:
last_version = f.read().strip()
except FileNotFoundError:
last_version = None

if current_version != last_version:
print(f"New GLPI version found: {current_version}")
with open("new_glpi_version.txt", "w") as f:
f.write(current_version)
with open("last_glpi_version.txt", "w") as f:
f.write(current_version)
else:
print(f"No new version found. Current version is {current_version}.")
exit(78)
Loading