jobserver

module
v0.0.0-...-9bfccdf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2023 License: GPL-3.0

README

Job Server

This is an implementation of a job worker service as described in the Teleport Systems Challenge 1 document, as part of the Teleport interview process. For more details, see the design document.

Usage

Prerequisites
Building

Running mage with no arguments will run all build steps. The resulting binaries will be placed in the bin directory.

All available build targets can be viewed by running mage -l.

Running the server

Example certificates can be generated by running mage example:certs. They will be placed in the directory examples/certs.

The job server can be run as follows:

sudo ./bin/jobserver serve \
  --rbac=examples/rbac/rbac.yaml
  --cacert=examples/certs/ca.crt \
  --cert=examples/certs/server.crt \
  --key=examples/certs/server.key

This will start the server on the default listen address (127.0.0.1:9097). A different address can be specified with the --listen-address flag.

Once the server is running, jobs can be submitted using the jobctl command.

Using jobctl

It is recommended to install the completion script for jobctl. Run jobctl completion for instructions. Most jobctl subcommands have dynamic tab-completion support for job IDs, as well as standard command and flag completion.

All jobctl subcommands require the --cacert, --cert, and --key flags to be provided to authenticate with the server. The cert and key selected will determine the identity of the user submitting the job, and that user will be authorized to perform actions based on the server's RBAC configuration. For example:

$ jobctl --cacert examples/certs/ca.crt --cert examples/certs/admin.crt --key examples/certs/admin.key [...]

Use jobctl run to submit a new job to the server. See jobctl run --help for examples and available flags.

To view the status of a running job, use jobctl status <job-id>.

To stream the output of a running job, use jobctl logs <job-id>. As a shortcut, jobctl run --follow will submit a job and immediately start streaming its output.

To stop a running job, use jobctl stop <job-id>. The command will wait for the job to stop before returning. After the job has stopped, its termination status can be viewed with jobctl status <job-id>.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL