Skip to main content

Worker Setup

A worker can execute one or more commands. When a task is created, a specific command is executed.

Command names (case insensitive) should be unique in your Taskurai setup.

Workers are pushed as containers to a container registry of choice (Azure Container Registry, Docker Hub, ...).

info

Please note that some container registry offerings (see Docker Hub) have rate limits in place.

This is not recommended for Taskurai production environments. Consider paid subscriptions or use an Azure Container Registry.

Create a worker application

  1. Create an application directory
mkdir taskurai-workers
cd taskurai-workers
info

.NET 8.0 SDK is required for this example.

  1. Install Taskurai dotnet templates

To quickly create a Taskurai worker, first install the Taskurai dotnet templates:

dotnet new install Taskurai.Templates
  1. Create a new Taskurai worker project

The following options are required:

  • --name: Name of the project
  • --workerName: Name of the worker (only 1-20 alphanumeric characters and hyphens are allowed.)
dotnet new taskuraiworker --name TestWorker --workerName TestWorker
  1. Go to the newly created project directory:
cd TestWorker

Add the personal access token as a user secret:

dotnet user-secrets set "Taskurai:Pat" "e8gFaA8ZaetAHiS257opAr..."

Next, run the console application to validate the setup:

dotnet run
info

Adding a personal access token is only necessary when developing.

Once the worker is deployed to Taskurai, the PAT is not needed anymore.

The newly created project should look like this:

Building...
Worker environment:
Entering isolation mode, looking up token information...
Running in isolation mode.
info: Taskurai.Worker.TaskuraiWorkerParallel[0]
Taskurai worker (TestWorker) started.
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info

The console application will run in Isolation Mode when the environment is running in Development mode.

In Isolation Mode, the tasks created and returned are isolated to your local session and will not affect workers running in the Taskurai instance.

Limitations

Taskurai Worker Containers have the following limitations:

  • Privileged containers: Taskurai can't run privileged containers. If your program attempts to run a process that requires root access, the application inside the container experiences a runtime error.
  • Operating system: Linux-based (linux/amd64) container images are required.
  • Ingress: Ingress is disabled and not possible with Taskurai workers.