Cockpit CMS

Verified: as operated in 2022, the site generation before nCMS; config files as deployed then. Motivation and story: blog post The (almost) perfect website – concept.

Architecture of the headless-CMS site generation stage of niklas-stephan.de: Agentejo Cockpit (headless CMS) for content, Node-RED for the static build, served from a RAM disk.

Site webshot

Tool stack

  • Cockpit (Agentejo) – WCMS with clean back/frontend separation, media management and an integrated HTTP API; webhooks trigger builds.
  • Node-RED – build pipeline (not used as IoT here, the flow engine is what matters).
  • Bootstrap 5 – frontend skeleton; no jQuery, vanilla JS.
  • VS Code – editing of templates, CSS, JS; git for versioning.
  • Supporting services: Nginx Reverse Proxy Manager, Let's Encrypt, Matomo, Docker/Docker-Compose.

Content model and pipeline

Static HTML content is stored in Cockpit singletons (with attributes such as language and version); posts live in a collection, so one Cockpit instance can serve many sites. Images are managed in Cockpit with automatic thumbnails. The site is generated on demand:

  1. Start of the deployment manually or via webhook (Cockpit fires a webhook on save).
  2. Collect all static sources.
  3. Collect all existing singletons and posts.
  4. Dynamic generation of meta data.
  5. Rendering of the individual pages.
  6. Saving the pages on disk and in memory.

Generated files land in /dev/shm (RAM disk); the reverse proxy serves from there – no CDN was needed. The full build took 0.099 s on a shared server.

Compose: Cockpit

services:
  cms-db:
    image: 'mongo:latest'
    restart: always
    volumes:
    - './db:/data/db'
    networks:
    - default
    logging:
      options:
        max-size: "10m"
        max-file: "3"
  cms:
    image: agentejo/cockpit
    restart: always
    volumes:
      - './cms/config.php:/var/www/html/config/config.php'
      - './cms/defines.php:/var/www/html/config/defines.php'
      - './storage:/var/www/html/storage'
    environment:
        COCKPIT_SESSION_NAME: SESSION
        COCKPIT_SALT: SALT
        COCKPIT_DATABASE_SERVER: 'mongodb://cms-db:27017'
        COCKPIT_DATABASE_NAME: DBNAME
    depends_on:
    - cms-db
    ports:
    - "8080:80"
    networks:
    - default
    logging:
      options:
        max-size: "10m"
        max-file: "3"
volumes:
  mongo-vol: null

Cockpit backend

Compose: Node-RED build pipeline

services:
  node-red:
    image: nodered/node-red:latest
    restart: always
    environment:
      - TZ=Europe/Berlin
    ports:
      - "1880:1880"
    networks:
      - default
    logging:
      options:
        max-size: "10m"
        max-file: "3"
    volumes:
      - ./data:/data
      - ./templates:/templates
      - ./static:/static
      - /etc/localtime:/etc/localtime:ro
      - /dev/shm/nsde:/ramdisk
      - ./development:/development

VS Code as the editing hub

Successors

This stage was replaced by ncms (own Node-RED flat-file CMS, 2022–2024), and that by the current Grav stack (see the website relaunch post).