Skip to main content

Deploying a worker

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

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:
subscriptionId: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
resourceGroupName: rg-taskurai
location: westeurope
taskuraiName: TaskuraiSample
deployment:
deploySecrets: false

Add worker configuration

Add the worker to the configuration file. Replace the container registry with the loginServer you created earlier:

taskurai-workers/Taskurai.yaml
options:
taskurai:
subscriptionId: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
resourceGroupName: rg-taskurai
location: westeurope
taskuraiName: TaskuraiSample
deployment:
deploySecrets: false
secrets:
- containerregistrypassword
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
commands:
- testCommand
- extraCommand
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 Azure account
# Retrieved subscription XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
# Retrieved resource group rg-taskurai

TestWorker
├── General
│ └── ╭───────────────────────────────────────┬────────────╮
│ │ Setting │ Value │
│ ├───────────────────────────────────────┼────────────┤
│ │ Name │ TestWorker │
│ │ Cleanup Completed Tasks After Seconds │ 2592000
│ │ Provisioning State │ Succeeded │
│ ╰───────────────────────────────────────┴────────────╯
├── 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 │
│ ├───────────────────────────┼────────────────────────────┼────────────┤
│ │ containerregistrypassword │ containerregistrypassword │ ********** │
│ ╰───────────────────────────┴────────────────────────────┴────────────╯
├── Environment
│ └── ╭─────────────╮
│ │ Environment │
│ ╰─────────────╯
└── Commands
└── ╭──────────────╮
│ Commands │
├──────────────┤
│ testCommand │
│ extraCommand │
╰──────────────╯

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