Keel LNMP: nginx, MariaDB and PHP-FPM on Keel Web (handbook decision 0058)
  • Shell 93.6%
  • PHP 2.3%
  • Python 2.3%
  • Makefile 1.8%
Find a file
Marcos Méndez 7f53ae8d6a
All checks were successful
tests / appliance (push) Successful in 10s
tests / tests (push) Successful in 59s
tests / package (push) Has been skipped
tests / stack (push) Successful in 3m28s
Merge pull request 'chore: stable 1 carries keel 0.23.55 and the syncthing overlay' (#8) from chore/stable-1-keel-0.23.55 into main
2026-10-25 14:34:10 -03:00
.forgejo/workflows ci: the stack job turns the binary log on, so the sql_log_bin test runs 2026-10-16 06:49:44 +00:00
bin feat: the lnmp layer, nginx, MariaDB and PHP-FPM on Keel Web (0059) 2026-10-16 06:42:24 +00:00
conf.d feat: the lnmp layer, nginx, MariaDB and PHP-FPM on Keel Web (0059) 2026-10-16 06:42:24 +00:00
keel fix: the pair example names the overlay address in listen 2026-10-16 07:42:43 +00:00
overlay feat: the lnmp layer, nginx, MariaDB and PHP-FPM on Keel Web (0059) 2026-10-16 06:42:24 +00:00
plan fix: the plan names no webmin-phpini, which no archive carries 2026-10-16 06:55:03 +00:00
tests fix: the boot test reads the lnmp manifest from the assembled rootfs 2026-10-18 02:17:36 +00:00
.gitignore feat: the lnmp layer, nginx, MariaDB and PHP-FPM on Keel Web (0059) 2026-10-16 06:42:24 +00:00
changelog chore: stable 1 carries keel 0.23.55 and the syncthing overlay 2026-10-25 17:19:28 +00:00
COVERAGE.md feat: the lnmp layer, nginx, MariaDB and PHP-FPM on Keel Web (0059) 2026-10-16 06:42:24 +00:00
LICENSE chore: the repository of lnmp (handbook decision 0058) 2026-10-16 06:22:28 +00:00
Makefile feat: the lnmp layer, nginx, MariaDB and PHP-FPM on Keel Web (0059) 2026-10-16 06:42:24 +00:00
README.rst feat: the lnmp layer, nginx, MariaDB and PHP-FPM on Keel Web (0059) 2026-10-16 06:42:24 +00:00

Keel LNMP: nginx, MariaDB and PHP-FPM
=====================================

Keel LNMP is the PHP stack of Keel Linux (handbook decision 0059). It is a
layer on Keel Web::

    bt-layer lnmp --parent web

The chain is Core, Web and LNMP. Web brings nginx, Coraza and Anubis. This
layer adds PHP-FPM 8.4 and MariaDB 11.8 from Debian 13. Keel has no Apache.

What the layer adds
-------------------

- MariaDB on the two loopback addresses (``99-keel-bind.cnf``), with its
  socket units masked (keel-mariadb#29).
- The administrative account ``admin``, which cannot authenticate until
  the first boot sets its password from ``DB_PASS``
  (``firstboot.d/35mysqlpass``, from keel-mariadb).
- PHP-FPM on Debian's unix socket. No TCP port opens for it.
- The appliance manifest ``/usr/share/keel/appliances/lnmp.yaml``, built on
  ``web``: MariaDB on 3306 as a ``mesh`` port with its Monit check, PHP-FPM,
  the ``db_password`` secret and the ``db_user`` option.
- The check page at ``https://<address>/keel-check/``.

The image does not carry the manifest of keel-mariadb. Its base is
``core``, and two manifests that no other manifest is built on leave
``keel inspect`` unable to name the appliance (0059, point 3). The files
that keel-mariadb adds to the server are copied here for that reason.

The check page
--------------

``/etc/nginx/keel-default.d/50-keel-lnmp.conf`` gives
``/keel-check/index.php`` to PHP-FPM. keel-web 0.3.0 includes that
directory in its default site and in the server behind Anubis, so the page
answers in the simple mode and in the cloud modes.

The page connects to MariaDB over the local socket as ``www-data``, the
user of PHP-FPM. The server knows that user by the socket
(``unix_socket``), so there is no password for it. The account has
``SELECT`` on ``keel_check`` only. The page shows:

- the versions of PHP and MariaDB,
- the role of the server: writable, or read-only on a replica,
- the rows that ``firstboot.d/40lnmp-check`` wrote at the first boot.

The page only reads. On a pair, the row on the replica comes from the
primary, so the page also shows that the replication works. If MariaDB
does not answer, the page answers 503 with one line.

``firstboot.d/40lnmp-check`` writes with ``sql_log_bin = 0``. A node that
becomes a replica later then holds no transaction that the primary does
not have. It writes nothing on a read-only server. If the spec declares
``database.server.role: replica``, it makes the account and no database:
keel's seed would refuse to replace a local database without a
confirmation.

The pair
--------

The pair of decision 0049 comes from the spec: ``database.server`` and
``appliance.vip``, as on the keel-mariadb layer. keel converges the pair by
``database.server.engine``, not by the name of the appliance.
``keel/instance.example.yaml`` is a standalone spec and
``keel/instance.pair.example.yaml`` the primary of a pair.

Tests
-----

See ``tests/README.md`` and ``COVERAGE.md``.