Skip to content

route_registrar job from cf/287

Used for registering routes

Github source: 31254417 or master branch

Properties

nats

machines

IPs of each NATS cluster member

Example
|+
  - 192.168.50.123
  - 192.168.52.123

password

Password for NATS authentication

Example
natSpa55w0rd

port

TCP port of NATS servers

Example
4222

user

User name for NATS authentication

Example
nats

route_registrar

routes

  • Array of hashes determining which routes will be registered.
  • Each hash should have ‘port’ or ‘tls_port’, ‘uris’, ‘registration_interval’ and ‘name’ keys.
  • ‘server_cert_domain_san’ is the SAN on the destination host’s TLS certificate. You must provide ‘server_cert_domain_san’ when ‘tls_port’ is specified.
  • ‘registration_interval’ is the delay between routing updates. It must be a time duration represented as a string (e.g. “10s”). It must parse to a positive time duration i.e. “-5s” is not permitted.
  • Additionally, the ‘tags’, ‘health_check’, and ‘prepend_instance_index’ keys are optional.
  • ‘uris’ is an array of URIs to register for the ‘port’.
  • ‘tags’ are included in metrics that gorouter emits to support filtering.
  • ‘health_check’ is a hash which should have ‘name’ and ‘script_path’.
  • ‘health_check.timeout’ is optional. If the health_check timeout is not provided, it defaults to half of the value of registration_interval. If it is provided it must be a time duration represented as a string (e.g. “10s”), and less than the value of registration_interval. It must parse to a positive time duration i.e. “-5s” is not permitted.
  • if the healthcheck is not configured, the route is continually registered.
  • if the healthcheck script exits with success, the route is registered.
  • if the healthcheck script exits with error, the route is unregistered.
  • if a timeout is configured, the healthcheck script must exit within the timeout, otherwise it is terminated (with SIGKILL) and the route is unregistered.
  • ‘prepend_instance_index’ is a boolean. When set to true the values in ‘uris’ will be prepended with the instance index. e.g. ‘some-uri.system-domain.com’ will become ‘0-some-uri.system-domain.com’ on the instance with index 0, and ‘2-some-url.system-domain.com’ on the instance with index 2. When this value is enabled, each instance will register its own, unique, set of uris. To additionally continue to register these original uris, create another route with the same uris and set ‘prepend_instance_index’ to false (or omit the key entirely).
Example
|+
  - name: my-service
    registration_interval: 20s
    port: 12345
    tags:
      component: my-service
      env: production
    uris:
      - my-service.system-domain.com
      - *.my-service.system-domain.com
    health_check:
      name: my-service-health_check
      script_path: /path/to/script
      timeout: 5s
  - name: my-tls-endpoint
    tls_port: 12346
    server_cert_domain_san: "my-tls-endpoint.internal.com"
    uris:
      - my-service.system-domain.com
  - name: my-debug-endpoint
    port: 12346
    uris:
      - my-service.system-domain.com/debug
  - name: cf-mysql-proxy-api-per-instance
    port: 8080
    uris:
    - proxy-cf-mysql.system.domain
    prepend_instance_index: true
  - name: cf-mysql-proxy-api
    port: 8081
    uris:
    - proxy-cf-mysql.system.domain

Templates

Templates are rendered and placed onto corresponding instances during the deployment process. This job's templates will be placed into /var/vcap/jobs/route_registrar/ directory (learn more).

  • bin/pre-start (from pre-start)
  • bin/route_registrar_ctl (from route_registrar_ctl.erb)
  • config/registrar_settings.json (from registrar_settings.json.erb)

Packages

Packages are compiled and placed onto corresponding instances during the deployment process. Packages will be placed into /var/vcap/packages/ directory.