- Why this stack?
- Prerequisites
- Getting started
- Features
- Updating
- Supply chain trust
- Production checklist
- Backups
- Testing
- Security Notes
- About the maintainer
This repository deploys GLPI (IT asset management + helpdesk) behind Traefik with automatic Let's Encrypt TLS, backed by MariaDB 11.4 LTS, with scheduled backups (database + application data) and companion restore scripts. One docker compose up away from an ITSM service at https://your-domain.
📙 Full narrative installation guide on the blog: heyvaldemar.com/install-glpi-using-docker-compose/.
| Need | This stack | Manual install | Other compose examples |
|---|---|---|---|
| Ready to deploy in <10 min | ✅ | ❌ PHP + webserver + DB by hand | Often |
| TLS via Let's Encrypt, auto-renewed | ✅ Traefik ACME built-in | Manual certbot | Rare |
| MariaDB LTS wired with healthchecks | ✅ | Separate install | Varies |
| Scheduled DB + data backups + pruning | ✅ | Manual cron | Rare |
| Restore scripts included | ✅ two scripts | Manual | Rare |
Upstream images pinned by sha256 digest |
✅ | N/A | Rare |
| Weekly pin-freshness check in CI | ✅ | N/A | Rare |
| CI-verified deployment on every push | ✅ | N/A | Rare |
| Credentials via env (never committed) | ✅ | N/A | Often committed plaintext |
Four moving parts (Traefik + GLPI + MariaDB + backups). No Kubernetes prerequisites, no manual certificate management.
- A Linux server with a public IP. Tested on Ubuntu 22.04 LTS+ and Debian 12+.
- Docker Engine 24+ and Docker Compose 2.20+.
- A domain you control, with two
Arecords pointing at your server's public IP: one for GLPI, one for the Traefik dashboard. DNS must propagate before deploy. - Ports 80 and 443 open on the server's firewall.
- ~1 GB free RAM for a small helpdesk, plus disk for attachments and backups.
# 1. Clone git clone https://github.com/heyvaldemar/glpi-traefik-letsencrypt-docker-compose cd glpi-traefik-letsencrypt-docker-compose # 2. Create the two Docker networks the stack expects docker network create traefik-network docker network create glpi-network # 3. Copy the environment template and fill in required values cp .env.example .env $EDITOR .env # ^ Required: GLPI_DB_PASSWORD, GLPI_DB_ADMIN_PASSWORD, GLPI_HOSTNAME, # TRAEFIK_HOSTNAME, TRAEFIK_ACME_EMAIL, TRAEFIK_BASIC_AUTH. # 4. Deploy docker compose -f glpi-traefik-letsencrypt-docker-compose.yml -p glpi up -d
Within a couple of minutes https://${GLPI_HOSTNAME} serves the GLPI login page with a fresh Let's Encrypt certificate: the image installs GLPI into the database on first start, so there is no setup wizard. GLPI creates its four default accounts (glpi/glpi, tech/tech, normal/normal, post-only/postonly); change their passwords, or disable the ones you do not use, before anyone else can reach the page.
# All services healthy: docker compose -f glpi-traefik-letsencrypt-docker-compose.yml -p glpi ps # Front page answers: curl -fskL -o /dev/null -w "%{http_code}\n" "https://${GLPI_HOSTNAME}/" # Traefik issued a certificate: docker compose -p glpi logs traefik | grep -i "adding certificate" # First backup lands after BACKUP_INIT_SLEEP (default 30m): docker compose -p glpi logs backups | tail -3
- Cert issuance fails. DNS hasn't propagated or port 80 isn't reachable from the internet.
docker compose upfails withset in .env. A required variable is empty; the error names it.network glpi-network not found. Step 2 was skipped.- GLPI restarts with exit code 6. It found no
config_db.phpinglpi-databut a database that already holds GLPI, and refused to install over it. See From 1.x to 2.0.0.
docker compose -f glpi-traefik-letsencrypt-docker-compose.yml -p glpi up -d --force-recreate
GLPI keeps its own time zone settings; no environment variable sets them. To store dates in UTC and let each user and entity choose the zone they read them in, allow the GLPI database user to read MariaDB's time zone names, then switch GLPI over once:
docker compose -f glpi-traefik-letsencrypt-docker-compose.yml -p glpi exec mariadb \ sh -c 'MYSQL_PWD="$MARIADB_ROOT_PASSWORD" mariadb -uroot -e "GRANT SELECT ON mysql.time_zone_name TO \`$MARIADB_USER\`@\`%\`; FLUSH PRIVILEGES;"' docker compose -f glpi-traefik-letsencrypt-docker-compose.yml -p glpi exec glpi bin/console database:enable_timezones
The default zone is then set under Setup > General > Default values. Without this step GLPI uses UTC.
- GLPI 11 from GLPI's own image, installed on first start and migrated on every image update: asset inventory, helpdesk tickets, contracts, knowledge base. GLPI 12 is held for a major release of this template: it replaces CSRF tokens, breaks plugins written for 11, and rebuilds the knowledge base in a one-way migration.
- MariaDB 11.4 LTS backing store with healthcheck and start-order dependency.
- Traefik v3 with automatic HTTP→HTTPS redirect and Let's Encrypt TLS-ALPN certificate issuance.
- Basic-auth protected Traefik dashboard on a separate hostname.
- Scheduled backups of the database (
mysqldump | gzip) and application data (tar.gz) with retention pruning, plus restore scripts for both. - Credentials required at deploy time: compose fails fast if
.envis incomplete.
./update.sh moves this checkout to the latest release tag — a combination this repository's CI has booted, upgraded from the previous release on the same volumes, and smoke-tested — and then runs docker compose up -d. It refuses to cross a major version unattended, refuses to run over local changes, and names any variable that became required since your version before anything has moved. ./update.sh --dry-run says what would happen. Every release cut by fleet triage also carries what upstream changed, read from its release notes against this compose file.
Releases 1.0.0 to 1.9.x mounted the glpi-data volume at /var/www/html/glpi, a path the GLPI image never reads. GLPI keeps everything it owns under /var/glpi (its config with glpicrypt.key, which decrypts the passwords it stores, plus uploaded files, the marketplace and logs), so on those releases Docker kept it in an anonymous volume. The data archives held an empty directory, and a docker compose down followed by up would have started GLPI on a new, empty volume. 2.0.0 mounts glpi-data at /var/glpi. With the 1.x stack still running:
./glpi-move-data-into-volume.sh ./update.sh --allow-major
The script stops GLPI, copies the anonymous volume into glpi-data, and refuses to finish unless glpicrypt.key and the file count match on both sides. 2.0.0 then starts GLPI 11.0.11 on that data and migrates the schema from 11.0.8 itself. Take a fresh database backup first; archives written by 1.x hold no GLPI data, and the restore script refuses them.
If GLPI already came up on an empty volume (the installer appeared over a database that still has your data), the 2.0.0 image will stop with an error rather than reinstall over it. Restore config/config_db.php with docker compose exec glpi bin/console database:configure and the same database credentials; passwords GLPI stored encrypted (mail collectors, LDAP binds) need to be entered again, because the key that encrypted them is gone.
This repository is a deployment template, not a custom Docker image. It orchestrates three upstream images:
traefik: reverse proxy, Docker Hub official imageglpi/glpi: GLPI's official image, built by the GLPI project for every releasemariadb: MariaDB, Docker Hub official image
All three are pinned to tag@sha256:<digest> as interpolation defaults in the compose file's x-images block. git pull alone delivers the version combination this repository has tested; an *_IMAGE_TAG variable in .env overrides deliberately.
Two override levels exist per image. <PREFIX>_IMAGE_VERSION in .env swaps only the version of that image (Compose then pulls the tag, without a digest) and leaves every other pin as tested; <PREFIX>_IMAGE_TAG replaces the whole reference, digest included. The variable names are listed in .env.example. Nested defaults need Docker Compose v2.5 or newer (2022); v2.0 to v2.4 leave the inner ${...} unexpanded and docker compose up fails with an invalid reference instead of deploying something unexpected.
The daily check-pin-freshness CI job re-resolves each pinned tag against its registry and compares the pinned GLPI and Traefik versions against the latest upstream releases. CI runs on every push, pull request, and every day at 06:00 UTC. GitHub Actions are pinned by commit SHA; Dependabot keeps those fresh.
Every release from v1.8.6 on carries three files made on GitHub's runner with a short-lived identity and no stored key: glpi-traefik-letsencrypt-docker-compose-<tag>.tar.gz, a git archive of exactly the tree the tag points at; glpi-traefik-letsencrypt-docker-compose-<tag>.tar.gz.sigstore.json, a keyless Sigstore signature over it; and glpi-traefik-letsencrypt-docker-compose-<tag>.intoto.jsonl, SLSA build provenance from the SLSA generator. To check them with nothing from this repository trusted:
cosign verify-blob glpi-traefik-letsencrypt-docker-compose-<tag>.tar.gz \ --bundle glpi-traefik-letsencrypt-docker-compose-<tag>.tar.gz.sigstore.json \ --certificate-identity https://github.com/heyvaldemar/glpi-traefik-letsencrypt-docker-compose/.github/workflows/release-assets.yml@refs/tags/<tag> \ --certificate-oidc-issuer https://token.actions.githubusercontent.com slsa-verifier verify-artifact glpi-traefik-letsencrypt-docker-compose-<tag>.tar.gz \ --provenance-path glpi-traefik-letsencrypt-docker-compose-<tag>.intoto.jsonl \ --source-uri github.com/heyvaldemar/glpi-traefik-letsencrypt-docker-compose \ --source-tag <tag>
The identity is exact: this repository's release-assets.yml, on the tag you deploy. A signature from any other workflow, or from this one on another ref, fails the check. A release published after 24 September 2026 is signed by the run that published it, so the commands above take it as they are. The five releases before that date were signed by a run started by hand on main: for those, end the identity in @refs/heads/main and give slsa-verifier --source-branch main instead of --source-tag <tag>. The archive is still the tag's tree. The workflow that makes them is release-assets.yml.
- Change the stock GLPI logins immediately after setup (
glpi,tech,normal,post-onlyall ship with known passwords). - Delete
install/when the wizard tells you to: GLPI warns until the installer is removed. - Strong secrets. Both database passwords at 24+ random characters; regenerate the Traefik dashboard hash per deployment.
- Host-mount the backup volumes for disaster recovery.
- Verify Let's Encrypt cert issuance in the Traefik logs on first start.
- Back up before upgrades: GLPI migrates its schema on first start with a newer image.
The backups container performs a dump → archive → prune → sleep loop: mysqldump | gzip of the GLPI database, tar.gz of the application data, pruning by retention windows, then sleeping BACKUP_INTERVAL (default 24h).
Each cycle logs Database backup OK: <file> (<bytes> bytes) or Database backup FAILED (the same for the data archive where there is one). A failed dump is kept as <file>.failed for diagnosis and never overwrites a good backup. Grep the log for FAILED from your monitoring.
Restore with the interactive scripts (chmod +x *.sh once): ./glpi-restore-database.sh, then ./glpi-restore-application-data.sh. Each lists the backups and asks, or takes a file name as its argument; both read every path and credential from the running backups container, and CI runs both on every push.
Every service carries memory and CPU limits plus reservations as compose-level defaults: the same values CI boots the stack under. Override any of them in .env (the knobs and their defaults are listed in .env.example, e.g. TRAEFIK_MEMORY_LIMIT=512m) and the override survives every git pull. If a service is OOM-killed under real load, docker inspect <container> --format '{{.State.OOMKilled}}' says so; raise its _MEMORY_LIMIT and recreate.
Every service runs with security_opt: no-new-privileges:true, so a process cannot gain privileges through setuid binaries even if it escapes its initial capability set. Infrastructure containers (the reverse proxy, databases, caches, backups) run with cap_drop: [ALL] and add back only what their entrypoints need: NET_BIND_SERVICE for Traefik to bind :80/:443, CHOWN/SETUID/SETGID (and friends) for database images to own their data directory and drop to their service user. Application containers keep the default capability set on purpose: upstream images assume it, and a wrong guess there is a boot loop in production rather than a hardening win. CI boots the stack under exactly these settings on every push, so what ships is what was tested.
The Deployment Verification workflow runs on every push, pull request, and every day at 06:00 UTC:
- Lint: shellcheck on both restore scripts, actionlint on the workflow.
- Trivy scans of all three pinned images (CRITICAL/HIGH, SARIF to the Security tab).
- Pin freshness (daily/manual): digest drift plus release-lag checks for GLPI and Traefik.
- Deploy-and-test: boots the full stack with ephemeral credentials and requires the front page to answer through Traefik.
A green run is the authoritative proof that the template deploys end-to-end and that its backups restore.
tests/e2e-backup-restore.sh runs against the live stack and is what CI executes after the HTTPS smoke. The scenario that matters most is the restore roundtrip: insert a marker row, restore the earliest backup, assert the marker is gone. A backup that cannot be restored fails the build. Run it yourself against a running deployment with short intervals in .env (BACKUP_INIT_SLEEP=15s, BACKUP_INTERVAL=60s):
chmod +x tests/e2e-backup-restore.sh ./tests/e2e-backup-restore.sh
It stops the database container briefly to prove failure detection. Run it on a staging copy, not on production.
- Credentials are read from
.envat deploy time;.envis gitignored and compose fails fast on missing required variables. - Pre-rotation advisory. Releases before v1.0.0 (2026-08-31) shipped a tracked
.envwith generated-looking database passwords. Rotate them if your deployment reused them. - MariaDB listens only on the internal network.
- Upstream image digests are pinned; the daily freshness job flags drift loudly.
Maintained by Vladimir Mikhalev · Docker Captain · CNCF Ambassador · IBM Champion · AWS Community Builder