| Audience | Operators and developers of mwaeckerlin/lam |
| Basis | Dockerfile, preconfigure.php, lam.ini, docker-compose.yml, the tests under tests/ |
| Document | Build, runtime and deployment of both images, state of 2026-10-30 |
The diagrams are written in the plantuml blocks of this file; npm run build:doc renders them to the SVG files beside it. Every external dependency is named by its function; 12.1 maps the functions to their suppliers.
The two images run the current release of the directory front end without a shell and without root: mwaeckerlin/lam:nginx serves its static files, mwaeckerlin/lam:php-fpm runs its PHP code. An administrator manages the users and groups of an LDAP directory in the browser; the operator configures everything with environment variables.
The operator starts the two containers, the first request writes the configuration, and every restart applies the variables that are set. The features are numbered in FEATURES.md.
PlantUML source
@startuml lam-user-story
hide empty description
state "Old image on its volumes" as old
state "Configuration converted" as converted
state "Containers started" as started
state "Configuration refused (503)" as refused
state "Configured" as configured
state "Administrator logged in" as logged
[*] --> started : docker compose up
[*] --> old
old --> converted : release 9.3 saves the main configuration and every server profile
converted --> started : new images on the same volumes
started --> configured : first request writes or updates config.cfg and the server profile
started --> refused : LAM_PASSWORD missing on empty volumes, or an invalid value
refused --> started : variable corrected, container restarted
configured --> logged : login with the LDAP password
logged --> configured : logout
configured --> started : variable changed, container restarted
@enduml- Security: no shell, no root, no default password, internal files never delivered by the web server.
- Compatibility: the volumes, their layout and the variables
CONFIGandDATAof the image of 2018 stay. - Operability: every setting is an environment variable, applied on every start; a wrong setting is named in the answer of the web page and in the container log.
| Role | Expectation |
|---|---|
| Operator | starts the images with variables only, upgrades from the old image without losing the configuration |
| Administrator of the directory | manages users and groups in the browser |
| Developer of the image | builds and tests the images with the npm scripts of the family |
- The runtime base images come from the family:
mwaeckerlin/php-fpmandmwaeckerlin/nginx, build stages onmwaeckerlin/very-base. They carry no shell, so the images have no start script. - No version is written into the
Dockerfile: the release of the directory front end is the latest one at build time. - Configuration comes from environment variables with defaults; no file has to be mounted or edited.
- The paths
/etc/ldap-account-managerand/var/lib/ldap-account-managerof the old image stay the volumes. - Releases 9.4 and later of the directory front end read their configuration only in the JSON format that 9.0 introduced.
PlantUML source
@startuml lam-context
left to right direction
actor "Administrator" as admin
actor "Operator" as operator
rectangle "mwaeckerlin" {
component "mwaeckerlin/lam:nginx" as proxy
component "mwaeckerlin/lam:php-fpm" as php
}
rectangle "Operator's systems" {
component "[[#reverse-proxy Reverse proxy]]" as rp
database "[[#ldap-directory LDAP directory]]" as ldap
database "[[#configuration-database Configuration database]]" as db
}
admin --> rp : HTTPS
rp --> proxy : HTTP 8080
proxy --> php : FastCGI 9000
php --> ldap : LDAP or LDAPS
php ..> db : only with LAM_CONFIGURATION_DATABASE=mysql
operator --> php : environment variables
@enduml| Interface | Partner | Protocol |
|---|---|---|
port 8080 of mwaeckerlin/lam:nginx |
browser, or a reverse proxy that sends X-Forwarded-Proto: https |
HTTP |
port 9000 of mwaeckerlin/lam:php-fpm |
mwaeckerlin/lam:nginx only, through PHP_FPM_HOST (default lam) |
FastCGI |
LDAP_SERVER |
LDAP directory | ldap:// or ldaps:// |
LAM_CONFIGURATION_* |
configuration database | MySQL |
- Two images. nginx delivers the static files and passes every request for a
.phppath to php-fpm; the nginx image carries every PHP file empty, because nginx only checks that the script exists (Dockerfile:23-24). - Preparation inside PHP.
lam.inisetsauto_prepend_filetopreconfigure.php, which restores the defaults, writes or updates the configuration and stores in APCu that it is done, so it works once per start of php-fpm. - Variables only where they are set. The image presets none of the configuration variables, so a variable that has a value was set by the operator, and only those overwrite the configuration in the volumes.
- Every PHP module from the base.
gettext, which LAM needs, is part of the default set ofmwaeckerlin/php-fpm, so it is always built on the same PHP as the base.
PlantUML source
@startuml lam-building-blocks
rectangle "mwaeckerlin" {
component "mwaeckerlin/very-base" as base
component "mwaeckerlin/php-fpm" as phpbase
component "mwaeckerlin/nginx" as nginxbase
component "stage lam" as lam
component "stage static" as static
component "stage php-fpm" as php
component "stage nginx" as nginx
}
rectangle "Source hosting" as hosting [[#source-hosting]] {
artifact "release archive" as release
}
base --> lam
release --> lam : download of the latest release
lam --> static : copy without config, sess, tmp, lib, help, locale, *.inc
lam --> php : /root/ tree
phpbase --> php
static --> nginx : /app
nginxbase --> nginx
@enduml| Building block | Content |
|---|---|
stage lam |
downloads the latest release, moves config, sess and tmp to /var/lib/ldap-account-manager.original, links them from /app to the data volume, adds preconfigure.php and lam.ini |
stage static |
the release without the configuration, sessions, temporary files, libraries, help, translations and *.inc, every .php file empty |
image mwaeckerlin/lam:php-fpm |
the base mwaeckerlin/php-fpm, whose modules include gettext, with the release, the two volumes and the health check |
image mwaeckerlin/lam:nginx |
the base mwaeckerlin/nginx with the static files in /app, PHP_FPM_HOST=lam, SPA_FALLBACK=no |
preconfigure.php consists of the class Preconfigure, which does the work, and PreconfigureException, which carries the cause and, where a volume is not writable, the path of that volume. The message to the administrator comes from customerMessage(), the technical detail follows below it.
PlantUML source
@startuml lam-first-request
participant "Browser" as browser
participant "mwaeckerlin/lam:nginx" as nginx
participant "php-fpm" as fpm
participant "preconfigure.php" as pre
database "volumes" as vol
participant "[[#ldap-directory LDAP directory]]" as ldap
browser -> nginx : GET /templates/login.php
nginx -> fpm : FastCGI, script exists in /app
fpm -> pre : auto_prepend_file
pre -> pre : APCu says done? then return
pre -> vol : copy missing defaults from .original
pre -> vol : write missing config.cfg and server profile from all variables
pre -> vol : write the set variables into the existing files
alt a setting is missing or invalid
pre --> browser : 503, the message and the cause
else prepared
pre -> pre : APCu stores done
fpm -> ldap : login page and login
fpm --> browser : 200
end
@endumlA new file is written to a temporary name and linked into place, an existing one replaced by renaming the temporary file over it, so two parallel first requests never read half a file. A failure stores nothing in APCu, so the next request tries again.
APCu holds the done mark for the lifetime of php-fpm under a key that contains the release version from /app/VERSION; every later request goes directly to the directory front end. A restart of the container clears APCu, so the next request applies the variables again.
PlantUML source
@startuml lam-deployment
left to right direction
node "Docker host" {
rectangle "network frontend" {
component "lam-proxy\nmwaeckerlin/lam:nginx" as proxy
}
rectangle "networks frontend and backend" {
component "lam\nmwaeckerlin/lam:php-fpm" as php
}
database "volume config\n/etc/ldap-account-manager" as config
database "volume data\n/var/lib/ldap-account-manager" as data
}
database "[[#ldap-directory LDAP directory]]" as ldap
proxy --> php : lam:9000
php --> config
php --> data
php --> ldap : network backend
@endumldocker-compose.yml and the example of the README publish port 8080 on every address of the host, or on the one address BIND_ADDRESS names. The CI service builds both images natively for amd64 and arm64 with the shared workflow of mwaeckerlin/scratch and publishes them in the container registry, the nginx image also as mwaeckerlin/lam:latest.
The variables, their defaults and the _FILE variables for secrets are listed in the README. The defaults live in preconfigure.php; the image sets only CONFIG, DATA, LAM_SKIP_PRECONFIGURE=false and LAM_DISABLE_TLS_CHECK=false. LAM_DISABLE_TLS_CHECK=true sets LDAPTLS_REQCERT=never for the process.
- The configuration password is stored only as a salted
{SSHA}hash, and replaced only where the set password no longer matches it. - nginx answers 404 for the configuration, sessions, temporary files, libraries, help and translations, because they are not in its image.
- Session upload progress and fatal error backtraces stay off and locked by the pool of
mwaeckerlin/php-fpmagainst CVE-2026-109618 and CVE-2026-109619.
/etc/ldap-account-manager holds config.cfg; /var/lib/ldap-account-manager holds config/ with the server profiles, PDF structures and account profiles, sess/ and tmp/. config/config.cfg in the data volume is a link to the file in the configuration volume, as in the old image.
Every failure of the preparation is a PreconfigureException with the cause; the answer is status 503 with Retry-After: 60, the sentence for the administrator and the cause, and error_log writes the cause to the container log.
| Decision | Reason |
|---|---|
| nginx and php-fpm in two images | the family serves PHP applications this way; nginx never holds PHP sources or configuration |
preparation in auto_prepend_file |
the base images start php-fpm directly and carry no shell, so no start script runs before PHP |
| no preset configuration variable in the image | a preset value cannot be told from a value the operator set, and would overwrite changes made on the configuration pages on every start |
| no default password | the published default of the directory front end is known to everybody; 503 until LAM_PASSWORD is set |
| latest release at build time | no version in the Dockerfile; the hourly check of the CI service rebuilds when a parent image changed or the image is a week old |
| Quality goal | Measured by |
|---|---|
| Security | tests/image-contract.sh (no shell, not root), tests/config-contract.sh (no password, locked PHP settings), the 404 tests of tests/e2e/test_lam.py, tests/compose-contract.sh (the address of every port from BIND_ADDRESS, latest from the current nginx build) |
| Compatibility | tests/e2e/test_lam.py on volumes that tests/e2e/seed_upgrade.py fills with an existing installation, without and with variables |
| Operability | the 503 tests and the configuration tests of tests/e2e/test_lam.py, tests/module-contract.sh |
TESTS.md lists every test with the feature it covers.
- A new release changes its file layout. The build stops when
VERSION,templates/login.phpor the two samples are missing (Dockerfile:12); a moved file that is not checked there shows in the end-to-end tests. - Configuration of the old text format. With a variable set, such a file answers 503; the README describes the conversion with release 9.3.
- Without APCu the preparation runs on every request;
mwaeckerlin/php-fpmcarries APCu.
| Term | Meaning |
|---|---|
| main configuration | config.cfg: the configuration password, the default server profile and the configuration storage |
| server profile | <name>.conf in config/ of the data volume: LDAP server, administrator, suffixes, language |
| APCu | the PHP memory cache that holds the done mark of the preparation for the lifetime of php-fpm |
.original |
/var/lib/ldap-account-manager.original, the files of the release that are copied into the data volume where they are missing |