Service

Service specifies an executable entity. For service entities it is required a Dockerfile to be in the same directory as the Berliozfile. This enables automatic build and deployment of all docker images within the project.

mysvc/
    Berliozfile
    Dockerfile

Definition

kind: service
name: <service-name>
cluster: <cluster-name>

code:
    kind: docker
    image: <image-name>

provides:
    <provided-endpoint-name>:
        port: <port>
        protocol: http|https|tcp|udp
        load-balance: true|false

consumes:
    - service: <other-service-name>
      endpoint: <other-service-endpoint-or-default>
    - database: <other-database-name>
    - queue: <other-queue-name>
    - cluster: <other-cluster-name>
      endpoint: <other-cluster-endpoint>

environment:
    <variable-name>: <variable-value>

resources:
    memory:
        min: <memory-in-megabytes>

checks:
    - stage: health|ready
      command: <check-command>
      endpoint: <endpoint-name-or-default>
      path: <http-path-to-call>
      httpHeaders: <http-headers-dictionary>
      timing:
          initialDelay: <initial-delay-in-seconds>
          period: <check-period-in-seconds>
          timeout: <check-timeout-in-seconds>
      thresholds:
          success: <check-success-threshold>
          failure: <failure-success-threshold>
Property Description
name Service name. Contain alpha-numeric characters. No symbols. Keep under 6 characters.
cluster Cluster name.

Code

Optional code attribute specifies the source of the service code.

Property Description
kind Optional. Currently only docker is supported.
image Optional. If specified particular image from DockerHub would be used. Otherwise docker image based on local Dockerfile would be used.

Provides

provides attribute specifies exposed endpoints.

Property Description
provided-endpoint-name Endpoint name. When set as default it can be referred to by service name only. Contain alpha-numeric characters. No symbols. Keep under 6 characters.
port IP port
protocol Supported values are http, https, tcp, and udp
load-balance Optional. Indicates if the endpoint should be behind a load balancer.

Consumes

consumes attribute defines which endpoints of other services are used by the current service. This definition would control how firewall security rules are defined, and also enable automatic service discovery entries. Possible consumables include:

Consumed Description
service Name of other service to consume. Service is in the same cluster. Optionally endpoint can be specified, otherwise default service endpoint will be used.
cluster Name of other cluster to consume. Optionally endpoint can be specified, otherwise default cluster endpoint will be used.
database Name of database to consume.
queue Name of queue to consume.

Environment

Specifies environment variables applied to current service. Can use ${OTHER_VAR_NAME} to refer to other environment variables within the value.

Resources

Consumed resources of the service are specified under resources attribute.

Checks

checks specify tests to run on services to determine health and readiness to serve traffic. Described as array. Only one health and one ready check can be provided.

Property Description
stage Stage at which check should be performed. Acceptable values are health and ready. Unhealthy service check means services needs to be restarted. Ready check means it can serve traffic.
command Command string or array to probe. Return value 0 indicates success, any other value - failure. Only one of command/endpoint should be used.
endpoint Name of provided endpoint to check. Only one of command/endpoint should be used. The default provided endpoint is used if not specified.
path Http path to query. Specify relative URL only. The / path is used if not specified.
timing.initialDelay How many seconds to wait before running the check.
timing.period How often to run the check. Expressed in seconds.
timing.timeout How long before timing out and considering the check failed. Expressed in seconds.
thresholds.success How many times to run the check before considering it passed. Only used for ready check. For health value 1 is assumed.
thresholds.failure How many times to run the check before considering it failed.