Skip to main content
Version: Next

Overview

The EWB Server is the primary server that supplies APIs to access network and time series data, as well as provides web apps that provide visualisations and other high level functionality related to the data from the APIs.

This document describes how to configure and run the energy workbench server.


Configuration

Configuration for the energy workbench server is specified in a JSON file.

KeyDescriptionRequired
httpObject that holds http related config.
Refer http config options below
Yes
ewbDataObject that holds the ewb data related config.
Refer ewb data config options below
Yes
authObject that holds the auth related config.
Refer auth config options below
No
syslogObject that holds system log related config for Nix based systems
Refer system log options below
No
geoViewObject that holds time series related config
Refer geo view options below
No
debugObject that holds results cache related config
Refer debug options below
No
HTTP Config
OptionDescriptionRequiredDefault
portThe port for the server to listen on.Yes
webrootThe path to the directory holding the application website.Nowebroot
staticCachingEnabledFlag to indicate whether static caching is enabled.Notrue
corsAllows you to specify hosts to add to the CORS (cross origin resource sharing) white list.No
tlsEnabledEnable HTTPS on the web server.Nofalse
keyPathThe path to the PEM private key file.No
certPathThe path to the PEM certificate for the provided private key.No
caPathThe path to a PEM CA chain for client authentication.No
clientAuthWhether client authentication should be enabled. One of request, required, or none, meaning client auth is optional (client can request), required (client must present a signed certificate by a CA in caPath), or no client auth is available respectively.Nonone
EWB Data Config
OptionDescriptionRequiredDefault
pathThe path to the ewb data directory.Yes
timezoneThe timezone which the data belongs to.Yes
previousDaysToSearchForNetworkNumber of days to search the network back from the current date.No0
previousDaysToSearchForDiagramNumber of days number of days prior to the date of the network-model database being loaded to search for a diagrams database, if an exact match did not exist.No0
previousDaysToSearchForCustomerNumber of days number of days prior to the date of the network-model database being loaded to search for a customer database, if an exact match did not exist.No0
cachePeriodLimits the amount of load data available in the server.
Specified in days unless a units character is appended.
Valid unit characters: 'd' (days), 'm' (months), 'y' (years).
NoAll
resultsCacheTtlSecondsThe time to live for the results cache.No0
connectionPointIdentifierThe name of the identifier used for connection points.StringNMI
excludeCustomersIndicates that customers should be excluded from the EWB database load. Must be set to true if you do not have a customer database.Booleanfalse
networkDateWhen set EWB will only attempt to load a network-model database of this date.No
Auth Config
OptionDescriptionRequiredDefault
authTypeAuth method to be used
Valid values: AUTH0, EntraID,NONE
AUTH0 and EntraId use Auth0 or EntraId OAuth2 implementation respectively.
NONE to disable auth
Yes, if auth definedNONE
issuerDomain url for token issuerYes, if type is not NONE""
audienceAPI audience for the serverYes, if type is not NONE""
permissionKeyThe permissions key in the token that has the permissions for audience. It's permissions for Auth0 and roles for EntraId.No"permissions"
defaultApiClaimDefault API claimNo"read:ewb"
allowAllPermissionsBoolean flag to disable Authorisation - all claims will be accepted when authorising. Not recommended for production use cases.Nofalse

For instance, for EntraId, use the following example (the url have to be used the way as in the example, or it won't work):

"auth": {
"authType": "entraid",
"issuer": "https://login.microsoftonline.com/<tenant>/v2.0",
"audience": "982374979-23492837492-23423874987289asjdf",
"permissionsKey": "roles"
}

For an Auth0 config:

"auth": {
"authType": "auth0",
"issuer": "zepben-dev.au.auth0.com",
"audience": "https://some-audience/",
"defaultApiClaim": "read:ewb"
}
System Log Config
OptionDescriptionRequiredDefault
facilityThe facility code to specify the type of program logging the message.
Valid Values : SYSLOG, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7
No
tagThe tag for the log message.With facility
Geographic View Config
OptionDescriptionRequiredDefault
tileSizeThe size of the tiles to produce.No4096
maxZoomThe maximum supported zoom level.No20
mapboxApiTokenThe API token required to render MapBox tiles.Noinvalid token
keepLevelSpecThe keep level specification to be used for vector tiles.Nonull
maxCacheSizeThe maximum size in MB for tiles in the memory tile cache.No512
cacheWritePeriodThe time period in seconds between batch writes of the MVTs in memory to be written to disk.
A value of 0 will disable disk writes.
No10
minPointsToWriteThe minimum number of points on a tile for it to be written to the disk cache.No1000
switchNamePatternA regex pattern with a maximum of one group to extract switch names for visualisation on the map. If a single regex grouping is provided the group will be returned as the switch name. If the pattern doesn't match the switch name will not be included. Default is no switch names in the map tiles.Nonull
Debug Config
OptionDescriptionRequiredDefault
logRoutesIndicates if the server should print all registered routes on start-upNofalse
logExceptionsEnable stacktrace loggin when the server response with a 500Notrue
logRequestsIndicates if the server should print all requests receivedNotrue
logRequestBodyToFileSpecifies a file to save the last received request bodyNo
caution

If any paths in the configuration are given as relative paths, they will be relative to the working directory of the JVM.

The following is a sample configuration file:

Sample Configuration File

{
"http": {
"port": 9000,
"webroot": "/Users/zepben/Desktop/Zepben/Client/web-client/dist",
"staticCachingEnabled": false,
"cors": ".*"
},
"ewbData": {
"path": "/Users/zepben/Desktop/Zepben/Server/EnergyWorkbench/ewb",
"previousDaysToSearchForNetwork": 365,
"timezone": "Australia/Melbourne",
"cachePeriod": "1m",
"resultsCacheTtlSeconds": 90000
},
"syslog": {
"facility": "SYSLOG",
"tag": "EWB"
}
}

Run

Command Line Arguments
FlagValid ValuesRequiredDefault
-c, --confPath to the configuration fileNoenergy-workbench-server-conf.json
-s0, --suppress-zero-lengthSuppress the logging of zero length energy profile warningsNoLog warnings

To run the server, execute the following command at a terminal where <heap size> is the desired size of the heap (e.g. 16g):

java -Xmx<heap size> -Xms<heap size> -jar <path to energy-workbench-server-jar> --conf <path to config file>
Heap Size Estimation
Because you are running up a server with large network models and a lot of load profiles, you will need to increase the heap size for the JVM instance

using the appropriate JVM flags:

A network with 500,000 HV assets requires around 8GB.
Load points for around 100,000 distribution transformers require 20GB/year.
Weather Data from 100 weather stations would require around 512MB/year.
Depending on the API usage the JVM would require more than 8GB.

ewb_server.sh

As the server runs as a server (that is generally as a background process but at the very least as a process that does not just finish after a task is done) a script is provided to more easily start and stop the server. The script will make sure if there is a EWB server instance already running it will not start a second instance.

The script can be found at EWB_RELEASE_DIR/bin/ewb_server.sh.

The underlying java command that starts the server can be configured in the ewb.conf configuration file. See the deployment documentation for more information on ewb.conf.

To start the EWB server using this script:

EWB_RELEASE_DIR/bin/ewb_server.sh start

To stop the EWB server using this script:

EWB_RELEASE_DIR/bin/ewb_server.sh stop

note

The ewb_daily.sh script relies on the ewb_server.sh script to stop and start the server.