lever.json

This page describes the different configuration parameters of lever.json

:bookmark: lever.json

lever.json is the configuration file provided as part of every Lever deployment. The simplest lever.json typically contains just the name of the serivce and an entry point (like jsEntry).

{
  "name": "exampleService",
  "jsEntry": "service.js"
}

The following describes in detail every JSON property that can be used to configure the service.

:hash: name (string)

The name of the service, the most important thing in lever.json. It is a string that needs to be unique within the Lever environment it is used. Any preexisting service with the same name will be overwritten when deploying. A couple of rules:

  • The name must have at least 3 and at most 255 characters.
  • It must not contain /, ?, # or spaces.

:hash: description (string) optional

A description of the service.

:hash: entry ([string]) optional

The binary entry point of the service. At most one of entry and jsEntry may be specified as part of lever.json. If none of the two is specified, then entry defaults to ["./serve"].

The binary entry point represents the command and its arguments that needs to be executed to run the process that listens for Lever connections. For example, to run the command ./runService arg1 arg2, you need to set this property to ["./runService", "arg1", "arg2"].

:hash: jsEntry (string) optional

The JavaScript entry point of the service. At most one of entry and jsEntry may be specified as part of lever.json.

The JavaScript entry point represents the JS module that exports the Lever methods to be exposed as part of the service's API.

:hash: private (boolean) optional

Indicates whether the service is private or public. If not specified, the service defaults to public.

A private service can only be accessed by other Lever services from the same environment, via a client library. It is only meant as a backend. By contrast, a public service can also be accessed from outside the environment (either via a client library or via the HTTP API).

:hash: maxInstanceLoad (number) optional

The maximum average load per instance of your service. If the total load of your service in a region exceeds this value times the number of instances already running, then Lever automatically starts more instances of this service.

If no value is specified, then maxInstanceLoad defaults to 10.

The load is simply the number of requests in flight (currently being processed by the instances). For example, a service that takes about 1 second to process each request and receives 5 requests/second, then it has a load of 5. Meaning that there are, on average, 5 requests being processed in parallel.

:hash: minInstances (integer) optional

:construction: Not yet implemented. :construction:

:hash: ram (integer) optional

The amount of memory, in MB, to allocate for each instance. If not specified, ram defaults to 50.

Note that although memory is the most tangible resource being allocated with this configuration parameter, it is not the only one. CPU, network I/O and (in a future version) disk I/O is also controlled with this property, indirectly. These resources are allocated per instance proportionally to the amount of memory it reserves.

:hash: config (object) optional

:construction: Not yet implemented. :construction:


Did this page help you?