M0-S2 — The master’s workbench: Larkspur Dev and Larkspur Lab
Section titled “M0-S2 — The master’s workbench: Larkspur Dev and Larkspur Lab”| Module | M0 — Start here |
| After this session you can | Rebuild your lab cluster with the Larkspur suite, reach Larkspur Dev, and open every window onto the engine the course uses: logs, the bus, stored records and the API. |
| Time | Facilitated: 57 min · On your own: 57 min |
| Before you start | M0-S1. The files you kept from ACDE’s lab (kind-nw-lab.yaml, datastores.yaml, nw-values.yaml, nw-secrets.yaml, pack-values.yaml and the unpacked chart); the Larkspur course pack and your Larkspur Dev address from your training provider. |
| Go deeper | Running locally · Observability · Backend quickstart |
◆ Orientation (1 min) — Evidence, not belief
Section titled “◆ Orientation (1 min) — Evidence, not belief”Everything in this course ends in something you can see. When a session says that saving a work order publishes an event, you watch the event go past. When it says a record keeps its workflow state inside its value, you read the stored record. A master who can show the evidence is believed; one who repeats what the documentation says is not, especially on the day the documentation is wrong.
This session sets up the instruments. You rebuild your lab cluster from ACDE with the Larkspur suite on it, check that you can reach your practice space, and open five windows onto the engine. You will use the same five windows, with the same commands, in every engine lab from M2 to M9. They are collected on one page in the workbench job aid.
▤ Concept (3 min) — Two environments, five windows
Section titled “▤ Concept (3 min) — Two environments, five windows”Larkspur Dev is the practice space your training provider gives you. You are its system administrator, and it has a function builder, so you build, deploy Functions and call the API there. You cannot see its servers. Larkspur Lab is your own cluster, so there you can see everything: pods, logs, the message bus and the database. The two run the same suite with the same fictional data, so a record you find in one has a twin in the other.
| Window | What it shows you | Where | Your tool |
|---|---|---|---|
| The API | What a program sees: definitions, records, answers and errors | Both | curl and jq with the workbench credential |
| The logs | What each service did with one request or message, found by its correlation id | Lab | kubectl logs, filtered by the id |
| The bus tap | Every message a service publishes, copied into a queue of your own | Lab | RabbitMQ’s tracer and its management API |
| The record store | Definitions and records exactly as MongoDB holds them | Lab | mongosh, reads only |
| The portal | What people see: the designer, the records, the run histories | Both | Your browser, as Rami Aziz |
Three rules keep the windows safe. Read, never write: the platform’s database is changed only
through the platform, so the record store is for find and countDocuments, never for update or
delete; on a real system you would use an account that can only read. The tap is for the lab:
copying every message costs the broker time, so you turn it on when you need it and off afterwards.
The workbench credential is a lab credential: it belongs to an application user, Larkspur
Workbench, which the seed gives Edit on the four Larkspur modules because listing records directly
needs it (reading definitions needs only its View at system level). You only ever send it GET
requests, and it never goes near production.
Known issue (1.10). A list read by normalized name answers an empty list unless the caller has Edit at system level. Use the entity’s id in list addresses; the workbench shows how to read it.
The bus tap needs one idea you have not used before. RabbitMQ has a built-in tracer (its
“firehose”): when it is on for a virtual host, the broker also publishes a copy of every message to
an exchange called amq.rabbitmq.trace. You bind a queue of your own, acm-tap, to that exchange
and read the copies from it. The platform’s own queues and consumers are untouched, which is why you
use the tracer rather than reading from a service’s queue: a message you take from a service’s queue
is a message that service never processes.
⛏ Lab (47 min) — Rebuild the lab, load Larkspur, open the windows
Section titled “⛏ Lab (47 min) — Rebuild the lab, load Larkspur, open the windows”Goal. Release lk running in namespace larkspur on cluster lk-lab, the Larkspur suite loaded,
and each of the five windows showing its expected output.
Before you start. A terminal in a new folder, ~/acm-lab, holding copies of your ACDE lab files
and the Larkspur course pack (folder larkspur-pack/). Docker running with the resources ACDE asked
for (ACDE M0-S2: sizing). If you no longer have the ACDE files, redo
ACDE M0-S2 and ACDE M2-S1 first:
those steps are not repeated here.
Part A: the cluster and the release (recall ACDE M0-S2 and M2-S2)
-
Create the cluster and its ingress controller, renamed for Larkspur:
Terminal window sed 's/nw-lab/lk-lab/' kind-nw-lab.yaml > kind-lk-lab.yamlkind create cluster --config kind-lk-lab.yamlkubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yamlkubectl wait -n ingress-nginx --for=condition=ready pod -l app.kubernetes.io/component=controller --timeout=180s -
Start the datastores and make MongoDB a one-member replica set, exactly as in ACDE:
Terminal window kubectl apply -f datastores.yamlkubectl -n datastores wait --for=condition=ready pod --all --timeout=300skubectl -n datastores exec mongo-0 -- mongosh --quiet --eval \'rs.initiate({_id:"rs0",members:[{_id:0,host:"mongo-0.mongo.datastores.svc.cluster.local:27017"}]})' -
Derive Larkspur’s values from Northwind’s. The substitutions rename the release prefix, the database prefix, the bus’s virtual host and the operator account; every datastore address and lab password stays the same:
Terminal window for f in nw-values nw-secrets; dosed -e 's/nw-/lk-/g' -e 's/vhost: nw/vhost: lk/' -e 's#5672/nw"#5672/lk"#' \-e 's/nwoperator/lkoperator/' -e 's/northwind\.example\.com/larkspur.example.com/' \"$f.yaml" > "${f/nw-/lk-}.yaml"donediff nw-values.yaml lk-values.yamlexport values="-f lk-values.yaml -f lk-secrets.yaml -f pack-values.yaml"helm lint ./osos $valuesThe
diffshows only names changing.helm lintreports0 chart(s) failed. -
Install, and wait. The install takes ten to fifteen minutes on a laptop; read the Concept again, or the job aid, while it runs:
Terminal window kubectl create namespace larkspurhelm install lk ./osos -n larkspur $values --wait --timeout 20m -
Run the short smoke test you wrote in ACDE:
helm status lk -n larkspursaysdeployed;kubectl -n larkspur get pods,jobsshows every pod ready and both JobsComplete.
Part B: load the suite
-
Give the operator account a password through Forgot password? at
http://localhostand the email in Mailpit, as in ACDE M2-S2 steps 10 to 12, withoperator@larkspur.example.com. Keep Mailpit’s port-forward running in its own terminal. -
Run the Larkspur seed. It imports the suite’s package, then creates the people, groups, org units and fictional records. It reads every credential from environment variables:
Terminal window export LK_ADMIN_EMAIL=operator@larkspur.example.comread -rs LK_ADMIN_PASSWORD && export LK_ADMIN_PASSWORD # type the password you just setread -rs ACM_LEARNER_PASSWORD && export ACM_LEARNER_PASSWORD # choose Rami Aziz's passwordnode larkspur-pack/seed/seed.mjs --base-url http://localhostIt ends with
Larkspur suite ready, followed by counts of what it created. -
In a private browser window, open
http://localhost, sign in asrami.azizwith the password you chose, and select START USING followed by the organisation’s name. The sidebar lists Supplier Management, Procurement, Asset Maintenance and Quality and Compliance.Screenshot pending The portal's sidebar in Larkspur Lab, listing the four Larkspur modules under the organisation's name What to notice: the four modules came from one package import and one script; nothing was built by hand, which is how a lab is made repeatable.
Part C: open the five windows
-
The API. In Mailpit, open the email that holds the Larkspur Workbench token, copy the token, then delete the email. In your terminal:
Terminal window export BASE=http://localhostread -rs TOKEN && export TOKEN # paste the tokencurl -s -H "x-app-token: $TOKEN" "$BASE/api/v1/data-module" | jq '.success, [.result[].normalizedName]'You see
true, then a list that includessupplier_management,procurement,asset_maintenanceandquality_compliance. -
The logs. Send a read with a correlation id of your own, then find it in every pod:
Terminal window curl -s -o /dev/null -H "x-app-token: $TOKEN" -H "x-correlation-id: lk-m0s2-read-001" \"$BASE/api/v2/entities/work_orders/entries"kubectl -n larkspur logs -l app.kubernetes.io/instance=lk --all-containers --prefix \--since=5m --max-log-requests=30 | grep lk-m0s2-read-001At least two pods log the id: the gateway and the data pod.
-
The bus tap. Open RabbitMQ’s management port in a new terminal (
kubectl -n datastores port-forward svc/rabbitmq 15672:15672), then switch the tracer on for thelkvirtual host and bind your tap queue:Terminal window kubectl -n datastores exec deploy/rabbitmq -- rabbitmqctl trace_on -p lkR="-s -u lab:lab-only-rabbit -H content-type:application/json"curl $R -X PUT http://localhost:15672/api/queues/lk/acm-tap -d '{"durable":false,"arguments":{"x-max-length":500}}'curl $R -X POST http://localhost:15672/api/bindings/lk/e/amq.rabbitmq.trace/q/acm-tap -d '{"routing_key":"publish.#"}' -
In the portal, open Asset Maintenance › Work Orders, open Replace mechanical seal on P-101, change its Description and save. Then read what the tap caught:
Terminal window curl $R -X POST http://localhost:15672/api/queues/lk/acm-tap/get \-d '{"count":10,"ackmode":"ack_requeue_false","encoding":"auto"}' \| jq '.[] | {exchange: .properties.headers.exchange_name, keys: .properties.headers.routing_keys}'You see one or more messages published by your save, each with its exchange and routing key.
-
The record store. Read the same work order as MongoDB holds it, without changing anything:
Terminal window kubectl -n datastores exec -it mongo-0 -- mongosh --quiet lk-data --eval \'db.work_orders.findOne({"value.title": /P-101/}, {id:1, dataEntity:1, state:1, "value.title":1, updateInfo:1})'You see the record’s
id, itsdataEntity, itsstateand anupdateInfostamped with the time of your save. -
The portal, in Larkspur Dev. Open your Larkspur Dev address, sign in as
rami.aziz, and open Asset Maintenance › Work Orders. The same work order, Replace mechanical seal on P-101, is there. -
Switch the tracer off until you need it again:
kubectl -n datastores exec deploy/rabbitmq -- rabbitmqctl trace_off -p lk. Keep theacm-tapqueue; later labs reuse it.
Check.
-
helm status lk -n larkspurshowsdeployed, and every pod inlarkspuris ready. - You signed in to Larkspur Lab as
rami.azizand see the four Larkspur modules. - The API window lists the four modules’ normalized names.
- Your own correlation id appears in the gateway’s log and in the data pod’s log.
- The tap caught at least one message published by your save, and the record store shows the
save’s time in
updateInfo. - You reached the same work order in Larkspur Dev.
Pass condition. All six checks hold: the five windows are open, each with its expected output.
If something goes wrong
| What you see | What to do |
|---|---|
kind create cluster says the ports are in use | Your ACDE cluster still runs. Delete it (kind delete cluster --name nw-lab) or stop it; two kind clusters cannot both hold ports 80 and 443. |
The diff in step 3 shows a change you did not expect | Your ACDE files were edited after the course. Fix the line by hand in lk-values.yaml; only the release, database prefix, virtual host and operator should differ. |
| Any install or start-up failure | Use ACDE’s troubleshooting table for the same step: ACDE M2-S2. The causes are the same with lk in place of nw. |
The seed stops with 401 | The operator’s password in LK_ADMIN_PASSWORD is wrong, or the reset in step 6 did not complete. |
The seed stops with 403 | The account is not the operator account the migration created. Check LK_ADMIN_EMAIL against the superAdminEmail value in lk-values.yaml. |
| No workbench token email | The seed’s last lines say whether the application user was created. Open Administration › Organization › Users, open Larkspur Workbench and select Regenerate Token; a new email arrives. |
jq says Cannot iterate over null in step 9 | The call failed: run it without jq and read the error’s code and traceId. 401 means the token was mistyped. |
grep finds nothing in step 10 | Widen --since, and check the label with kubectl -n larkspur get pods --show-labels. |
The tap returns [] | The tracer is off, or you saved before binding the queue. Run step 11 again, then save again. |
findOne returns null | The work order’s title differs in your seed, or the database name is not lk-data: show dbs lists the databases with the lk- prefix. |
Model answer
A passing run, in outline:
helm status lk -n larkspur:STATUS: deployed,REVISION: 1; the same pods as your Northwind lab, namedlk-osos-….- Step 9:
true, then a list of normalized names that includes the four Larkspur modules (and the platform’s own core module). - Step 10: lines prefixed with the gateway pod and with
lk-osos-core-data-…, each a JSON object whosecorrelationIdislk-m0s2-read-001. - Step 12: one or more objects, each naming the exchange your save was published to and its routing key. Their payloads, which you read in M2-S2, carry the work order’s id.
- Step 13: a document such as
{ id: '…', dataEntity: '…', state: 1, value: { title: 'Replace mechanical seal on P-101' }, updateInfo: { doneAt: '…', doneBy: { … } } }, withdoneAta few minutes ago anddoneBypointing at Rami Aziz’s user record. - Step 14: the work order listed in Larkspur Dev, with its original description: Dev and Lab are twins, not mirrors, so your change in the Lab does not appear in Dev.
To start again from nothing at any time: kind delete cluster --name lk-lab, then repeat from step 1.
To reset only the suite’s data: node larkspur-pack/seed/seed.mjs --base-url http://localhost --reset.
✓ Practice (5 min) — Check your workbench
Section titled “✓ Practice (5 min) — Check your workbench”You want to see what the platform publishes when a purchase order is approved. A colleague suggests opening the reaction service’s queue in the management view and selecting Get messages. Why do you use the tap instead?
Check your answer
The correct answer is A. Open the explanation under each option to see why.
While reading a work order in mongosh, you notice a typo in its title. What do you do?
Check your answer
The correct answer is B. Open the explanation under each option to see why.
In step 10 you sent x-correlation-id: lk-m0s2-read-001 with a read, and two pods logged it. Which
pair do you expect, and why?
Check your answer
The correct answer is C. Open the explanation under each option to see why.
The Larkspur Workbench application user holds Edit on the four Larkspur modules in your lab. A teammate wants to use the same kind of credential for a dashboard in production. What do you say?
Check your answer
The correct answer is A. Open the explanation under each option to see why.
↺ Recap (1 min) — After Module 0 you can
Section titled “↺ Recap (1 min) — After Module 0 you can”After this module you can describe the Larkspur program and your job on it, choose your strand, and work on two environments with five windows onto the engine: the API, the logs, the bus tap, the record store and the portal. Keep the workbench job aid open from now on.
Next. In M1 you use the API and the designer to take stock of the whole suite as a program: what runs, who owns it, how it is coupled, and what could go wrong.