Skip to content
Snippets Groups Projects
Verified Commit e8628bbb authored by David Beniamine's avatar David Beniamine
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
# Which docker-compose file to use
# docker-compose.yml : mandatory basic config
# port.yml : add a port mapping for port 80 of GLPI container
# traefik.yml : todo configuration for traefik
COMPOSE_FILE=docker-compose.yml:ports.yml
# If port.yml is enabled in COMPOSE_FILE this is the port to access glpi
GLPI_PORT=8888
# GLPI version used at compilation time
GLPI_VERS=10.0.6
# Mysql credentials
MYSQL_USER=glpi
MYSQL_DATABASE=glpi
MYSQL_PASSWORD=insert-random-string-here
MYSQL_ROOT_PASSWORD=other-random-string
.*.sw?
.env
# GLPI
This is a git repository to install GLPI via docker-compose
## Requirements
+ [docker-compose](https://docs.docker.com/compose/install/)
## Installation
```bash
git clone https://gitlab.tetras-libre.fr/nocloud/docker/glpi
cd glpi
cp .env.sample .env
# Edit .env file and follow instructions
$EDITOR .env
docker-compose up #or docker compose up if you use compose V2
```
Then go to GLPI web interface, by default http://localhost:8888 and follow the instructions.
The database instructions are :
+ Host : `db`
+ USER : `glpi` (default value, may be modified by `MYSQL_USER` in `.env`
+ PASSWORD : see `MYSQL_PASSWORD` in `.env`
When GPI asks you to create or use a database you should see a selectable database named `glpi` (or something else if you changed `MYSQL_DATABASE` in `.env`), use it.
When you finally see GLPI login page restart the stack to cleanup install files :
```bash
docker-compose down
docker-compose up
```
You are all set up !
## Utilisation
At the end of the configuration GLPI automatically creates the following accounts
+ glpi/glpi for administration
+ tech/tech technician
+ normal/normal regular account
+ post-only/postonly write only account
version: "3"
services:
glpi:
build:
context: docker/glpi
args:
GLPI_VERS:
volumes:
- www:/var/www
environment:
MYSQL_USER:
MYSQL_PASSWORD:
GLPI_VAR_DIR: /var/www/data
GLPI_CONFIG_DIR: /var/www/config
db:
image: mariadb
environment:
MYSQL_USER:
MYSQL_PASSWORD:
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE:
volumes:
- db:/var/lib/mysql
volumes:
db:
www:
FROM php:7.4-apache
ARG GLPI_VERS
RUN cd /opt && \
curl -o glpi.tgz -L \
https://github.com/glpi-project/glpi/releases/download/$GLPI_VERS/glpi-$GLPI_VERS.tgz \
&& mkdir src \
&& cd src \
&& tar xzf ../glpi.tgz \
&& rm ../glpi.tgz
RUN apt-get update && apt-get install -y \
libbz2-dev \
libcurl3-dev \
libldap2-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libonig-dev \
libpng-dev \
libxml2-dev \
libzip-dev \
&& docker-php-ext-install -j$(nproc) bz2 \
&& docker-php-ext-install -j$(nproc) curl \
&& docker-php-ext-install -j$(nproc) exif \
&& docker-php-ext-install -j$(nproc) fileinfo \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-install -j$(nproc) intl \
&& docker-php-ext-install -j$(nproc) json \
&& docker-php-ext-install -j$(nproc) ldap \
&& docker-php-ext-install -j$(nproc) mbstring \
&& docker-php-ext-install -j$(nproc) mysqli \
&& docker-php-ext-install -j$(nproc) opcache \
&& docker-php-ext-install -j$(nproc) session \
&& docker-php-ext-install -j$(nproc) simplexml \
&& docker-php-ext-install -j$(nproc) xml \
&& docker-php-ext-install -j$(nproc) zip
COPY glpi.ini $PHP_INI_DIR/conf.d/
COPY entrypoint.sh /entrypoint
ENTRYPOINT ["/entrypoint"]
#!/bin/bash
# Copy GLPI sources
html_dir="/var/www/html"
if [ -z "$(ls $html_dir)" ]; then
cp -r /opt/src/glpi/. $html_dir
fi
# List important directories
DIRS="$GLPI_VAR_DIR $GLPI_CONFIG_DIR $html_dir"
SUBDIRS="cache cron dumps graphs lock pictures plugins rss sessions tmp uploads"
for sub in $SUBDIRS; do
echo $sub
DIRS="$DIRS $GLPI_VAR_DIR/_$sub"
done
echo $DIRS
# Create dirs and change permissions
for d in $DIRS; do
mkdir -p $d
chown -R 33:33 $d
done
if [ -s "$GLPI_CONFIG_DIR/glpicrypt.key" ] && [ -f "$html_dir/install/install.php" ]; then
cat <<EOF > $html_dir/install/.htaccess
<IfModule mod_authz_core.c>
Require local
</IfModule>
<IfModule !mod_authz_core.c>
order deny, allow
deny from all
allow from 127.0.0.1
allow from ::1
</IfModule>
ErrorDocument 403 "<p><b>Restricted area.</b><br />Only local access allowed.<br />Check your configuration or contact your administrator.</p>"
EOF
rm $html_dir/install/install.php
fi
exec apache2ctl -DFOREGROUND
session.cookie_httponly=on
version: "3"
services:
glpi:
ports:
- $GLPI_PORT:80
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment