Skip to content

Configuration

Zheng Luo edited this page Feb 13, 2018 · 21 revisions

Configuration file can be specified by -c {config.yaml}.

Example

interval: 3 # Interval between pollings
loglevel: 5 # 0-5. 0 for ERROR and 5 for DEBUG
# Prometheus metrics are exposed at http://exporter_address/metrics
exporter_address: :8081

#logstash:
#   address: listener.logz.io:5050 # logstash sink. Lug will send all logs to this address
#   additional_fields:
#       token: "" # Additional fields sent to logstash server

# Address where JSON API will be served
json_api:
    address: :7001
    # certfile: "/foobar/tls.cer" # unspecified = use plain HTTP
    # keyfile: "/foobar/foobar.com.key"
    # username: "example" # HTTP basic auth
    # password: "example"

logstashaddr: "172.0.0.4:6000" # TCP Address of logstash. empty means no logstash support
repos:
    - type: rsync # Config for repo1
      source: rsync://rsync.chiark.greenend.org.uk/ftp/users/sgtatham/putty-website-mirror/
      interval: 6 # Interval between sync
      path: /tmp/putty # Output directory
      name: putty # Required
      rlimit_mem: 200M # Optional, maximum memory can be used
# You can add more repos here, different repos may have different worker types,
# refer to Worker Types section for detailed explanation

Worker Types

Rsync

type: rsync # required
source: rsync://rsync.chiark.greenend.org.uk/ftp/users/sgtatham/putty-website-mirror/ # with rsync:// prefix
interval: 6 # Interval between sync in seconds
path: /tmp/putty # Output directory
name: putty # Required

Shell Script

All config items will be forwarded to the script as environmental variables, with an additional LUG_ prefix.

type: shell_script # required
script: /path/to/your/script # required
interval: 6 # Interval between sync in seconds
name: shell # Required

External

External worker is a special type of worker. It simply does nothing and always returns {Idle: false, Result: true}. Utilities will not be executed. Any key except name/type will be ignored.

name: external_worker
type: external
any_key: any_value

Utilities

Utilities are functions that work on multiple kinds of workers.

Rlimit

Add

    rlimit_mem: 200M

in config of each repo to limit the memory that worker can use.

JSON Restful API

By default lug listens on address :7001, which could be overwritten by -j ADDR.

If both -cert and -key are provided, HTTPS instead of HTTP protocol will be used.

rest.Get("/lug/v1/manager", r.getManagerStatus),     // return manager.Status object
rest.Get("/lug/v1/manager/summary", r.getManagerSummary),     // return manager.Status object without stderr/stdout
rest.Post("/lug/v1/manager/start", r.startManager),  // no return value
rest.Post("/lug/v1/manager/stop", r.stopManager),    // no return value
rest.Delete("/lug/v1/manager", r.exitManager),       // no return value

Currently all request has no required param.

Since no authentication is required, we suggest running this API behind a nginx reverse proxy with authentication method.

Clone this wiki locally