Skip to content

Commit

Permalink
Merge pull request #111 from DiouxX/debian12
Browse files Browse the repository at this point in the history
Debian12
  • Loading branch information
DiouxX authored Mar 22, 2024
2 parents 58ff53e + 3f9a84e commit fb5f497
Show file tree
Hide file tree
Showing 8 changed files with 249 additions and 79 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build & Publish Docker Image

on:
push:
branches:
- master

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set output
id: vars
run: echo ::set-output name=tag::$
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: diouxx/glpi:latest
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
docker-compose-test.yml
cust-entry.sh
data
start-docker.sh
46 changes: 28 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
#On choisit une debian
FROM debian:latest
FROM debian:12.5

LABEL org.opencontainers.image.authors="[email protected]"

MAINTAINER DiouxX "[email protected]"

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

#Installation d'apache et de php5 avec extension
#Installation d'apache et de php8.3 avec extension
RUN apt update \
&& apt -y upgrade \
&& apt -y install \
&& apt install --yes ca-certificates apt-transport-https lsb-release wget curl \
&& curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg \
&& sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' \
&& apt update \
&& apt install --yes --no-install-recommends \
apache2 \
php \
php-mysql \
php-ldap \
php-xmlrpc \
php-imap \
curl \
php-curl \
php-gd \
php-mbstring \
php-xml \
php-apcu-bc \
php8.3 \
php8.3-mysql \
php8.3-ldap \
php8.3-xmlrpc \
php8.3-imap \
php8.3-curl \
php8.3-gd \
php8.3-mbstring \
php8.3-xml \
php-cas \
php8.3-intl \
php8.3-zip \
php8.3-bz2 \
php8.3-redis \
cron \
wget \
jq \
snmpd
libldap-2.5-0 \
libldap-common \
libsasl2-2 \
libsasl2-modules \
libsasl2-modules-db \
&& rm -rf /var/lib/apt/lists/*

#Copie et execution du script pour l'installation et l'initialisation de GLPI
COPY glpi-start.sh /opt/
Expand Down
172 changes: 144 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,186 @@
# Project to deploy GLPI with docker

[![](https://images.microbadger.com/badges/version/diouxx/glpi.svg)](http://microbadger.com/images/diouxx/glpi "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/image/diouxx/glpi.svg)](http://microbadger.com/images/diouxx/glpi "Get your own image badge on microbadger.com")
![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
1. [Introduction](#introduction)
2. [Deploy CLI](#deploy-with-CLI)
- [Deploy GLPI without database](#deploy-glpi-without-database)
- [Deploy GLPI with existing database](#deploy-glpi-with-existing-database)
- [Deploy GLPI with database and persistance container data](#deploy-glpi-with-database-and-persistance-container-data)
- [Deploy a specific release of GLPI](#deploy-a-specific-release-of-glpi)
3. [Deploy docker-compose](#deploy-with-docker-compose)
4. [Environnment variables](#environnment-variables)
- [Timezone](#timezone)
- [Project to deploy GLPI with docker](#project-to-deploy-glpi-with-docker)
- [Table of Contents](#table-of-contents)
- [Introduction](#introduction)
- [Default accounts](#default-accounts)
- [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 data](#deploy-glpi-with-database-and-persistence-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 a specific release](#deploy-a-specific-release)
- [Deploy with persistence data](#deploy-with-persistence-data)
- [mariadb.env](#mariadbenv)
- [docker-compose .yml](#docker-compose-yml)
- [Environnment variables](#environnment-variables)
- [TIMEZONE](#timezone)

# Introduction

Install and run an GLPI instance with docker.
Install and run an GLPI instance with docker

## Default accounts

More info in the 📄[Docs](https://glpi-install.readthedocs.io/en/latest/install/wizard.html#end-of-installation)

| Login/Password | Role |
|-------------------- |------------------- |
| glpi/glpi | admin account |
| tech/tech | technical account |
| normal/normal | "normal" account |
| post-only/postonly | post-only account |

# Deploy with CLI

## Deploy GLPI without database
## Deploy GLPI
```sh
docker run --name glpi -p 80:80 -d diouxx/glpi
docker run --name mariadb -e MARIADB_ROOT_PASSWORD=diouxx -e MARIADB_DATABASE=glpidb -e MARIADB_USER=glpi_user -e MARIADB_PASSWORD=glpi -d mariadb:10.7
docker run --name glpi --link mariadb:mariadb -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
docker run --name glpi --link yourdatabase:mariadb -p 80:80 -d diouxx/glpi
```

## Deploy GLPI with database and persistance container data
## Deploy GLPI with database and persistence data

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

* First, create data container
* First, create MariaDB container with volume

```sh
docker create --name glpi-data --volume /var/www/html/glpi:/var/www/html/glpi busybox /bin/true
docker run --name mariadb -e MARIADB_ROOT_PASSWORD=diouxx -e MARIADB_DATABASE=glpidb -e MARIADB_USER=glpi_user -e MARIADB_PASSWORD=glpi --volume /var/lib/mysql:/var/lib/mysql -d mariadb:10.7
```

* Then, you link your data container with GLPI container
* Then, create GLPI container with volume and link MariaDB container

```sh
docker run --name glpi --hostname glpi --link mysql:mysql --volumes-from glpi-data -p 80:80 -d diouxx/glpi
docker run --name glpi --link mariadb:mariadb --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 use the latest release.
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 --volumes-from glpi-data -p 80:80 --env "VERSION_GLPI=9.1.6" -d diouxx/glpi
docker run --name glpi --hostname glpi --link mariadb:mariadb --volume /var/www/html/glpi:/var/www/html/glpi -p 80:80 --env "VERSION_GLPI=9.1.6" -d diouxx/glpi
```

# Deploy with docker-compose

To deploy with docker compose, you use *docker-compose.yml* and *mysql.env* file.
You can modify **_mysql.env_** to personalize settings like :
## Deploy without persistence data ( for quickly test )
```yaml
version: "3.8"

services:
#MariaDB Container
mariadb:
image: mariadb:10.7
container_name: mariadb
hostname: mariadb
environment:
- MARIADB_ROOT_PASSWORD=password
- MARIADB_DATABASE=glpidb
- MARIADB_USER=glpi_user
- MARIADB_PASSWORD=glpi

#GLPI Container
glpi:
image: diouxx/glpi
container_name : glpi
hostname: glpi
ports:
- "80:80"
```
## Deploy a specific release
```yaml
version: "3.8"

services:
#MariaDB Container
mariadb:
image: mariadb:10.7
container_name: mariadb
hostname: mariadb
environment:
- MARIADB_ROOT_PASSWORD=password
- MARIADB_DATABASE=glpidb
- MARIADB_USER=glpi_user
- MARIADB_PASSWORD=glpi

#GLPI Container
glpi:
image: diouxx/glpi
container_name : glpi
hostname: glpi
environment:
- VERSION_GLPI=9.5.6
ports:
- "80:80"
```
## Deploy with persistence data
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
### mariadb.env
```
MARIADB_ROOT_PASSWORD=diouxx
MARIADB_DATABASE=glpidb
MARIADB_USER=glpi_user
MARIADB_PASSWORD=glpi
```

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

services:
#MariaDB Container
mariadb:
image: mariadb:10.7
container_name: mariadb
hostname: mariadb
volumes:
- /var/lib/mysql:/var/lib/mysql
env_file:
- ./mariadb.env
restart: always

#GLPI Container
glpi:
image: diouxx/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
environment:
- TIMEZONE=Europe/Brussels
restart: always
```
To deploy, just run the following command on the same directory as files
```sh
Expand All @@ -78,13 +194,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 --hostname glpi --link mariadb:mariadb --volumes-from glpi-data -p 80:80 --env "TIMEZONE=Europe/Brussels" -d diouxx/glpi
```

From docker-compose

Modify this settings
```yml
```yaml
environment:
TIMEZONE=Europe/Brussels
```
```
19 changes: 9 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
version: "3"
version: "3.2"

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

#GLPI Container
glpi:
Expand All @@ -18,12 +19,10 @@ services:
hostname: glpi
ports:
- "80:80"
links:
- mysql:mysql
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- /var/www/html/glpi/:/var/www/html/glpi
environment:
- TIMEZONE=Europe/Brussels
restart: always
restart: always
Loading

0 comments on commit fb5f497

Please sign in to comment.