-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
OctopuSync is based on Bootique framework, so all of the configuration is done via YML files in Bootique format.
Configuration for a single OctopuSync server instance is contained in a single YML file. Path to it must be provided to the server via command line parameter:
java -jar <server.jar> --octopus-server --config=path/to/config.yml
First, we'll look at custom configuration, that is specific to the OctopuSync application, and then provide a list of standard Bootique modules being used and their respective configurations.
As usual with Bootique, the code is the configuration, so to get the most up-to-date configuration metadata, run java -jar <server.jar> -H
.
server:
#
# Contains generic configuration properties of OctopuSync server.
# Resolved as 'net.manaty.octopusync.di.ServerConfiguration'.
#
# IP address or hostname to bind all network services to.If not
# specified, appropriate IPv4 address will be selected
# automatically,falling back to localhost, if there are no suitable
# network interfaces.
address: <string>
# Path to report root directory. Reports generated through Reporting
# Web API will be stored in this directory. If the specified
# directory does not exist at the moment of report generation, then
# it will be created automatically.
reportRoot: <string>
# Indicates, if EEG values in the report should be normalized
# (4000.0 subtracted from each value)
shouldNormalizeEegValues: <true|false>
Example:
server:
address: 192.168.1.2
reportRoot: /Users/jdoe/octopus/reports/
grpc:
#
# Contains configuration related to OctopuSync gRPC API.
# Resolved as 'net.manaty.octopusync.di.GrpcConfiguration'.
#
# Standard deviation threshold for client time sync
clientSyncDevThreshold: <double>
# Period, at which time synchronization with clients will be performed.
clientSyncIntervalMillis: <long>
# Maximum number of samples to make per round for client time sync
clientSyncMaxSamplesPerRound: <int>
# Minimum number of samples to make per round for client time sync
clientSyncMinSamplesPerRound: <int>
master:
#
# Provides master server's address for server-to-server time
# synchronization.
# Resolved as
# 'net.manaty.octopusync.di.MasterServerConfiguration'.
#
#
# Type option: static
# Provides static master server address (hard-coded in the
# configuration).
# Resolved as
# 'net.manaty.octopusync.di.StaticMasterServerConfiguration'.
#
type: 'static'
# Master server address in format <hostname|ipaddress>:<port>
address: <string>
# Period, at which a lookup for master server's address will be
# performed. Has no effect, if static master server configuration is
# used.
masterLookupIntervalMillis: <long>
# Standard deviation threshold for master server time sync
masterSyncDevThreshold: <double>
# Period, at which time synchronization with master server will be performed.
masterSyncIntervalMillis: <long>
# Maximum number of samples to make per round for master server time sync
masterSyncMaxSamplesPerRound: <int>
# Minimum number of samples to make per round for master server time sync
masterSyncMinSamplesPerRound: <int>
# Binding port for the gRPC service.If this option is not specified,
# then a random port will be used.
port: <int>
Example 1 (single-machine deployment for development purposes):
grpc:
port: 9991
Example 2 (master-slave deployment):
grpc:
port: 9991
master:
type: static
address: 192.168.1.3:9991
masterSyncIntervalMillis: 1000
cortex:
#
# Contains configuration related to capturing events from Emotiv
# Cortex server.
# Resolved as 'net.manaty.octopusync.di.CortexConfiguration'.
#
# Cortex server address in format <host>:<port>. Note that
# apparently Cortex WebSocket API expects the Host request header to
# be 'emotivcortex.com', regardless of the actual host, on which the
# Cortex server is running. Hence, the <host> part in this
# parameter's value must always be 'emotivcortex.com', and hosts
# configuration file in your OS (e.g. /etc/hosts) must contain a
# mapping from emotivcortex.com to the actual IP address of the
# server.
cortexServerAddress: <string>
emotiv:
#
# Emotiv Cloud credentials.
# Resolved as 'net.manaty.octopusync.di.EmotivConfiguration'.
#
# Application ID, for which the client ID/secret were issued.
appId: <string>
# Client ID; can be retrieved from https://www.emotiv.com/
# account page.
clientId: <string>
# Client secret; can be retrieved from https://www.emotiv.com/
# account page.
clientSecret: <string>
# License key.
license: <string>
password: <string>
username: <string>
headsetIdsToCodes:
#
# Mapping of headset IDs to human readable codes.
# Resolved as 'Map<String, String>'.
#
<string>: <string>
# Whether Cortex WebSocket client should use HTTPS connections. Note
# that when setting this to true, the Cortex server's host's
# certificate must be installed in OctopuSync's JVM.
useSsl: <true|false>
Example:
cortex:
# emotivcortex.com is mapped in hosts file to 127.0.0.1
cortexServerAddress: emotivcortex.com:54321
headsetIdsToCodes:
EPOCPLUS-3B9ADF08: A1
EPOCPLUS-HU74KZ12: A2
useSsl: false
emotiv:
username: emotivuser
password: emotivpass
clientId: myclientid123
clientSecret: ABCDEFGHIJK1234567890
appId: com.emotiv.myappid
Sensitive parameters like user's password and client secret may be provided via command line. For this you'll need to add the following JVM parameter to server launch command: -Dbq.cortex.emotiv.password=<password> -Dbq.cortex.emotiv.clientSecret=<secret>
.
JDBC module with Tomcat CP
jdbc:
#
# Resolved as 'Map<String,
# io.bootique.jdbc.managed.ManagedDataSourceFactory>'.
#
<string>:
#
# JDBC DataSource configuration.
# Resolved as
# 'io.bootique.jdbc.managed.ManagedDataSourceFactory'.
#
#
# Type option: tomcat
# Pooling Tomcat JDBC DataSource configuration.
# Resolved as
# 'io.bootique.jdbc.tomcat.TomcatManagedDataSourceFactory'.
#
type: 'tomcat'
abandonWhenPercentageFull: <int>
alternateUsernameAllowed: <true|false>
commitOnReturn: <true|false>
dataSourceJNDI: <string>
defaultAutoCommit: <true|false>
defaultCatalog: <string>
defaultReadOnly: <true|false>
defaultTransactionIsolation: <string>
driverClassName: <string>
fairQueue: <true|false>
ignoreExceptionOnPreLoad: <true|false>
initSQL: <string>
initialSize: <int>
jdbcInterceptors: <string>
jmxEnabled: <true|false>
jmxObjectName: <string>
logAbandoned: <true|false>
logValidationErrors: <true|false>
maxActive: <int>
maxAge: <long>
maxIdle: <int>
maxWait: <int>
minEvictableIdleTimeMillis: <int>
minIdle: <int>
numTestsPerEvictionRun: <int>
password: <string>
propagateInterruptState: <true|false>
removeAbandoned: <true|false>
removeAbandonedTimeout: <int>
rollbackOnReturn: <true|false>
suspectTimeout: <int>
testOnBorrow: <true|false>
testOnConnect: <true|false>
testOnReturn: <true|false>
testWhileIdle: <true|false>
timeBetweenEvictionRunsMillis: <int>
url: <string>
useDisposableConnectionFacade: <true|false>
useEquals: <true|false>
useLock: <true|false>
username: <string>
validationInterval: <long>
validationQuery: <string>
validationQueryTimeout: <int>
validatorClassName: <string>
Example:
jdbc:
octopus:
url: jdbc:postgresql://localhost:5432/octopus?currentSchema=octopus
maxActive: 2
username: postgres
password: postgres
Alternatively, password may be provided via command line. For this you'll need to add the following JVM parameter to server launch command: -Dbq.jdbc.octopus.password=<password>
.
Jetty module with WebSocket support
jetty:
#
# Configures embedded Jetty server, including servlet spec objects,
# web server root location, connectors, thread pool parameters, etc.
# Resolved as 'io.bootique.jetty.server.ServerFactory'.
#
# Replaces multiple '/'s with a single '/' in URL. Default value is
# 'false'.
compactPath: <true|false>
# A boolean specifying whether gzip compression should be supported.
# When enabled responses will be compressed if a client indicates it
# supports compression via "Accept-Encoding: gzip" header. Default
# value is 'true'.
compression: <true|false>
connectors:
#
# A list of objects specifying properties of the server
# network connectors.
# Resolved as
# 'List<io.bootique.jetty.connector.ConnectorFactory>'.
#
-
#
# Resolved as
# 'io.bootique.jetty.connector.ConnectorFactory'.
#
#
# Type option: http
# Resolved as
# 'io.bootique.jetty.connector.HttpConnectorFactory'.
#
type: 'http'
# A desired number of acceptor threads. If not provided,
# Jetty will calculate an optimal value based on the
# number of available processor cores.
acceptorThreads: <int>
host: <string>
# Resolved as 'io.bootique.value.Duration'.
idleTimeout: <duration expression, e.g. 5ms, 2s, 1hr>
port: <int>
requestHeaderSize: <int>
responseHeaderSize: <int>
# A desired number of selector threads. If not provided,
# Jetty will calculate an optimal value based on the
# number of available processor cores.
selectorThreads: <int>
#
# Type option: https
# Resolved as
# 'io.bootique.jetty.connector.HttpsConnectorFactory'.
#
type: 'https'
# A desired number of acceptor threads. If not provided,
# Jetty will calculate an optimal value based on the
# number of available processor cores.
acceptorThreads: <int>
certificateAlias: <string>
host: <string>
# Resolved as 'io.bootique.value.Duration'.
idleTimeout: <duration expression, e.g. 5ms, 2s, 1hr>
keyStore: <resource-uri>
keyStorePassword: <string>
port: <int>
requestHeaderSize: <int>
responseHeaderSize: <int>
# A desired number of selector threads. If not provided,
# Jetty will calculate an optimal value based on the
# number of available processor cores.
selectorThreads: <int>
# Web application context path. Default is '/'.
context: <string>
errorPages:
#
# A map specifying a mapping between HTTP status codes and
# pages (URLs) which will be used as their handlers. If no
# mapping is specified then standard error handler is used.
# Resolved as 'Map<int, String>'.
#
<int>: <string>
filters:
#
# A map of servlet Filter configurations by filter name.
# Resolved as 'Map<String,
# io.bootique.jetty.server.FilterFactory>'.
#
<string>:
#
# Resolved as 'io.bootique.jetty.server.FilterFactory'.
#
params:
#
# Resolved as 'Map<String, String>'.
#
<string>: <string>
urlPatterns:
#
# Resolved as 'List<String>'.
#
- <string>
# A period in milliseconds specifying how long until an idle thread
# is terminated.
idleThreadTimeout: <int>
# Maximum size of submitted forms in bytes. Default is 200000
# (~195K).
maxFormContentSize: <int>
# Maximum number of form fields. Default is 1000.
maxFormKeys: <int>
# Maximum number of requests to queue if the thread pool is busy. If
# this number is exceeded, the server will start dropping requests.
maxQueuedRequests: <int>
# Maximum number of request processing threads in the pool.
maxThreads: <int>
# Minimal number of request processing threads in the pool.
minThreads: <int>
params:
#
# A map of application-specific key/value parameters that are
# used as "init" parameters of the ServletContext.
# Resolved as 'Map<String, String>'.
#
<string>: <string>
servlets:
#
# A map of servlet configurations by servlet name.
# Resolved as 'Map<String,
# io.bootique.jetty.server.ServletFactory>'.
#
<string>:
#
# Resolved as 'io.bootique.jetty.server.ServletFactory'.
#
params:
#
# Resolved as 'Map<String, String>'.
#
<string>: <string>
urlPatterns:
#
# Resolved as 'List<String>'.
#
- <string>
# A boolean specifying whether servlet sessions should be supported
# by Jetty. The default is 'true'
sessions: <true|false>
# Defines a base location for resources of the Jetty context. It can
# be a filesystem path, a URL or a special "classpath:" URL (giving
# the ability to bundle resources in the app, not unlike a JavaEE
# .war file). This setting only makes sense when some form of
# "default" servlet is in use, that will be responsible for serving
# static resources. See JettyModule.contributeStaticServlet(..) or
# JettyModule.contributeDefaultServlet(..).
staticResourceBase: <folder-resource-uri>
Example:
jetty:
context: /
staticResourceBase: /Users/jdoe/ide-workspace/octopus/server/static
connectors:
- type: http
port: 9998
Note that the static resources are bundled in the repository, but not included in the server JAR. YML configuration must contain a valid absolute path to the static resources directory. You may specify it on the command line by passing a JVM parameter to Octopus launch command: -Dbq.jetty.staticResourceBase=/path/to/static
.
jersey:
#
# Configures the servlet that is an entry point to Jersey REST API
# engine.
# Resolved as 'io.bootique.jersey.JerseyServletFactory'.
#
urlPattern: <string>
Example:
jersey:
urlPattern: /rest/*
log:
#
# Resolved as 'io.bootique.logback.LogbackContextFactory'.
#
appenderRefs:
#
# Collection of appender names which should be added to root
# Logger.
# Resolved as 'List<String>'.
#
- <string>
appenders:
#
# One or more appenders that will render the logs to console,
# file, etc. If the list is empty, console appender is used
# with default settings.
# Resolved as
# 'List<io.bootique.logback.appender.AppenderFactory>'.
#
-
#
# Appender of a given type.
# Resolved as
# 'io.bootique.logback.appender.AppenderFactory'.
#
#
# Type option: console
# Appender that prints its output to stdout or stderr.
# Resolved as
# 'io.bootique.logback.appender.ConsoleAppenderFactory'.
#
type: 'console'
# Log format specification compatible with Logback
# framework. If not set, the value is propagated from
# the parent configuration.
logFormat: <string>
# Appender name.
name: <string>
# Whether the log should be sent to stdout or stderr.
# The default is 'stdout'
# Resolved as
# 'io.bootique.logback.appender.ConsoleTarget'.
target: <stdout|stderr>
#
# Type option: file
# Resolved as
# 'io.bootique.logback.appender.FileAppenderFactory'.
#
type: 'file'
file: <string>
# Log format specification compatible with Logback
# framework. If not set, the value is propagated from
# the parent configuration.
logFormat: <string>
# Appender name.
name: <string>
rollingPolicy:
#
# Resolved as 'io.bootique.logback.policy.RollingP
# olicyFactory'.
#
#
# Type option: time
# Resolved as 'io.bootique.logback.policy.TimeBase
# dPolicyFactory'.
#
type: 'time'
fileNamePattern: <string>
historySize: <int>
totalSize: <string>
#
# Type option: sizeAndTime
# Resolved as 'io.bootique.logback.policy.SizeAndT
# imeBasedPolicyFactory'.
#
type: 'sizeAndTime'
fileNamePattern: <string>
historySize: <int>
totalSize: <string>
#
# Type option: fixedWindow
# Resolved as 'io.bootique.logback.policy.FixedWin
# dowPolicyFactory'.
#
type: 'fixedWindow'
fileNamePattern: <string>
fileSize: <string>
historySize: <int>
# If true, Logback configuration debugging information will be
# printed to console. Helps to deal with Logback configuration
# issues.
debugLogback: <true|false>
# Root log level. Can be overridden by individual loggers. The
# default is 'info'.
# Resolved as 'io.bootique.logback.LogbackLevel'.
level: <off|error|warn|info|debug|trace|all>
# Log format specification used by child appenders unless redefined
# at the appender level, or not relevant for a given type of
# appender. The spec is compatible with Logback framework. The
# default is '%-5p [%d{ISO8601,UTC}] %thread %c{20}: %m%n%rEx'
logFormat: <string>
loggers:
#
# Per-package or per-class loggers. Keys in the map are logger
# names.
# Resolved as 'Map<String,
# io.bootique.logback.LoggerFactory>'.
#
<string>:
#
# Resolved as 'io.bootique.logback.LoggerFactory'.
#
appenderRefs:
#
# Collection of references to named appenders
# Resolved as 'List<String>'.
#
- <string>
# Logging level of a given logger and its children.
# Resolved as 'io.bootique.logback.LogbackLevel'.
level: <off|error|warn|info|debug|trace|all>
# If true, all Bootique logback settings are ignored and the user is
# expected to provide its own config file per Logback documentation.
# This is only needed for a few advanced options not directly
# available via Bootique config. So the value should stay false
# (which is the default).
useLogbackConfig: <true|false>
Example 1 (output to console):
log:
level: warn
loggers:
net.manaty:
level: debug
appenders:
- type: console
logFormat: '[%d{dd/MMM/yyyy:HH:mm:ss}] %t %-5p %c{1}: %m%n'
Example 2 (output to file):
log:
level: warn
appenderRefs:
- main
loggers:
net.manaty:
level: debug
appenderRefs:
- main
appenders:
- type: file
name: main
logFormat: '[%d{dd/MMM/yyyy:HH:mm:ss}] %t %-5p %c{1}: %m%n'
file: octopus.log