Penstock

Guide / Test and run

Deployment

Deploy sends the diagram you are editing to the engine your project names, after one more click that shows exactly what will go where.

Free Camunda 7, Camunda 8, Operaton or CIB seven

Deploy from the editor

  1. Open a diagram, a decision or a form.
  2. Press Deploy on the right of the toolbar. A popover opens under the button rather than deploying at once.
  3. Read the popover: which profile is in force, where it will go, and which files will be sent. Pick another profile if you need to, or press Edit connection… to set the address first.
  4. Press Deploy. A notification says where the file went, or what the engine answered.

Deploy sends the state of the canvas, including edits that have not reached the disk yet. The DMN and form editors have the same button, and the result is still a notification. Under the Classic BPMN profile there is no deployment target, so there is no button. See Engines.

The Deploy popover open under the Deploy button. The field Profile is set to default, the Engine address is http://localhost:8090/v2, What will be sent lists order-to-cash.bpmn, shipping-decision.dmn and invoice-approval.form, and Edit connection and Deploy are at the foot
The popover. It shows the profile, the engine address and the files it will send before anything is deployed.

What the popover tells you

ProfileWhich one is in force, and every other profile in the file, so a diagram can go to staging without changing what is in force. See Profiles.
Engine addressWhere it will go, or Not set yet.
What will be sentThe files, by name, with a count for the rest. For a diagram that is the diagram and nothing else.
Edit connection…Opens the Connection dialog for the profile you picked.
DeploySends, to the profile you picked.

The Connection dialog

It opens from Edit connection… in the popover, and it opens by itself the first time you deploy to a profile that has no engine address, or whose sign-in has no password or secret yet. Its title names the engine and the profile, for example Camunda 8 · prod.

FieldWhat to enter
Engine addressThe REST address of the engine. Required. http or https. Camunda 7, Operaton and CIB seven: for example http://localhost:8080/engine-rest. Camunda 8: the address of the REST API, for example http://localhost:8080 or http://localhost:8080/v2.
Sign inNot needed, User and password, or OAuth client.
User, PasswordFor User and password. Sent as HTTP Basic.
Client id, Client secret, Token address, AudienceFor OAuth client. Penstock uses the client credentials grant. The audience is optional.

Opened from Edit connection… the dialog offers Save, which only saves, and Save and Deploy. Opened by a deploy, because nothing is set up yet, it offers Save and Deploy alone. If something is missing, the dialog says what is still needed, under the field, with a red outline once you have left it.

Where it is kept

What is set in penstock.yaml

Everything else about a deployment belongs to the project, not to the dialog. A profile can override any of it for another environment.

deployment:
  url: http://localhost:8080/engine-rest
  name: Order handling
  tenantId: orders
  changedOnly: true

profiles:
  prod:
    deployment:
      url: https://bpm.example.com/engine-rest
      auth:
        type: oauth
        clientId: penstock
        tokenUrl: https://auth.example.com/oauth/token

hooks:
  preDeploy: npm run verify-workers
  postDeploy: ./notify-release.sh
nameDefault Penstock deployment. Keep it the same between deployments, so the engine's duplicate check can match one to the next.
sourceDefault penstock.
tenantIdEmpty means the default tenant.
changedOnlyLeaves out what the engine already has, unchanged. On unless false.
forTestsMarks an engine that test-case runs may deploy to and answer jobs on. See Scenarios.
activationTimeAn ISO 8601 timestamp. Empty means at once. Camunda 7 family.

What is sent

One multipart/form-data POST with the file as a single part, named after the file. Its type is application/xml, or application/json for a form. Nothing else from the project goes with it. OAuth makes one more request first: the token request.

Camunda 7, Operaton, CIB seven/deployment/create is added to the address. Name, source, tenant and activation time go as form fields. changedOnly sets both enable-duplicate-filtering and deploy-changed-only.
Camunda 8/v2/deployments is added to the address. An address that already ends in /v2 works too. The file goes as resources, with tenantId beside it when set.

Every tool uses the same addresses and settings, so an editor and a pipeline mean the same thing by deployment.url.

How the request is made

The request is made by the host process, not by the browser built into your tool, so no CORS configuration is needed on the engine. The address, the sign-in type, the user name, the client id, the token address and the audience go to penstock.local.yaml, under the profile's name when a profile is in force, which stays on this machine and is added to .gitignore. The password or client secret goes to the secret store of your tool, separately for each profile, and the dialog only says that one is stored rather than reading the value back out. A password: key in penstock.local.yaml is not read; a password comes from PENSTOCK_PASSWORD or from the secret store.

OAuth

Penstock first sends grant_type=client_credentials with the client id and secret to the token address, as a form. It reads access_token from the JSON answer and uses it as a bearer token on the deployment. The audience is sent only if you fill it in. If the token endpoint cannot be reached, answers with an error, or sends no access token, the deployment stops and the error says which. The token request times out after 15 seconds.

On the command line use auth.type: oauth and set the secret in PENSTOCK_CLIENT_SECRET. PENSTOCK_TOKEN, if set, is used as a bearer token instead. PENSTOCK_PASSWORD is the password for basic sign-in.

Hooks

preDeploy and postDeploy run around every deployment, from the editor and from the command line. They run in the project root and see PENSTOCK_FILES, PENSTOCK_ROOT, PENSTOCK_STAGE and PENSTOCK_PROFILE. A preDeploy that fails stops the deployment, and nothing is sent. postDeploy runs after a successful one. Where a tool has a notion of a trusted project, hooks run only in a trusted project. In a project that is not trusted, a configured preDeploy is not run, and the deployment stops rather than go ahead without it.

Deploy more than one file

Deploying sends the files of a project grouped by the target each folder asks for: files from folders whose penstock.yaml names another engine go to that engine. You can also send every diagram to one profile at once, after a confirmation.

Deploy many files in your tool

JetBrains

In the Penstock tool window: right-click a file or a process and press Deploy. It goes to that file's profile. Right-click a profile under Deployment to send every diagram to it. Hooks run only in a trusted project, and the password comes from the IDE password safe.

VS Code

In the Penstock view: right-click a file or a process row and press Deploy. Under Deployment, right-click a profile to send every diagram to it. Hooks run only in a trusted workspace, and credentials come from VS Code's secret storage.

Command line

$ penstock deploy . --dry-run
would send 3 file(s) to http://localhost:8080/v2/deployments as "order-example"
      src/main/resources/approve-order.form
      src/main/resources/order-process.bpmn
      src/main/resources/shipping-method.dmn
  • --dry-run says where, and sends nothing. Try it first in a new pipeline.
  • --wait asks the engine until it shows the definitions.
  • Secrets come from PENSTOCK_PASSWORD, PENSTOCK_CLIENT_SECRET and PENSTOCK_TOKEN. Any PENSTOCK_* variable that matches a setting overrides it for the run.

See Every command.

Feedback and errors

SuccessDeployed order-process.bpmn as order-process v3 on http://localhost:8080
The engine said noOne line for each file it refused and why, rather than a list of element errors. The editor's message offers Edit connection when the engine answered 401 or 403; the command line says what to set.
Not signed inAn answer of 401 or 403 means the address or the credentials are wrong. In a terminal, set deployment.auth in penstock.local.yaml, or PENSTOCK_PASSWORD, PENSTOCK_CLIENT_SECRET or PENSTOCK_TOKEN.
Not reachableCould not reach the engine at <url>.
No addressThe message says so and points at deployment.url or the Connection dialog.
preDeploy failedThe preDeploy hook failed, nothing was sent. The hook's output follows.
Not confirmedWith --wait: The engine took the deployment but did not show its definitions in time. Penstock waited 30 seconds per definition.
Timeouts10 seconds to connect, 30 seconds for the deployment request.

What you see

Common problems

Deploy is not on the toolbar.
The engine is Classic, or not set. Set engine in penstock.yaml. See Engines.
Every deploy is a new version.
The engine's duplicate check matches by name. Keep deployment.name the same, and leave changedOnly on.
The editor says 404 or the wrong path on Camunda 8.
Use the address of the REST API. Penstock adds /v2/deployments. If your address already ends in /v2, that is fine too.
The engine has a private certificate.
Penstock does not skip certificate checks. Trust the certificate in the runtime of your tool. See the troubleshooting page of your tool.
A wrong password is saved.
Press Deploy, then Edit connection…, type the right one and save.
There is no Deploy button.
The profile is Classic BPMN, which has no engine behind it. Set engine in penstock.yaml.
Nothing is deployed when I press Deploy.
It opens the popover on purpose. Press Deploy in the popover to send.