Skip to content

Commit dca8a0a

Browse files
committed
irst commit
0 parents  commit dca8a0a

File tree

5 files changed

+407
-0
lines changed

5 files changed

+407
-0
lines changed

.env

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
##### SYSTEM
2+
TZ=Europe/Berlin
3+
DOCKERDIR=/opt/inventory
4+
5+
### Network
6+
DOMAINNAME=changeme.de
7+
HOSTNAME_OCS=ocs
8+
HOSTNAME_INVENTORY=ocsinventory # For inventory - client access
9+
PORT_OCS=80
10+
HOSTNAME_GLPI=glpi
11+
PORT_GLPI=8080
12+
#PORT1=8082
13+
SUBNET_FRONTEND=172.16.208
14+
SUBNET_BACKEND=172.16.209
15+
16+
### APP OCS
17+
VERSION_OCS=latest
18+
OCS_SSL_ENABLED=0
19+
OCS_DB_SERVER=mariadb
20+
OCS_DB_PORT=3306
21+
OCS_DB_NAME=ocsweb
22+
OCS_DB_USER=ocs
23+
# pwgen -1cnsB 25 1
24+
OCS_DB_PASS=MyPassword123
25+
26+
27+
### APP GLPI
28+
GLPI_LANG=de_DE
29+
VERSION=latest
30+
UPLOAD_MAX_FILESIZE=100M
31+
POST_MAX_SIZE=50M
32+
MARIADB_GLPI_HOST=mariadb
33+
MARIADB_GLPI_PORT=3306
34+
MARIADB_GLPI_DATABASE=glpi
35+
MARIADB_GLPI_USER=glpi
36+
# pwgen -1cnsB 25 1
37+
MARIADB_GLPI_PASSWORD=MyPassword456
38+
39+
### MYSQL DB
40+
VERSION_DB=10.9
41+
# pwgen -1cnsB 30 1
42+
MARIADB_ROOT_PASSWORD=MySuperPassword789

README.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<h1 align="center">GLPI - IT Asset Management</h1>
2+
3+
<p align='justify'>
4+
5+
<a href="https://glpi-project.org">GLPI</a> - is an open source IT Asset Management, issue tracking system and service desk system. This software is written in PHP and distributed as open-source software under the GNU General Public License.
6+
7+
GLPI is a web-based application helping companies to manage their information system. The solution is able to build an inventory of all the organization's assets and to manage administrative and financial tasks. The system's functionalities help IT Administrators to create a database of technical resources, as well as a management and history of maintenances actions. Users can declare incidents or requests (based on asset or not) thanks to the Helpdesk feature.
8+
</p>
9+
10+
- [GLPI Docker Image](#glpi-docker-image)
11+
- [Install GLPI docker container](#install-glpi-docker-container)
12+
- [Setup Timezone](#setup-timezone)
13+
- [Setup General](#setup-general)
14+
- [Setup Plugins via CLI](#setup-plugins-via-cli)
15+
- [Setup OCS Inventory NG](#setup-ocs-inventory-ng)
16+
- [Setup Mailgate](#setup-mailgate)
17+
- [Setup Memcached](#setup-memcached)
18+
19+
## GLPI Docker Image
20+
Image is based on [Alpine 3.17](https://hub.docker.com/repository/docker/johann8/bacularis/general)
21+
22+
| pull | size | version | platform |
23+
|:---------------------------------:|:----------------------------------:|:--------------------------------:|:--------------------------------:|
24+
| ![Docker Pulls](https://img.shields.io/docker/pulls/johann8/alpine-glpi?style=flat-square) | ![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/johann8/alpine-glpi/latest) | [![](https://img.shields.io/docker/v/johann8/alpine-glpi?sort=date)](https://hub.docker.com/r/johann8/alpine-glpi/tags "Version badge") | ![](https://img.shields.io/badge/platform-amd64-blue "Platform badge") |
25+
26+
## Install GLPI docker container
27+
- create folders
28+
29+
```bash
30+
DOCKERDIR=/opt/inventory
31+
mkdir -p ${DOCKERDIR}/data/ocsinventory/{perlcomdata,ocsreportsdata,varlibdata,httpdconfdata}
32+
mkdir -p ${DOCKERDIR}/data/nginx/{config,certs,auth}
33+
chown -R 101:101 ${DOCKERDIR}/data/ocsinventory/perlcomdata/
34+
chown -R 101:101 ${DOCKERDIR}/data/ocsinventory/ocsreportsdata/
35+
chown -R 101:101 ${DOCKERDIR}/data/ocsinventory/varlibdata/
36+
mkdir -p ${DOCKERDIR}/data/{glpi,crond,crontabs,mariadb}
37+
mkdir -p ${DOCKERDIR}/data/glpi/{files,plugins,config}
38+
mkdir -p ${DOCKERDIR}/data/crond/{5min,15min,30min,hourly,daily,weekly,monthly}
39+
chown -R 100:101 ${DOCKERDIR}/data/glpi/*
40+
mkdir -p ${DOCKERDIR}/data/mariadb/{config,dbdata,socket}
41+
cd ${DOCKERDIR}
42+
tree -d -L 3 ${DOCKERDIR}
43+
```
44+
45+
- Download config files
46+
47+
```bash
48+
DOCKERDIR=//opt/inventory
49+
cd ${DOCKERDIR}
50+
wget https://raw.githubusercontent.com/johann8/alpine-glpi/master/docker-compose.yml
51+
wget https://raw.githubusercontent.com/johann8/alpine-glpi/master/docker-compose.override.yml
52+
wget https://raw.githubusercontent.com/johann8/alpine-glpi/master/.env
53+
```
54+
55+
- Customize variable in .env file
56+
57+
- Generate passwords for MariaDB
58+
```bash
59+
DOCKERDIR=/opt/inventory
60+
PASSWORD_OCS=$(pwgen -1cnsB 25 1); sed -i "s/MyPassword123/${PASSWORD_OCS}/" ${DOCKERDIR}/.env
61+
PASSWORD_GLPI=$(pwgen -1cnsB 25 1); sed -i "s/MyPassword456/${PASSWORD_GLPI}/" ${DOCKERDIR}/.env
62+
PASSWORD_ROOT=$(pwgen -1cnsB 30 1); sed -i "s/MySuperPassword789/${PASSWORD_ROOT}/" ${DOCKERDIR}/.env
63+
cat ${DOCKERDIR}/.env
64+
```
65+
- Generate Nginx certificate for FQDN: ocsinventory.changeme.de
66+
```bash
67+
# Generate private key
68+
openssl genrsa -out /etc/pki/tls/private/ca.key 2048
69+
70+
# Generate CSR (Common Name is ocsinventory.changeme.de)
71+
openssl req -new -key /etc/pki/tls/private/ca.key -out /etc/pki/tls/private/ca.csr
72+
73+
# Generate Self Signed Key
74+
openssl x509 -req -days 3650 -in /etc/pki/tls/private/ca.csr -signkey /etc/pki/tls/private/ca.key -out /etc/pki/tls/certs/ca.crt
75+
openssl x509 -in /etc/pki/tls/certs/ca.crt -text -noout
76+
77+
# convert crt to pem
78+
cd /etc/pki/tls/certs && openssl x509 -in ca.crt -out cacert.pem
79+
cd -
80+
openssl x509 -in /etc/pki/tls/certs/cacert.pem -text -noout
81+
82+
# copy certificates
83+
DOCKERDIR=/opt/inventory
84+
cp /etc/pki/tls/private/ca.key ${DOCKERDIR}/data/nginx/certs/ocs.key
85+
cp /etc/pki/tls/certs/ca.crt ${DOCKERDIR}/data/nginx/certs/ocs.crt
86+
cp /etc/pki/tls/certs/cacert.pem ${DOCKERDIR}/
87+
```
88+
- Run all docker container
89+
90+
```bash
91+
DOCKERDIR=/opt/glpi
92+
cd ${DOCKERDIR}
93+
docker-compose up -d
94+
95+
# show logs
96+
docker-compose logs
97+
98+
# show running containers
99+
docker-compose ps
100+
```
101+
- Create GLPI Database
102+
```bash
103+
DOCKERDIR=/opt/inventory
104+
docker-compose exec mariadb bash
105+
mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "create database "${MARIADB_GLPI_DATABASE}" character set utf8mb4"
106+
mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "CREATE USER "${MARIADB_GLPI_USER}""
107+
mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "grant all on "${MARIADB_GLPI_DATABASE}".* to '${MARIADB_GLPI_USER}'@'%' identified by '${MARIADB_GLPI_PASSWORD}'"
108+
mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "FLUSH PRIVILEGES"
109+
mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "show databases;"
110+
mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "select Host,User,Password from mysql.user;"
111+
exit
112+
```
113+
### Install Install OCS Inventory
114+
- Go to http://ocs.int.brg-recht.de/ocsreports/
115+
116+
### Install GLPI
117+
- Go to http://glpi.mydomain.de
118+
- Enter the database connection details as shown in the picture
119+
![Connect to Database](https://raw.githubusercontent.com/johann8/alpine-glpi/master/docs/assets/screenshots/GLPI_Setup_01.PNG)
120+
- Choose the database glpi
121+
![Choose Database](https://raw.githubusercontent.com/johann8/alpine-glpi/master/docs/assets/screenshots/GLPI_Setup_02.PNG)
122+
123+
- Run through the installation wizard and log in with glpi / glpi
124+
125+
Enjoy!

assets/mariadb/config/my.cnf

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[mysqld]
2+
default-time-zone = 'Europe/Berlin'
3+
character-set-client-handshake = FALSE
4+
character-set-server = utf8mb4
5+
collation-server = utf8mb4_unicode_ci
6+
max_allowed_packet = 192M
7+
max-connections = 350
8+
key_buffer_size = 0
9+
read_buffer_size = 192K
10+
sort_buffer_size = 2M
11+
innodb_buffer_pool_size = 24M
12+
read_rnd_buffer_size = 256K
13+
tmp_table_size = 24M
14+
performance_schema = 0
15+
innodb-strict-mode = 0
16+
thread_cache_size = 8
17+
query_cache_type = 0
18+
query_cache_size = 0
19+
max_heap_table_size = 48M
20+
thread_stack = 256K
21+
skip-host-cache
22+
#skip-name-resolve
23+
log-warnings = 0
24+
event_scheduler = 1
25+
26+
[client]
27+
default-character-set = utf8mb4
28+
29+
[mysql]
30+
default-character-set = utf8mb4

docker-compose.override.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: "3.3"
2+
services:
3+
4+
ocsapp:
5+
labels:
6+
- "traefik.enable=true"
7+
- "traefik.docker.network=proxy"
8+
- "traefik.http.routers.ocs-secure.entrypoints=websecure"
9+
- "traefik.http.routers.ocs-secure.middlewares=default-chain@file,rate-limit@file"
10+
- "traefik.http.routers.ocs-secure.rule=Host(`${HOSTNAME_OCS}.${DOMAINNAME}`)"
11+
- "traefik.http.routers.ocs-secure.service=ocs"
12+
#- "traefik.http.routers.ocs-secure.tls.certresolver=produktion" # für eigene Zertifikate
13+
- "traefik.http.routers.ocs-secure.tls.options=modern@file"
14+
- "traefik.http.routers.ocs-secure.tls=true"
15+
- "traefik.http.services.ocs.loadbalancer.sticky.cookie.httpOnly=true"
16+
- "traefik.http.services.ocs.loadbalancer.sticky.cookie.secure=true"
17+
- "traefik.http.services.ocs.loadbalancer.server.port=${PORT_OCS}"
18+
networks:
19+
- proxy
20+
21+
glpi:
22+
labels:
23+
- "traefik.enable=true"
24+
- "traefik.docker.network=proxy"
25+
- "traefik.http.routers.glpi-secure.entrypoints=websecure"
26+
- "traefik.http.routers.glpi-secure.middlewares=default-chain@file,rate-limit@file"
27+
- "traefik.http.routers.glpi-secure.rule=Host(`${HOSTNAME_GLPI}.${DOMAINNAME}`)"
28+
- "traefik.http.routers.glpi-secure.service=glpi"
29+
#- "traefik.http.routers.glpi-secure.tls.certresolver=produktion" # für eigene Zertifikate
30+
- "traefik.http.routers.glpi-secure.tls.options=modern@file"
31+
- "traefik.http.routers.glpi-secure.tls=true"
32+
- "traefik.http.services.glpi.loadbalancer.sticky.cookie.httpOnly=true"
33+
- "traefik.http.services.glpi.loadbalancer.sticky.cookie.secure=true"
34+
- "traefik.http.services.glpi.loadbalancer.server.port=${PORT_GLPI}"
35+
networks:
36+
- proxy
37+
38+
networks:
39+
proxy:
40+
external: true

0 commit comments

Comments
 (0)