DevOps Config Generators: Docker, CI, Units & Cloud
September 5, 2026 · DevTools
DevOps configs fail in expensive ways: a cache-busting COPY, a matrix that explodes to 200 jobs, a unit file missing Restart, a proxy missing a brace, a cloud-init typo that bricks first boot. These five generators catch them before they ship: Dockerfile Layer Optimizer, GitHub Actions Matrix Calculator, Systemd Service Builder, Caddyfile Builder, and Cloud-Init Generator.
Cache-friendly Dockerfiles with real rules
The optimizer parses with parseDockerfile — handling continuations and multi-stage FROM ... AS builder tracking — then analyzeDockerfile checks six cache rules. Unpinned bases (latest or untagged) warn because cache keys turn unreproducible. A lone apt-get update without install warns since the index layer goes stale. Missing rm -rf /var/lib/apt/lists/* warns about bloat, broad COPY . copies suggest a .dockerignore plus manifest-first ordering, consecutive RUN layers suggest combining with &&, and build-tool calls (npm, go, cargo, mvn) in a single-stage file suggest a multi-stage build. Each finding carries severity, line, and reason, plus a layerCount and cacheEstimate.
optimizeDockerfile applies the safe fixes: consecutive RUN layers merge into one, with the apt-list cleanup appended:
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
Matrix combos without billing surprises
calculateMatrix expands variables as a cartesian product, then applies exclude rules first (partial-match removal) and include rules second — merging extra keys into matching jobs via canMerge or appending new jobs.
Cost follows OS_MULTIPLIERS: Linux/Ubuntu at 1x, Windows at 2x, macOS at 10x. It reports totalBeforeRules, excludedCount, waves (ceil(jobs / concurrency)), raw billedMinutes, price-weighted weightedMinutes, and overLimit past GitHub's 256-job cap. formatCombination renders combos like os=ubuntu · node=20.
| Matrix | Jobs | 5 min/job, concurrency 4 |
|---|---|---|
| os × node (3 × 3, 1 excluded) | 8 | 2 waves, 40 billed minutes |
| Same matrix, macOS runners | 8 | 400 weighted minutes (10x) |
Units, proxies, and first boot that validate
The Systemd Service Builder emits .service and .timer units via buildSystemdUnits (aliased as generateSystemdUnits). It covers Type (simple, forking, oneshot, exec, notify), Restart (default on-failure), ExecStart/ExecStartPre/ExecStartPost, sorted Environment= lines, and hardening flags NoNewPrivileges, ProtectSystem=strict, and PrivateTmp. Timers support OnCalendar, OnBootSec, RandomizedDelaySec, and Persistent, with validateCalendarEvent checking weekday ranges and HH:MM[:SS] bounds. It warns on the classic trap: Type=oneshot with Restart=always.
The Caddyfile Builder generates six route types — reverse_proxy, handle_path (with root + file_server), basic_auth, encode (gzip/zstd), header (sorted +set/-delete), and redir (308 by default, 302 when permanent: false) — defaulting empty addresses to :80. validateCaddyfile checks quote-aware brace balance, flags addresses mixed with directives, warns on unknown directives, and localhostHttpsNotice notes Caddy skips public certificates for localhost or bare ports.
The Cloud-Init Generator builds #cloud-config YAML from a typed model: hostname, users with ssh_authorized_keys/sudo/groups, apt/yum packages, write_files with 0644/root:root defaults, runcmd strings or argv arrays, and ssh_pwauth: false by default. validateCloudInitYaml parses with js-yaml, warns on unknown top-level keys or password auth left on, and errors with line numbers on malformed YAML, while runcmd findings identify the offending item.
Try Them
- Dockerfile Layer Optimizer — flag unpinned bases and merge RUN steps.
- GitHub Actions Matrix Calculator — expand combos and price runner minutes.
- Systemd Service Builder — generate hardened units with calendar validation.
- Caddyfile Builder — build reverse_proxy blocks with brace checking.
- Cloud-Init Generator — compose validated user-data for first boot.