Skip to content

Create Resources

The Flowcore CLI allows you to create resources in Flowcore using a manifest file. This is useful for creating multiple resources at once, or for creating resources in a CI/CD pipeline.

Data Cores

To create a data core, you can use the apply command with a manifest file. The manifest file should be in YAML format.

tenant: example-tenant
dataCore:
name: example-data-core
description: "An example data core"
flowTypes:
example:
description: "An example flow type"
eventTypes:
example.event.0:
description: "An example event"

to generate a manifest file, you can use the generate command:

Terminal window
flowcore data-core generate manifest -t example-tenant --placeholder

this will generate a flowcore.yaml file, then run the following command to apply the manifest file

Terminal window
flowcore data-core apply -f flowcore.yaml

this will create a plan to create the data core, and then apply the plan to create the data core.

Scenarios

To create a scenario, you can use the apply command with a manifest file. The manifest file should be in YAML format.

tenant: example-tenant
scenario:
name: example-scenario
description: "An example scenario"
transformers:
example-transformer:
description: "An example transformer"
dataCore: example-data-core
flowType: example
events:
- example.event.0
parameters:
- name: PROXY_ENDPOINT
type: manual
value: "https://example.com"
blueprint:
artifactUrl: "https://flowcore-public-runtimes.s3.eu-west-1.amazonaws.com/transformer-proxy-1.1.0.zip"

to generate a manifest file, you can use the generate command:

Terminal window
flowcore scenario generate manifest -t example-tenant --placeholder

this will generate a flowcore.yaml file, then run the following command to apply the manifest file

Terminal window
flowcore scenario apply -f scenario.yaml

this will create a plan to create the scenario, and then apply the plan to create the scenario.

Apply all resources

You can also apply all resources in a manifest file at once by using the root apply command:

Terminal window
flowcore apply -f manifest.yaml

Delete Protection

By default, data cores are created without delete protection enabled. You can enable delete protection by setting deleteProtection to true for each resource in the manifest file.

tenant: example-tenant
dataCore:
name: example-data-core
deleteProtection: true

Keep in mind that if delete protection is enabled on a resource all nested resources will also have delete protection enabled. To delete a resource with delete protection enabled, you must first disable delete protection.

Transformer Size

By default, transformers are created with a size of SMALL. You can set the size of the transformer by setting the size field to SMALL, MEDIUM or LARGE or XLARGE in the manifest file.

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
size: "medium"

This will set the resource requirements for the transformers. The size of the transformer will determine the amount of CPU and memory allocated to the transformer.

Page Size

By default, transformers are created with a page size of 1000. You can set the page size of the transformer by setting the pageSize field to a number in the manifest file.

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
pageSize: 5000

Default Start Date

By default, transformers are created with a default start date of 7 days. You can set the default start date of the transformer by setting the defaultStartDateTime field to a number in the manifest file.

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
defaultStartDateTime: "2024-04-09T11:01:57Z"

This will set the default start date of the transformer to selected ISO start time.

Concurrency

By default, transformers are created with a concurrency of 1. You can set the concurrency of the transformer by setting the concurrency field to a number in the manifest file.

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
concurrency: 5

This will set the number of concurrent executions of the transformer.

Replicas

By default, transformers are created with a single replica. You can set the number of replicas of the transformer by setting the replicas field to a number in the manifest file.

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
replicas: 3

This will determine the number of replicas of the transformer.

Private Github Artifacts

If you want to use a private Github artifact, you can add the following to the manifest file:

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
blueprint:
artifactUrl: "https://github.com/flowcore-io/flowcore-public-runtimes/releases/download/v1.0.0/transformer-proxy-1.0.0.zip"
githubPATSecretName: "github-pat"

This will use the Github PAT stored as an organization secret to download the artifact.

To create a Github PAT secret, you can use this link (https://github.com/settings/tokens/new) to create a new token. You need to have the repo scope to be able to download the artifact. then you can add the secret to the github repository using the following command:

Terminal window
flowcore auth new secret "github-pat" --from-literal=<your-pat> --tenant <tenant-name>

Endpoints

To add an endpoint to a transformer, you can add the this to the manifest file:

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
endPoint:
name: example-endpoint
type: "DATA_CORE"
definition:
dataCore: some-data-core
flowType: some-flow-type
eventType: some-event-type

This will set up an endpoint for the transformer that will send data returned from the transformer to the specified data core.

To create a read model endpoint, you can add the following to the manifest file:

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
endPoint:
id: 559d9980-0630-4d0f-8ba0-921a944310b2 # visible in the UI, info icon next to the read model name
name: example-endpoint # name of the table in the database
type: "POSTGRES" # or "MYSQL"
definition:
blueprint:
"example_column":
type: "string" # or "text" or "integer" or "decimal" or "boolean"
length: 255 # optional
matchKey: "some-key"
onMatch: "skip" # or "update"

This will set up an endpoint for the transformer that will send data returned from the transformer to the specified database.

Advanced Configuration

Shell

You can customize what shell container is used for the transformer by adding the following to the manifest file:

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
shell: "example-shell:tag"

This will use the specified shell container to run the transformer.

Entrypoint

You can customize what entrypoint is used for the transformer by adding the following to the manifest file:

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
blueprint:
entrypoint: "dist/main.js"

This will use the specified entrypoint to run the transformer.

Runtime

You can customize what runtime is used for the transformer by adding the following to the manifest file:

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
blueprint:
runtime: "node"

this will use the specified runtime to run the transformer.

Timeouts

You can customize what timeouts are used for the transformer by adding the following to the manifest file:

tenant: example-tenant
scenario:
name: example-scenario
transformers:
example-transformer:
processingTimeout: <timeout in seconds>
blueprint:
processTimeout: <timeout in seconds>
startTimeTimeout: <timeout in seconds>

This will set the timeout for the transformer.