Skip to content

Latest commit

 

History

History
88 lines (68 loc) · 3.2 KB

File metadata and controls

88 lines (68 loc) · 3.2 KB

Temporal Jumpstart:Onboardings

Product Requirements

Checkout the Product Requirements Document here

  • Configure .env
  • Install dependencies with npm install

Running The Application

In separate terminals:

  1. Temporal Server: temporal server start-dev
  2. Starter API: npm run api
  3. Worker:
    1. LOCAL environment: npm run domain:local
    2. NON-LOCAL environments or for local validation of builds: npm run domain
      1. See Non-Local Environments

Non-Local Environments

There are a few preparatory tasks required to run a Temporal TypeScript SDK Application in a production, staging, etc environment.

  • Implement appropriate DataConverter interfaces
    • Expose these implementations to the respective Temporal SDK Clients (Worker and Starter).
  • Bundle Workflow code for reference in the Worker options.
    • See the script included in this project for an example.

HTTPS Everywhere

You might need to run your API with SSL. The excellent mkcert project can simplify creation and management of certificates to get started with secure connections everywhere.

  1. Install mkcert.
  2. mkcert -install (this just installs the CA to your system)
  3. mkcert -client localhost (this makes all our localhost servers ok for HTTPS)
    1. Note that it creates localhost-client.pem and localhost-client-key.pem files in our root dir.
    2. Update your .env file paths for both API_CONNECTION_MTLS_KEY_FILE and API_CONNECTION_MTLS_CERT_CHAIN_FILE variables.
    3. We will use these from our different servers to serve over https where needed

Verifying The Things

Tests

Run tests with npm test. This runs a series of tests across the API, Workflows, and Activities.

Start Onboarding An Entity

Now try out the provided OnboardEntity to verify the stack. It supports a PUT and GET to verify Executing and Querying a Workflow.

With all three servers running you should be able to issue the following requests to confirm your setup.

Start Onboard Entity

export PUBLIC_API_URL="http{s}://localhost:3000/api"

curl -X PUT "$PUBLIC_API_URL/v1/onboardings/customer_123" \
-H "Content-Type: application/json" \
-d '{"id": "customer_123", "value": "Bob Smith"}'

should respond with 202 Accepted

Read Entity Onboarding

export PUBLIC_API_URL="http{s}://localhost:3000/api"

curl -X GET "$PUBLIC_API_URL/v1/onboardings/customer_123"

should respond with something like

{
  "id":"customer_123",
  "status":"1",
  "sentRequest":{
      "id":"customer_123",
      "value":"Bob Smith",
      "deputyOwnerEmail":"",
      "completionTimeoutSeconds":60,
      "skipApproval":false
  },
  "approval":{"status":"PENDING","comment":""}
}