Proctor is a set of components that allow user to do automated task with configurable access policy.
Bundle repetitive task as a automation and turn it into procs to make it easier for user to do it themself.
Before we goes deep down into explanation about proctor, you may want to read about Proctor Glossary
Section for full features list of proctor CLI is separated here
This section provide installation for unix environment.
General step
- Install and setup golang
- Clone this repository
- Run
make build. This will generate binary for proctor cli and service
For proctor service
- Make sure you have running Redis server
- Make sure you have running Postgres server
- Make sure you have running Kubernetes Cluster, for setting up local cluster, please refer here
- Copy
.env.sampleinto.envfile. Please refer here for configuration explanation - Make sure you set correct value in
.envfor Kubernetes, Postgresql, and Redis - Export value of
.envby runningsource .env - Run
make db.setupto setup local postgresql and migration - Run
./_output/bin/server sto start proctor service
For proctor cli
- Run
./_output/bin/cli config PROCTOR_HOST=<proctor-service-host>to point you proctor cli to local proctor service - Run
./_output/bin/clito see complete usage of proctor cli - Run
make ftest.update.metadatato generate sample available command - Test the client with
./_output/bin/cli list
Here's the overview of proctor components.

Proctor cli is a command line interface that used by client to interact with Proctor service.
Proctor cli read user configuration such as Proctor service host, user email, and user token from ~/.proctor/proctor.yaml.
Proctor service govern the main process of Proctor such as:
- Create execution context
- Create and read procs metadata
- Create and read procs secret
- Order the execution of procs
- Get execution status and log of running procs
Currently Proctor service use postgres to store execution context of procs.
Metadata store contain all procs metadata, procs that doesn't have metadata on store cannot be executed.
Secret store contain secret value that needed by procs to executed.
Executor is the one that executing the procs, we use Kubernetes Job as executor. Proctor service will send the procs name, needed args then executor will pull necessary image to run the procs. Proctor service will occasionally contact executor to get status of requested procs.
Here's what happen between Proctor components when client want to execute a procs.
- Cli send execution request to service. This request consist of procs name, procs args, and user credentials.
- Service get metadata and secret for requested procs.
- Service create execution context to store data related to procs execution.
- Service tell the executor to run the procs image along with user argument and procs secret.
- Service watch the process run by executor by getting the log and execution status then write it to execution context.
Some route is protected by authentication, authorization or both.
Authenticated user means that user should have account related with proctor.
Authorized user means that user should be part of groups that defined on procs meatadata, for example when procs authorized groups is proctor-user, and dev then user need to be a member of both groups.
A request need head these headers to pass auth process:
'Access-Token: <user-access-token>'
'Email-Id: <user-email>'
List of routes that require authentication:
- POST /execution
- GET /execution/{contextId}/status
- GET /execution/logs
- GET /metadata
- POST /metadata
- POST /secret
- POST /schedule
- GET /schedule
- GET /schedule/{scheduleID}
- DELETE /schedule/{scheduleID}
List of routes that require authorization:
- POST /execution
- POST /schedule
Proctor doesn't come with built in auth implementation, it's using configurable plugin mechanism.
Proctor service use plugin for:
- Authentication
- Authorization
- Notification
It create limitation that proctor service can only be used on Linux and MacOS (Until the time go plugin support other OS).
For details about plugin please read here
You can read here to learn more about creating procs.
PROCTOR_APP_PORTis port on which service will runPROCTOR_LOG_LEVELdefines log levels of service. Available options are:debug,info,warn,error,fatal,panicPROCTOR_REDIS_ADDRESSis hostname and port of redis store for jobs configuration and metadataPROCTOR_REDIS_PASSWORDis password to access redis store for jobs configuration and metadataPROCTOR_REDIS_MAX_ACTIVE_CONNECTIONSdefines maximum active connections to redis. Maximum idle connections is half of this configPROCTOR_LOGS_STREAM_READ_BUFFER_SIZEandPROCTOR_LOGS_STREAM_WRITE_BUFFER_SIZEis the buffer size for websocket connection while streaming logsPROCTOR_KUBE_CONFIGneeds to be set only if service is running outside a kubernetes cluster- If unset, service will execute jobs in the same kubernetes cluster where it is run
- When set to "out-of-cluster", service will fetch kube config based on current-context from
.kube/configfile in home directory
- If a job doesn't reach completion, it is terminated after
PROCTOR_KUBE_JOB_ACTIVE_DEADLINE_SECONDS PROCTOR_KUBE_JOB_RETRIESis the number of retries for a kubernetes job (on failure)PROCTOR_DEFAULT_NAMESPACEis the namespace under which jobs will be run in kubernetes cluster. By default, K8s has namespace "default". If you set another value, please create namespace in K8s before deployingproctordPROCTOR_KUBE_CONTEXTis used the name of context you want to use when running out of cluster.- Before streaming logs of jobs,
PROCTOR_KUBE_POD_LIST_WAIT_TIMEis the time to wait until jobs and pods are in active/successful/failed state PROCTOR_POSTGRES_USER,PROCTOR_POSTGRES_PASSWORD,PROCTOR_POSTGRES_HOSTandPROCTOR_POSTGRES_PORTis the username and password to the postgres database you wish to connect to- Set
PROCTOR_POSTGRES_DATABASEtoproctord_developmentfor development purpose - Create database
PROCTOR_POSTGRES_DATABASE PROCTOR_POSTGRES_MAX_CONNECTIONSdefines maximum open and idle connections to postgresPROCTOR_POSTGRES_CONNECTIONS_MAX_LIFETIMEis the lifetime of a connection in minutesPROCTOR_NEW_RELIC_APP_NAMEandPROCTOR_NEW_RELIC_LICENCE_KEYare used to send profiling details to newrelic. Provide dummy values if you don't want profilingPROCTOR_MIN_CLIENT_VERSIONis minimum client version allowed to communicate with proctordPROCTOR_SCHEDULED_JOBS_FETCH_INTERVAL_IN_MINSis the interval at which the scheduler fetches updated jobs from databasePROCTOR_MAIL_USERNAME,PROCTOR_MAIL_PASSWORD,PROCTOR_MAIL_SERVER_HOST,PROCTOR_MAIL_SERVER_PORTare the creds required to send notification to users on scheduled jobs executionPROCTOR_JOB_POD_ANNOTATIONSis used to set any kubernetes pod specific annotations.PROCTOR_AUTH_ENABLEDis used to set whether Authentication is enabled or not.PROCTOR_AUTH_PLUGIN_BINARYbinary location of AUTH PluginPROCTOR_AUTH_PLUGIN_EXPORTEDvariable name exported by the Auth PluginPROCTOR_REQUIRED_ADMIN_GROUPlist group required by user to access admin features for proctor such as post Metadata and Secrets
