Skip to content

M0-S2 — The master’s workbench: Larkspur Dev and Larkspur Lab

Section titled “M0-S2 — The master’s workbench: Larkspur Dev and Larkspur Lab”
ModuleM0 — Start here
After this session you canRebuild 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.
TimeFacilitated: 57 min · On your own: 57 min
Before you startM0-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 deeperRunning 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.

WindowWhat it shows youWhereYour tool
The APIWhat a program sees: definitions, records, answers and errorsBothcurl and jq with the workbench credential
The logsWhat each service did with one request or message, found by its correlation idLabkubectl logs, filtered by the id
The bus tapEvery message a service publishes, copied into a queue of your ownLabRabbitMQ’s tracer and its management API
The record storeDefinitions and records exactly as MongoDB holds themLabmongosh, reads only
The portalWhat people see: the designer, the records, the run historiesBothYour 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)

  1. 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.yaml
    kind create cluster --config kind-lk-lab.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
    kubectl wait -n ingress-nginx --for=condition=ready pod -l app.kubernetes.io/component=controller --timeout=180s
  2. Start the datastores and make MongoDB a one-member replica set, exactly as in ACDE:

    Terminal window
    kubectl apply -f datastores.yaml
    kubectl -n datastores wait --for=condition=ready pod --all --timeout=300s
    kubectl -n datastores exec mongo-0 -- mongosh --quiet --eval \
    'rs.initiate({_id:"rs0",members:[{_id:0,host:"mongo-0.mongo.datastores.svc.cluster.local:27017"}]})'
  3. 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; do
    sed -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"
    done
    diff nw-values.yaml lk-values.yaml
    export values="-f lk-values.yaml -f lk-secrets.yaml -f pack-values.yaml"
    helm lint ./osos $values

    The diff shows only names changing. helm lint reports 0 chart(s) failed.

  4. 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 larkspur
    helm install lk ./osos -n larkspur $values --wait --timeout 20m
  5. Run the short smoke test you wrote in ACDE: helm status lk -n larkspur says deployed; kubectl -n larkspur get pods,jobs shows every pod ready and both Jobs Complete.

Part B: load the suite

  1. Give the operator account a password through Forgot password? at http://localhost and the email in Mailpit, as in ACDE M2-S2 steps 10 to 12, with operator@larkspur.example.com. Keep Mailpit’s port-forward running in its own terminal.

  2. 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.com
    read -rs LK_ADMIN_PASSWORD && export LK_ADMIN_PASSWORD # type the password you just set
    read -rs ACM_LEARNER_PASSWORD && export ACM_LEARNER_PASSWORD # choose Rami Aziz's password
    node larkspur-pack/seed/seed.mjs --base-url http://localhost

    It ends with Larkspur suite ready, followed by counts of what it created.

  3. In a private browser window, open http://localhost, sign in as rami.aziz with 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

  1. 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://localhost
    read -rs TOKEN && export TOKEN # paste the token
    curl -s -H "x-app-token: $TOKEN" "$BASE/api/v1/data-module" | jq '.success, [.result[].normalizedName]'

    You see true, then a list that includes supplier_management, procurement, asset_maintenance and quality_compliance.

  2. 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-001

    At least two pods log the id: the gateway and the data pod.

  3. 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 the lk virtual host and bind your tap queue:

    Terminal window
    kubectl -n datastores exec deploy/rabbitmq -- rabbitmqctl trace_on -p lk
    R="-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.#"}'
  4. 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.

  5. 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, its dataEntity, its state and an updateInfo stamped with the time of your save.

  6. 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.

  7. Switch the tracer off until you need it again: kubectl -n datastores exec deploy/rabbitmq -- rabbitmqctl trace_off -p lk. Keep the acm-tap queue; later labs reuse it.

Check.

  • helm status lk -n larkspur shows deployed, and every pod in larkspur is ready.
  • You signed in to Larkspur Lab as rami.aziz and 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 seeWhat to do
kind create cluster says the ports are in useYour 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 expectYour 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 failureUse 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 401The operator’s password in LK_ADMIN_PASSWORD is wrong, or the reset in step 6 did not complete.
The seed stops with 403The account is not the operator account the migration created. Check LK_ADMIN_EMAIL against the superAdminEmail value in lk-values.yaml.
No workbench token emailThe 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 9The 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 10Widen --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 nullThe 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, named lk-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 whose correlationId is lk-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: { … } } }, with doneAt a few minutes ago and doneBy pointing 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”
PracticeChoose one answer.

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?

  1. Explanation for A

    ✓ Correct

    Correct: the tracer copies every published message into your own queue, so the platform’s consumers are untouched. See Two environments, five windows.

  2. Explanation for B

    ✗ Incorrect

    Not this one: it can show them, but by taking them from the queue, which is the problem. See Two environments, five windows.

  3. Explanation for C

    ✗ Incorrect

    Not this one: the tap shows what is published; there is no “answer” message to see. See Two environments, five windows.

Check your answer

The correct answer is A. Open the explanation under each option to see why.

PracticeChoose one answer.

While reading a work order in mongosh, you notice a typo in its title. What do you do?

  1. Explanation for A

    ✗ Incorrect

    Not this one: a direct write skips the platform’s validation, history, events and search update. See Two environments, five windows.

  2. Explanation for B

    ✓ Correct

    Correct: changes go through the platform so that every engine sees them; the record store window is read-only. See Two environments, five windows.

  3. Explanation for C

    ✗ Incorrect

    Not this one: lab records change like any others, through the portal or the API. See Rebuild the lab, load Larkspur, open the windows.

Check your answer

The correct answer is B. Open the explanation under each option to see why.

PracticeChoose one answer.

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?

  1. Explanation for A

    ✗ Incorrect

    Not this one: an application token is checked without the scheduler, which runs timed work, not requests. See ACDE M1-S2: north-south.

  2. Explanation for B

    ✗ Incorrect

    Not this one: a read is answered over HTTP and the datastores do not write your log lines. See ACDE M1-S2: north-south.

  3. Explanation for C

    ✓ Correct

    Correct: the gateway stamps or keeps the id, and every service the request reaches logs it. See ACDE M5-S2: the correlation id.

Check your answer

The correct answer is C. Open the explanation under each option to see why.

PracticeChoose one answer.

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?

  1. Explanation for A

    ✓ Correct

    Correct: the workbench grant is a lab convenience; a production reader gets only what it reads, as ACE taught. See ACE M5-S1: reading through a view.

  2. Explanation for B

    ✗ Incorrect

    Not this one: it cannot sign in, but its token can change everything its Edit grant covers. See Two environments, five windows.

  3. Explanation for C

    ✗ Incorrect

    Not this one: rotating a token does not narrow what it can do while it is valid. See ACE M5-S1: the credential.

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.