ethel core supports the following configuration options:
When running via the command line or docker use a .server.env file for environment variables. When
running via PM2 use an ecosystem config file and include the environment variables there.
General
These are more commonly used configuration options:
| Option | Data type | Default | Description |
|---|---|---|---|
| ETHEL_CRYPTO_KEY, mandatory | string | none | A seed value used for encrypting and decrypting text and must be exactly 32 characters long |
| ETHEL_PORT | number | 3000 | The port number where the ethel API is listening |
| ETHEL_DATA | JSON stringified object | {"type":"SQLite"} | The database type to be used, more options in the data section below |
| ETHEL_QUEUE | JSON stringified object | {"type":"BetterQueue"} | The queue type to be used, more options in the queue section below |
| ETHEL_LOGS_PATH | string | ./logs | The path to the log files folder |
| ETHEL_PLUGINS_PATHS | string | '["./plugins"]' | Array of file paths to custom runners. |
Some example configuration settings:
ETHEL_CRYPTO_KEY=ur9ToBbPmpcEL90K2zS3sSuDnu5k6mzp
ETHEL_PORT=4000
ETHEL_DATA={"type":"SQLite","path":"D:\\ethel\\data"}
ETHEL_LOGS_PATH=D:\ethel\logs
ETHEL_DATA={"type":"PostgreSQL","host":"db","user":"ethel","password":"H0JfPgyoMy$Y*0g@x","database":"ethel","port":"5432"}
ETHEL_QUEUE={"type":"RabbitMQ","url":"amqps://ethel:Wn1xyCun%$C##42o@docker.lan:15672"}
Logging
By default logging will output all warning, error or fatal messages to the console and to the issues.log file
Logging of all levels can be turned on by setting the ETHEL_ENABLE_TRACE to true
| Option | Data type | Default | Description |
|---|---|---|---|
| ETHEL_LOGS_PATH | string | ./logs | The path to the log files folder |
| ETHEL_ENABLE_CONSOLE | boolean | false | Whether to enable to the console or not. The console adds load to the system, so avoid enabling it if you can. |
| ETHEL_ENABLE_TRACE | boolean | false | Whether to enable all logs be written to file |
Data options
Supply a stringified JSON object. The default adapter is SQLite.
SQLite
The adapter configuration options are:
| Option | Data type | Description |
|---|---|---|
| optimiseOnStart | boolean | Optimise the database on startup. Recommended if there is no graceful shutdown, i.e. running via the
command
line. Defaults to false. |
| type, mandatory | string | The name of the adapter, i.e. SQLite.
|
| path | string | Path to where the data files are created. Defaults to a folder named data in the root of the project folder. |
| reset | boolean | Drop existing tables and create new ones. Defaults to false. |
Example adapter configuration:
ETHEL_DATA={"type":"SQLite","path":"/opt/ethel/data/"}
PostgreSQL
The adapter configuration options are:
| Option | Data type | Description |
|---|---|---|
| type, mandatory | string | The name of the adapter, i.e. PostgreSQL.
|
| user, mandatory | string | The name of the user for the connection. |
| password, mandatory | string | The password of the user for the connection. |
| host | string | Server name for the connection. Defaults to localhost. |
| port | number | Port for the connection. Defaults to 5454. |
| database | string | Database name for the connection. Defaults to postgres. |
| reconnect | any | A reconnect configuration options object. See reconnect for options. Defaults to reconnect. |
Some example adapter configurations:
ETHEL_DATA={"type":"PostgreSQL","user":"ethel","password":"v$t$jU##yoAHn4Gma","database":"ethel"}
ETHEL_DATA={"type":"PostgreSQL","host":"db.lan","user":"projectA","password":"v$t$jU##yoAHn4Gma","database":"projectA","port":"5432"}
SQLServer
For connection options see the mssql docs. There are a large number of options supported
In addition a reconnect options object can be supplied.See reconnect for options.
Some example adapter configurations:
ETHEL_DATA={"type":"SQLServer","user":"ethel","password":"WyWU5$vU1AQME2u#L","server":"db","database":"ethel","options":{"trustServerCertificate":true}}
ETHEL_DATA={"type":"SQLServer","user":"ethel","password":"WyWU5$vU1AQME2u#L","database":"ethel","options":{"trustServerCertificate":true},"reconnect":{"reconnect":false}}
Queue options
BetterQueue
The adapter configuration options are:
| Option | Data type | Description |
|---|---|---|
| type, mandatory | string | The name of the adapter, i.e. BetterQueue. |
If you are using any queues other than the Tasks queue, you will need to update these via the API or client.
Example adapter configuration:
ETHEL_QUEUE={"type":"BetterQueue"}
RabbitMQ
The adapter configuration options are:
| Option | Data type | Description |
|---|---|---|
| type, mandatory | string | The name of the adapter, i.e. RabbitMQ. |
| url, mandatory | string | The URL to connect to the RabbitMQ instance. Defaults to amqp://localhost. |
If you are using any queues other than the Tasks queue, you will need to update these via the API or client.
An example adapter configuration:
ETHEL_QUEUE={"type":"RabbitMQ","url":"aqmps://server.tld:15672"}
QueueConfig
The queue config object determines the behaviour of the tasks service for that particular queue.
| Option | Data type | Default | Description |
|---|---|---|---|
| isConsumer | boolean | true | Whether a queue consumer is created or not |
| name | string | none, mandatory | The queue name |
| operatingHours | array of operating hours configuration objects | none | A set of enabled and cron attributes configuring when the consumer processes tasks |
| prefetch | number | 2 | The number of tasks the queue will send to consumers. Ignored by BetterQueue. |
| queue | object | none | Do not populate this. The system will insert this value based on the queue configuration |
Example configurations:
{"name":"Tasks","prefetch":4}
This instance will not consumer the Load queue, but will populate it with tasks:
{"name":"Load","isConsumer":false}
This creates a consumer that stops at 6am Monday to Friday and starts at 6pm Monday to Fridays, running all weekend:
{"name":"Load","operatingHours":[{"enabled":true,"cron":"0 18 * * 1-5"},{"enabled":false,"cron":"0 6 * * 1-5"}]}
Other options
These are lesser used options.
| Option | Data type | Default | Description |
|---|---|---|---|
| ETHEL_SUSPEND_RUN_WAIT | number | 15 | The number of minutes until a run without updates is suspended |
| ETHEL_SUSPEND_RUN_ERRORS | number | 50 | The number of errors per runner before a run is suspended |
| ETHEL_RUNS_LIMIT | number | 1 | The number of runs running at the same time |
| ETHEL_RUNNERS_PATH | string | ./node_modules/@driverlane/ethel-runners/dist/runners | File path to the core runners |
| ETHEL_INSTANCE_ID | string | 0 | An identifier to differentiate each instance. If using PM2 this will be ignored and NODE_APP_INSTANCE used. |
| ETHEL_MONITORING | JSON stringified array of strings | '[]' | Array of components where monitoring is enabled |
Reconnect
This configuration object controls whether core attempts to reconnect to a server that has crashed or did not accept a conneciton.
| Option | Data type | Description |
|---|---|---|
| reconnect | boolean | Whether or not to reconnect. Defaults to true. |
| maxAttempts | number | aximum number of reconnection attempts. Defaults to 10. |
| wait | number | How long to wait between connection attempts. Defaults to 5000 milliseconds. |
| backoff | number | How far to back off the wait on each reconnect attempt. Defaults to 2, which doubles the
wait
each attempt. |