Skip to main content
Version: 2.16.0

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 directoryYes
timezoneThe timezone which the data belongs toYes
previousDaysToSearchForNetworkNumber of days to search the network back from the current dateNo0
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 cacheNo0
Auth Config
OptionDescriptionRequiredDefault
authTypeAuth method to be used
Valid values: AUTH0, AZURE,NONE
AUTH0 and AZURE use Auth0 or Azure OAuth2 implementation respectively.
NONE to disable auth.
NoNONE
jwkUrlThe url to fetch token issuer keys.No""
issuerDomain url for token issuer (iss) verificationNo""
issuerDomainDomain and path for the token issuer server. Used by clients to fetch tokens.Nosame as issuer
tokenPathThe path (appended to issuerDomain) for fetching tokens from the auth provider.No"/oauth/token"
audienceAPI audience for the serverNo""
permissionKeyThe permissions key in the token that has the permissions for audience. It's permissions for Auth0 and roles for Azure.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 Azure M2M token support, use the following example (all the urls have to be used the way as in the example, or it won't work):

"auth": {
"authType": "azure",
"audience": "api://test",
"tokenPath": "/oauth2/v2.0/token",
"jwkUrl": "login.microsoftonline.com/<tenant>/discovery/v2.0/keys",
"issuerDomain": "login.microsoftonline.com/<tenant>",
"issuer": "https://sts.windows.net/<tenant>/",
"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
Debug Config
OptionDescriptionRequiredDefault
logRoutesIndicates if the server should print all registered routes on start-upNofalse
logRequestsIndicates if the server should print all requests receivedNofalse
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.