cookbook 'hello_world_website', '~> 0.2.1'
hello_world_website (3) Versions 0.2.1 Follow0
Installs Caddy and serves a Hello World page proving this cookbook is deployed
cookbook 'hello_world_website', '~> 0.2.1', :supermarket
knife supermarket install hello_world_website
knife supermarket download hello_world_website
hello_world_website
A small, production-shaped Chef cookbook that installs Caddy
from its official package repositories and serves a single Hello World page.
The page and its response headers prove that this cookbook was deployed, on
which host, and in which cookbook version.
Caddy is installed from the vendor's own channels, never from a distro
package:
| Platform | Repository |
|---|---|
| Debian 13, Ubuntu 26.04 | Cloudsmith caddy/stable APT repository, key dearmored into /usr/share/keyrings
|
| Rocky Linux 10.2 | Official @caddy/caddy COPR repository |
Supported platforms
- Debian 13 (trixie)
- Ubuntu 26.04 LTS
- Rocky Linux 10.2
Requirements
- Cinc Client or Chef Infra Client 18 or newer
(
chef_version '>= 18.0'). -
systemdas the service manager. - Outbound HTTPS to
dl.cloudsmith.io(Debian/Ubuntu) ordownload.copr.fedorainfracloud.org(Rocky) during the converge. - Port
80free on the node. - No external cookbook dependencies; everything uses core Chef resources.
The cookbook expects to own the Caddyfile and the document root. It replaces a
distribution-default Caddyfile, and reloads Caddy rather than restarting it.
Attributes
| Attribute | Default | Purpose |
|---|---|---|
node['hello_world_website']['caddy']['version'] |
nil |
Optional package version pin; nil installs the latest from the repository. |
node['hello_world_website']['caddy']['config_path'] |
/etc/caddy/Caddyfile |
Managed Caddyfile. |
node['hello_world_website']['caddy']['site_address'] |
:80 |
Caddy site address. |
node['hello_world_website']['caddy']['copr_repo_file'] |
/etc/yum.repos.d/_copr:copr.fedorainfracloud.org:group_caddy:caddy.repo |
COPR repository file used to keep enabling the repository idempotent. |
node['hello_world_website']['site']['root'] |
/var/www/hello_world_website |
Document root. |
node['hello_world_website']['site']['title'] |
Hello World |
Page heading. |
node['hello_world_website']['site']['message'] |
The hello_world_website cookbook is deployed. |
Page message. |
Title, message, hostname, and FQDN are HTML-escaped before they reach the page.
Usage
The cookbook is designed for a Policyfile, but works with any run list:
# Policyfile.rb name 'hello_world_website' default_source :supermarket run_list 'hello_world_website::default' cookbook 'hello_world_website', path: '.'
Pin a version when reproducibility matters:
default['hello_world_website']['caddy']['version'] = '2.11.9'
On Debian and Ubuntu the package starts Caddy by itself; on Rocky the cookbook
enables and starts it explicitly.
What gets deployed
- The Caddyfile at
/etc/caddy/Caddyfileis written from a template and only replaces the live file aftercaddy validate --adapter caddyfilesucceeds. -
/var/www/hello_world_website/index.htmlis a self-contained page showing the cookbook name, its version, and the node's hostname, FQDN, and platform. - Every response carries:
X-Cookbook: hello_world_website
X-Cookbook-Version:
X-Hostname:
The headers are set on every response of the site block, including errors,
so X-Hostname also varies per node in shared caches.
- Caddy is reloaded (never restarted) when the Caddyfile or the page changes. Access logs are emitted as JSON to the journal.
- A systemd drop-in at
/etc/systemd/system/caddy.service.d/10-config-path.confpointsExecStartandExecReloadatconfig_path, so overriding the attribute actually moves the file Caddy reads. - After starting Caddy the converge re-checks that the unit stays active, so a unit that dies right after start (for example because port 80 is already in use) fails the run instead of reporting a successful deploy.
The page content is deterministic: no timestamps, so a second converge changes
nothing. Cookbook version is read from metadata.rb at converge time, so it
cannot drift.
Testing
The tests need Cinc Workstation and Docker.
chef exec rake # Cookstyle + ChefSpec chef exec rake integration # full three-platform Kitchen matrix chef exec rake cleanup # destroy leftover instances and artifacts
kitchen test destroys each instance after a run, including on failure. If a
run is interrupted, rake cleanup removes leftover containers, sandboxes,
.kitchen/, and test artifacts.
ChefSpec covers the Debian, Ubuntu, and RHEL branches, plus the
unsupported-family failure. Fauxhai bundles no Debian 13, Ubuntu 26.04, or
Rocky 10 data, so the examples use Debian 12, Ubuntu 24.04, and Rocky 9
stubs, which keeps the unit suite offline; the recipe branches on platform
family only. Kitchen runs the real target versions.
The InSpec profile is at test/integration/default/controls/default_test.rb
and asserts the package, the enabled and running service, a valid Caddyfile,
the document root's ownership and mode, port 80, the page body, and all three
provenance headers.
For local Kitchen runs against Docker Desktop, point dokken at the user socket:
DOCKER_HOST=unix://$HOME/.docker/run/docker.sock chef exec kitchen test
License
Apache-2.0. See [LICENSE](LICENSE).
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Changelog
All notable changes to this cookbook are documented here. The format follows
Keep a Changelog and this project
adheres to Semantic Versioning.
Unreleased
0.1.0 - 2026-11-11
Added
- Initial cookbook: installs Caddy from the official Cloudsmith APT repository
(Debian 13, Ubuntu 26.04) or the official
@caddy/caddyCOPR repository (Rocky Linux 10.2). - Validated Caddyfile, deterministic deployment-proof page with HTML escaping,
and
X-Cookbook/X-Cookbook-Version/X-Hostnameresponse headers. - ChefSpec unit tests, an InSpec profile with seven controls, a three-platform Kitchen matrix, and a GitHub Actions pipeline.
- Optional Caddy version pin, configurable site address, document root, title, and message.