Skip to main content

Deploying a worker

In this step, you will deploy the worker to Taskurai.

Before a worker can run locally, an initial deploy to Taskurai must be done.

Prerequisites

Setup the configuration file

  1. Go to the taskurai-workers folder you created in the Worker Setup step.

  2. Run the taskurai command to create an empty solution file:

taskurai
  1. Copy the installation information from your Taskurai setup to the solution file:
taskurai-workers/Taskurai.yaml
options:
taskurai:
accountId: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
instanceId: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
deployment:
deploySecrets: false
state:
defaultStateStore: DefaultStateStore
hubs:
DefaultHub:
description: Default Compute and State Hub
type: External
kind: AzureManagedHub
stateStores:
DefaultStateStore:
type: DefaultStateStore
kind: Dedicated
hub: DefaultHub
environment:
- name: accountName
secretReference:
value: default
- name: storageTier
secretReference:
value: Standard_LRS
- name: containerName
secretReference:
value: default

Add worker configuration

Add the secrets and worker to the configuration file. Replace the container registry with the loginServer you created earlier, both in the name of the image as the server:

taskurai-workers/Taskurai.yaml
options:
taskurai:
accountId: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
instanceId: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
deployment:
deploySecrets: false
state:
defaultStateStore: DefaultStateStore
secrets:
- containerregistrypassword
hubs:
DefaultHub:
description: Default Compute and State Hub
type: External
kind: AzureManagedHub
stateStores:
DefaultStateStore:
type: DefaultStateStore
kind: Dedicated
hub: DefaultHub
environment:
- name: accountName
secretReference:
value: default
- name: storageTier
secretReference:
value: Standard_LRS
- name: containerName
secretReference:
value: default
workers:
TestWorker:
container:
imageName: taskuraitestworker
image: myuniqueregistrysample.azurecr.io/taskuraitestworker:latest
resourceAllocation: Cpu_0_25_Memory_0_5Gi
server: myuniqueregistrysample.azurecr.io
userName: taskuraipulltoken
passwordSecretReference: containerregistrypassword
scaling:
scaleOutTaskCount: 100
minInstances: 0
maxInstances: 2
secrets:
- name: containerregistrypassword
secretReference: containerregistrypassword
options:
hub: DefaultHub
cleanupCompletedTasksAfterSeconds: 2592000
tip

The username to authenticate to the registry is the name of the token you created in the previous step.

Notice we added a Taskurai secret and a reference to this secret in the worker configuration.

Create a secret

Create a Taskurai secret containing the token password you created in the previous step. You can choose either password 1 or 2:

taskurai secret create --name containerregistrypassword --value "XXX1..."
note

You only need to create this secret once. When the password is regenerated, you can update the secret using the taskurai secret update command.

Deploy worker to Taskurai

Next, deploy the worker to Taskurai using the CLI:

taskurai worker deploy
info

Workers do not automatically pull new container images.

To update the worker to a new container image, redeploy the worker (and update the tag if changed).

Testing your setup

To verify that the worker has been successfully deployed to Taskurai, use the following command:

taskurai worker show --name TestWorker

When the deployment is successful, you should see output similar to the following:

# Signed into Taskurai

TestWorker
├── General
│ └── ╭──────────────────────┬────────────╮
│ │ Setting │ Value │
│ ├──────────────────────┼────────────┤
│ │ Name │ TestWorker │
│ │ Provisioning State │ Succeeded │
│ │ Import Configuration │ null │
│ ╰──────────────────────┴────────────╯
├── Container
│ └── ╭───────────────────────────┬─────────────────────────────────────────────────────────────╮
│ │ Setting │ Value │
│ ├───────────────────────────┼─────────────────────────────────────────────────────────────┤
│ │ Image Name │ taskuraitestworker │
│ │ Image │ myuniqueregistrysample.azurecr.io/taskuraitestworker:latest │
│ │ Resource Allocation │ Cpu_0_25_Memory_0_5Gi │
│ │ Server │ myuniqueregistrysample.azurecr.io │
│ │ User Name │ taskuraipulltoken │
│ │ Password Secret Reference │ containerregistrypassword │
│ ╰───────────────────────────┴─────────────────────────────────────────────────────────────╯
├── Scaling
│ └── ╭──────────────────────┬───────╮
│ │ Setting │ Value │
│ ├──────────────────────┼───────┤
│ │ Scale Out Task Count │ 100
│ │ Min Instances │ 0
│ │ Max Instances │ 2
│ ╰──────────────────────┴───────╯
├── Secrets
│ └── ╭───────────────────────────┬───────────────────────────┬────────────┬──────────╮
│ │ Name │ SecretReference │ Value │ Imported │
│ ├───────────────────────────┼───────────────────────────┼────────────┼──────────┤
│ │ containerregistrypassword │ containerregistrypassword │ ********** │ null │
│ ╰───────────────────────────┴───────────────────────────┴────────────┴──────────╯
├── Environment
│ └── ╭─────────────╮
│ │ Environment │
│ ╰─────────────╯
├── Commands
│ └── ╭──────────╮
│ │ Commands │
│ ╰──────────╯
└── Options
└── Options
├── General
│ └── ╭───────────────────────────────────────┬───────────────────╮
│ │ Setting │ Value │
│ ├───────────────────────────────────────┼───────────────────┤
│ │ Auto Register Commands │ true
│ │ Cleanup Completed Tasks After Seconds │ 2592000
│ │ Cleanup State After Seconds │ null │
│ │ Command Stale Timeout Seconds │ 60
│ │ Command Timeout Seconds │ 300
│ │ Default State Store │ DefaultStateStore │
│ │ Inline Step Retry Delay Threshold Sec │ 60
│ │ Max Concurrent Tasks │ 1
│ │ Queue Reader Idle Interval Msec │ 1000
│ │ Queue Reader Interval Msec │ -1
│ │ Use System Assigned Identity │ null │
│ │ Stale Tasks After Seconds │ 3600
│ │ Hub │ DefaultHub │
│ │ Workload Profile Name │ null │
│ ╰───────────────────────────────────────┴───────────────────╯
└── User Assigned Identities
└── ╭────────────────────────╮
│ UserAssignedIdentities │
╰────────────────────────╯

That's it! You have successfully deployed a worker to Taskurai.