Author SHA1 Message Date
DiouxX 58ff53e00b Add SNMP package 2018-12-28 10:19:45 +01:00
4 changed files with 73 additions and 187 deletions

No files matched your search

+16 -25
View File
@@ -1,41 +1,32 @@
#On choisit une debian #On choisit une debian
FROM debian:11.1 FROM debian:latest
LABEL org.opencontainers.image.authors="github@diouxx.be"
MAINTAINER DiouxX "github@diouxx.be"
#Ne pas poser de question à l'installation #Ne pas poser de question à l'installation
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
#Installation d'apache et de php7.4 avec extension #Installation d'apache et de php5 avec extension
RUN apt update \ RUN apt update \
&& apt install --yes --no-install-recommends \ && apt -y upgrade \
&& apt -y install \
apache2 \ apache2 \
php7.4 \ php \
php7.4-mysql \ php-mysql \
php7.4-ldap \ php-ldap \
php7.4-xmlrpc \ php-xmlrpc \
php7.4-imap \ php-imap \
curl \ curl \
php7.4-curl \ php-curl \
php7.4-gd \ php-gd \
php7.4-mbstring \ php-mbstring \
php7.4-xml \ php-xml \
php7.4-apcu-bc \ php-apcu-bc \
php-cas \ php-cas \
php7.4-intl \
php7.4-zip \
php7.4-bz2 \
cron \ cron \
wget \ wget \
ca-certificates \
jq \ jq \
libldap-2.4-2 \ snmpd
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 #Copie et execution du script pour l'installation et l'initialisation de GLPI
COPY glpi-start.sh /opt/ COPY glpi-start.sh /opt/
+28 -144
View File
@@ -1,186 +1,70 @@
# Project to deploy GLPI with docker # 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) [![](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")
# Table of Contents # Table of Contents
- [Project to deploy GLPI with docker](#project-to-deploy-glpi-with-docker) 1. [Introduction](#introduction)
- [Table of Contents](#table-of-contents) 2. [Deploy CLI](#deploy-with-CLI)
- [Introduction](#introduction) - [Deploy GLPI without database](#deploy-glpi-without-database)
- [Default accounts](#default-accounts) - [Deploy GLPI with existing database](#deploy-glpi-with-existing-database)
- [Deploy with CLI](#deploy-with-cli) - [Deploy GLPI with database and persistance container data](#deploy-glpi-with-database-and-persistance-container-data)
- [Deploy GLPI](#deploy-glpi) - [Deploy a specific release of GLPI](#deploy-a-specific-release-of-glpi)
- [Deploy GLPI with existing database](#deploy-glpi-with-existing-database) 3. [Deploy docker-compose](#deploy-with-docker-compose)
- [Deploy GLPI with database and persistence data](#deploy-glpi-with-database-and-persistence-data) 4. [Environnment variables](#environnment-variables)
- [Deploy a specific release of GLPI](#deploy-a-specific-release-of-glpi) - [Timezone](#timezone)
- [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 # 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 with CLI
## Deploy GLPI ## Deploy GLPI without database
```sh ```sh
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 -p 80:80 -d diouxx/glpi
docker run --name glpi --link mariadb:mariadb -p 80:80 -d diouxx/glpi
``` ```
## Deploy GLPI with existing database ## Deploy GLPI with existing database
```sh ```sh
docker run --name glpi --link yourdatabase:mariadb -p 80:80 -d diouxx/glpi docker run --name glpi --link yourdatabase:mysql -p 80:80 -d diouxx/glpi
``` ```
## Deploy GLPI with database and persistence data ## Deploy GLPI with database and persistance container data
For an usage on production environnement or daily usage, it's recommanded to use container with volumes to persistent data. For an usage on production environnement or daily usage, it's recommanded to use a data container for persistent data.
* First, create MariaDB container with volume * First, create data container
```sh ```sh
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 docker create --name glpi-data --volume /var/www/html/glpi:/var/www/html/glpi busybox /bin/true
``` ```
* Then, create GLPI container with volume and link MariaDB container * Then, you link your data container with GLPI container
```sh ```sh
docker run --name glpi --link mariadb:mariadb --volume /var/www/html/glpi:/var/www/html/glpi -p 80:80 -d diouxx/glpi docker run --name glpi --hostname glpi --link mysql:mysql --volumes-from glpi-data -p 80:80 -d diouxx/glpi
``` ```
Enjoy :) Enjoy :)
## Deploy a specific release of GLPI ## Deploy a specific release of GLPI
Default, docker run will use the latest 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. For an usage on production environnement, it's recommanded to use the latest release.
Here an example for release 9.1.6 : Here an example for release 9.1.6 :
```sh ```sh
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 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
``` ```
# Deploy with docker-compose # Deploy with docker-compose
## Deploy without persistence data ( for quickly test ) To deploy with docker compose, you use *docker-compose.yml* and *mysql.env* file.
```yaml You can modify **_mysql.env_** to personalize settings like :
version: "3.8"
services: * MySQL root password
#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 :
* MariaDB root password
* GLPI database * GLPI database
* GLPI user database * GLPI user database
* GLPI user password * 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 To deploy, just run the following command on the same directory as files
```sh ```sh
@@ -194,13 +78,13 @@ If you need to set timezone for Apache and PHP
From commande line From commande line
```sh ```sh
docker run --name glpi --hostname glpi --link mariadb:mariadb --volumes-from glpi-data -p 80:80 --env "TIMEZONE=Europe/Brussels" -d diouxx/glpi docker run --name glpi --hostname glpi --link mysql:mysql --volumes-from glpi-data -p 80:80 --env "TIMEZONE=Europe/Brussels" -d diouxx/glpi
``` ```
From docker-compose From docker-compose
Modify this settings Modify this settings
```yaml ```yml
environment: environment:
TIMEZONE=Europe/Brussels TIMEZONE=Europe/Brussels
``` ```
+10 -9
View File
@@ -1,16 +1,15 @@
version: "3.2" version: "3"
services: services:
#MariaDB Container #Mysql Container
mariadb: mysql:
image: mariadb:10.7 image: mysql:5.7.23
container_name: mariadb container_name: mysql
hostname: mariadb hostname: mysql
volumes: volumes:
- /var/lib/mysql:/var/lib/mysql - /var/lib/mysql:/var/lib/mysql
env_file: env_file:
- ./mariadb.env - ./mysql.env
restart: always
#GLPI Container #GLPI Container
glpi: glpi:
@@ -19,10 +18,12 @@ services:
hostname: glpi hostname: glpi
ports: ports:
- "80:80" - "80:80"
links:
- mysql:mysql
volumes: volumes:
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
- /var/www/html/glpi/:/var/www/html/glpi - /var/www/html/glpi/:/var/www/html/glpi
environment: environment:
- TIMEZONE=Europe/Brussels - TIMEZONE=Europe/Brussels
restart: always restart: always
+19 -9
View File
@@ -5,9 +5,7 @@
&& VERSION_GLPI=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep tag_name | cut -d '"' -f 4) && VERSION_GLPI=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep tag_name | cut -d '"' -f 4)
if [[ -z "${TIMEZONE}" ]]; then echo "TIMEZONE is unset"; if [[ -z "${TIMEZONE}" ]]; then echo "TIMEZONE is unset";
else else echo "date.timezone = \"$TIMEZONE\"" > /etc/php/7.0/apache2/conf.d/timezone.ini;
echo "date.timezone = \"$TIMEZONE\"" > /etc/php/7.4/apache2/conf.d/timezone.ini;
echo "date.timezone = \"$TIMEZONE\"" > /etc/php/7.4/cli/conf.d/timezone.ini;
fi fi
SRC_GLPI=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/tags/${VERSION_GLPI} | jq .assets[0].browser_download_url | tr -d \") SRC_GLPI=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/tags/${VERSION_GLPI} | jq .assets[0].browser_download_url | tr -d \")
@@ -19,7 +17,7 @@ FOLDER_WEB=/var/www/html/
if !(grep -q "TLS_REQCERT" /etc/ldap/ldap.conf) if !(grep -q "TLS_REQCERT" /etc/ldap/ldap.conf)
then then
echo "TLS_REQCERT isn't present" echo "TLS_REQCERT isn't present"
echo -e "TLS_REQCERT\tnever" >> /etc/ldap/ldap.conf echo -e "TLS_REQCERT\tnever" >> /etc/ldap/ldap.conf
fi fi
#Téléchargement et extraction des sources de GLPI #Téléchargement et extraction des sources de GLPI
@@ -36,13 +34,25 @@ fi
#Modification du vhost par défaut #Modification du vhost par défaut
echo -e "<VirtualHost *:80>\n\tDocumentRoot /var/www/html/glpi\n\n\t<Directory /var/www/html/glpi>\n\t\tAllowOverride All\n\t\tOrder Allow,Deny\n\t\tAllow from all\n\t</Directory>\n\n\tErrorLog /var/log/apache2/error-glpi.log\n\tLogLevel warn\n\tCustomLog /var/log/apache2/access-glpi.log combined\n</VirtualHost>" > /etc/apache2/sites-available/000-default.conf echo -e "<VirtualHost *:80>\n\tDocumentRoot /var/www/html/glpi\n\n\t<Directory /var/www/html/glpi>\n\t\tAllowOverride All\n\t\tOrder Allow,Deny\n\t\tAllow from all\n\t</Directory>\n\n\tErrorLog /var/log/apache2/error-glpi.log\n\tLogLevel warn\n\tCustomLog /var/log/apache2/access-glpi.log combined\n</VirtualHost>" > /etc/apache2/sites-available/000-default.conf
#Add scheduled task by cron and enable
echo "*/2 * * * * www-data /usr/bin/php /var/www/html/glpi/front/cron.php &>/dev/null" >> /etc/cron.d/glpi
#Start cron service
service cron start
#Activation du module rewrite d'apache #Activation du module rewrite d'apache
a2enmod rewrite && service apache2 restart && service apache2 stop a2enmod rewrite && service apache2 restart && service apache2 stop
######################
# CRON CONFIGURATION #
######################
#Add scheduled task by cron and enable
echo "*/2 * * * * www-data /usr/bin/php /var/www/html/glpi/front/cron.php &>/dev/null" >> /etc/cron.d/glpi
#Start cron service
service cron start
######################
# SNMP CONFIGURATION #
######################
#Replace Listen localhot SNMP and restart service
sed -ie "s/agentAddress udp:127.0.0.1:161/agentAdrress udp:161/g" /etc/snmp/snmpd.conf
service snmpd restart
#Lancement du service apache au premier plan #Lancement du service apache au premier plan
/usr/sbin/apache2ctl -D FOREGROUND /usr/sbin/apache2ctl -D FOREGROUND