Add a Site Producer
Add a Site Producer
Section titled “Add a Site Producer”Use this when something new should appear on the operator’s site: release
notes, proposals, a status page. The new code makes pages. It does not
clone, commit to or deploy the site, because bob site publish does that for
every producer (#3103). The contract is in the
Site Publish reference.
1. Declare the section
Section titled “1. Declare the section”Add the section to config/site-publish.json in the operator repo. Decide
whether it is private or public:
"sections": { "bob/briefings": { "gated": true, "access_application": "iwpi.com", "producer": "bob brief" }, "bob/releases": { "public": true, "producer": "bob release" }}A private section needs the Access application to cover the section path on every host the site answers on. The publisher probes each one before it publishes. Commit the change in the operator repo, then validate it:
node scripts/checks/check-operator.js "$(bob operator show --json | jq -r .root)"2. Build a bundle
Section titled “2. Build a bundle”Generate pages that name the operator’s projects, clients or people in the
operator repo, never in the BoB source checkout, so a BoB release never ships
them. bob brief does this: its pages live in the operator repo’s
www/bob/briefings/, reached through operatorPath('brief-pages') (#4263).
Add a name for your directory in OPERATOR_DATA
(scripts/lib/operator-resolve.js) the same way.
Write the pages into a directory, beside a bundle.json:
mkdir -p /tmp/releases-bundlecp dist/releases/*.html /tmp/releases-bundle/cat > /tmp/releases-bundle/bundle.json <<EOF{ "schema": "site-publish/1", "section": "bob/releases", "producer": "bob release", "source_commit": "$(git rev-parse HEAD)", "generated_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)", "files": [$(cd /tmp/releases-bundle && ls *.html | sed 's/.*/"&"/' | paste -sd, -)]}EOFIn code, build the same object and call the engine directly, as
scripts/brief/publish.js does:
const site = require('../site/publish');const r = site.run({ bundle, dir, apply, deploy, env });3. Check it
Section titled “3. Check it”bob site publish /tmp/releases-bundleThe report lists every file as added, updated or unchanged. It also shows the
deploy account and, for a gated section, each probed host as gated or
EXPOSED. It ends with what --apply would do. Fix any refusal it names. An
EXPOSED host means a change to the Access application, not a change to the
producer.
4. Publish
Section titled “4. Publish”bob site publish /tmp/releases-bundle --applyIt commits, pushes and deploys. Running it again with the same files commits
nothing. If the deploy fails after the push (exit 4), run it again with
--apply --deploy.