Worker

The djinn-worker is the component that handles executing builds that are submitted via the server or the scheduler. You may need to install some additional dependencies on the worker machine depending on the drivers you want to make available.

External Dependencies

Detailed below are the software dependencies that the worker needs in order to start and run,

DEPENDENCY REASON
PostgreSQL Primary data store for the server.
Redis Data store used as the build queue.
SMTP Server Used for sending emails on build failures.

Driver Dependencies

Detailed below are the software dependencies that the worker needs in order to execute a build via that driver.

DRIVER SOFTWARE
docker The dockerd process for managing containers.
qemu The qemu software package for creating virtual machines.

Configuring the worker

Worker parameters
NAMETYPEDESCRIPTION

parallelism

int

The parallelism to use when running multiple builds at once. Set to 0 to use the number of CPU cores available.

driver

string

The driver that will be used for executing builds on the worker.

crypto

object

Configuration settings for generating names for artifacts.

crypto.block

string

The block key used for encrypting data. This must be either 16, 24, or 32 characters in length.

crypto.salt

string

Salt the is used to generate secret.

database

object

Provides connection information to the PostgreSQL database.

database.addr

string

The address of the PostgreSQL server to connect to.

database.name

string

The name of the database to use.

database.username

string

The name of the database user.

database.password

string

The password of the database user.

database.tls

object

TLS configuration for connecting via TLS.

database.tls.ca

string

Path to the CA root to use.

database.tls.cert

string

Path to the certificate to use.

database.tls.key

string

Path to the key to use.

redis

object

Providers connection information to the Redis database.

redis.addr

string

The address of the Redis server to connect to.

redis.password

string

The password used if the Redis server is password protected.

smtp

object

Provides connection innformation to an SMTP server for sending emails.

smtp.addr

string

The address of the SMTP server.

smtp.ca

string

The path to the root CA if connecting via TLS.

admin

string

The email address to be used in the From field of emails that are sent.

username

string

The username for authentication.

pasword

string

The password for authentication.

store label

object

Configuration parameters for each of the file stores the server uses. The label will be the store type, one of:

  • artifacts
  • images
  • objects

there must be a store configuration block for each.

store.type

string

The type of the store to use. Must be file.

store.path

string

The location where the files are.

store.limit

int

The maximum size of files being stored. Set to 0 for no limit.

provider label

object

Configuration parameters for reach third-party provider you want to integrate with, where the label is the name of that provider. As of now, only github, and gitlab are supported.

Note: The worker does not need the client_id or client_secret details of a provider. For example, provider github {} will suffice for GitHub integration.

EXAMPLE

pidfile "/var/run/djinn/worker.pid"

log info "/var/log/djinn/worker.log"

parallelism 0

driver "qemu"

timeout "30m"

provider github {}
provider gitlab {}

crypto {
    block "1a2b3c4d5e6f7g8h"
    salt  "1a2b3c4d5e6f7g8h"
}

database {
    addr "localhost:5432"
    name "djinn"

    username "djinn_worker"
    password "secret"
}

redis {
    addr "localhost:6379"
}

smtp {
    addr "smtp.example.com:587"

    ca "/etc/ssl/cert.pem"

    admin "no-reply@djinn-ci.com"

    username "postmaster@example.com"
    password "secret"
}

store artifacts {
    type  "file"
    path  "/var/lib/djinn/artifacts"
    limit 52428800
}

store images {
    type "file"
    path "/var/lib/djinn/images"
}

store objects {
    type "file"
    path "/var/lib/djinn/objects"
}

Running the Worker

To run the worker simply invoke the djinn-worker binary. There are two flags that can be given to the djinn-worker binary.

  • -config - This specifies the configuration file to use, by default this will be djinn-worker.conf.

  • -driver - This specifies the driver configuration file to use, for configuring the drivers you want to support on your server, by default this will be djinn-driver.conf.

Configuring the Worker Daemon

The dist directory contains files for running the Djinn Worker as a daemon on Linux systems that use systemd and SysVinit for daemon management. Use whichever suits your needs, and modify accordingly.

If deploying to a Linux system that uses systemd, then be sure to run systemctl daemon-reload upon placement of the service file.