Configure a Service
A service is configured as any Spring Boot application is: application.yaml, profiles, environment variables and command-line arguments, under the prefix wow. Most keys have defaults that fit production. This page explains how the configuration takes effect and what the host checks. Configuration Keys lists every key, with its type and default.
Where the values come from
The host reads Spring Boot's environment, so every source Spring Boot knows works, in its order of precedence: command-line arguments over environment variables over profile-specific files over application.yaml. Names bind relaxed: wow.log.max-poll-interval, wow.log.maxPollInterval and the environment variable WOW_LOG_MAXPOLLINTERVAL are one key.
Keep secrets out of the files. A deployment sets each one as an environment variable from its secret store, such as the database password, SPRING_DATASOURCE_PASSWORD, which the eShop's Kubernetes manifests take from a Secret.
Write the values
| Value | Written as |
|---|---|
| A duration | 500ms, 30s, 5m, or ISO-8601 PT30S |
| A list | A YAML list, or a comma-separated string from an environment variable: WOW_HTTP_REQUESTFACTS=X-Region,X-Channel |
| A key of a map that holds dots | In brackets: wow.aggregates.[eshop-ordering.order].tenant, wow.subscriptions.[eshop-ordering.OrderSummaryProjection.onEvent].start |
In YAML, quote a bracketed key so the brackets stay part of it:
wow:
subscriptions:
"[eshop-ordering.ShipmentNotifier.onOrderShipped]":
retry:
max-attempts: 8Names are checked
The host refuses to start on a name that matches nothing it serves, rather than ignoring it: a subscription under wow.subscriptions that no handler is, an aggregate type under wow.aggregates the node does not serve, a context under wow.contexts that is on no class path, an id generator nothing provides.
So does a setting that would start and do nothing: a code under wow. in wow.http.errors that the framework does not answer, a standard request fact (app_id, user_agent, remote_ip) in wow.http.request-facts, a wow.ops.publish.context that is no context name, an adaptive query floor above its ceiling, a Kafka min-insync-replicas above the replication-factor the topics are created with. A code of the application's in wow.http.errors that neither the service's Manifest nor a peer contract on the class path declares starts with a warning instead: it may still be right, a domain rejection's code no @ErrorCode declares, a ProblemMapper's, or a peer's whose contract is not on the class path.
Such a failure, and any other value the host cannot start with, is a WowConfigurationException, which Spring Boot reports at the end of the log as a failure analysis instead of a stack of bean creation errors: what is wrong, the key and its value, and the action to take.
Keys are checked
Spring ignores a key no property binds, so a misspelled key would leave its default in place without a word. When the host starts, it binds every wow.* key of the configuration metadata on the class path, and every option a provider declares, the way it then binds them. It stops on any key under wow that this binding does not read, however the key's root is written: Spring reads Wow.cluster.forward-timeout as wow.cluster.forward-timeout, so Wow.cluster.forward-timout is refused as wow.cluster.forward-timout is. A key Spring reads outside wow (wowza.region) is left alone, and so is one whose root itself is misspelt (wwo.cluster.forward-timeout): Spring does not read it as Wow's, and the check cannot tell it from another library's key. Under wow:
- An unknown key stops the start, naming it, and the module that declares it when that module is not on the class path; the message points at the migration guide's configuration page, which maps the keys of earlier versions to today's.
- A key under one read as a single value is unknown.
wow.kafka.bootstrap-serversis one comma-separated string, sowow.kafka.bootstrap-servers[0]is refused rather than leaving Kafka unconfigured. - Under a map of settings (
wow.aggregates,wow.stores,wow.subscriptions,wow.schedules,wow.callers,wow.peers,wow.http.errors), each entry's own keys are checked to their leaves: a mistypedcommandswould otherwise leave a service allowed to call every command. A store's settings are read only under a store that has itstype. - A key left empty (
wow.cluster.forward-timeout:in a file,WOW_WAIT_MAXTIMEOUT=,wow.ddl: ${DDL:}) is read, and its default applies. - An entry of a map of settings given an empty value (
basket: {}underwow.callers, orbasket:with nothing after it) is bound as its defaults, and Spring then reads no key under that entry from any source:WOW_CALLERS_BASKET_COMMANDS_0beside it would be dropped. Such a key stops the start underWow configuration keys under an entry given an empty value, naming the entry and the property source that gives it the empty value; its spelling is checked once the entry reads it. Where the key writes the entry's name, remove the empty value: the keys the other sources give under the entry then set it. A variable cannot write a name with a dash, a dot or a capital letter (ordering-service): removed, the empty value would letWOW_CALLERS_ORDERINGSERVICE_COMMANDS_0make another entry,orderingservice, and leaveordering-servicewithout its list. Keep such an entry, with a key of its own in the application's file in place of the empty value (commands: []), and the variable, in the legacy form (WOW_CALLERS_ORDERING_SERVICE_COMMANDS_0), overrides it. - A group of settings given an empty value (
wow.cluster:with nothing after it) stops the start underWow configuration groups given an empty value, naming the property source. Nothing reads such a value, and it can hide the group's keys from every source: Spring binds settings given an empty value as their defaults, which dropsWOW_CLUSTER_FORWARDTIMEOUTbeside it. Remove it. - A single value where settings go stops the start, with keys under it or without:
WOW_PEERS_ORDERING=http://xbeside the file'swow.peers.ordering.timeoutis passed over by Spring, which builds the peer from its timeout. - A value at
wowitself (wow: x) stops the start underA value at wow itself, which nothing reads, naming its source, when any source gives it as a key, and never as a variable (WOWis left alone): Wow's settings are the keys under it, so remove the value. An emptywow:, orwow: {}, hides nothing and is accepted.
A value the key cannot take stops the start too. Spring Boot binds the host's settings before the check runs, lazily initialized or not, so for wow.peers.ordering.timeout: soon the log carries Spring Boot's failure analysis, Failed to bind properties under 'wow.peers.ordering.timeout' to java.time.Duration, with the property, its value and where it was set. The check refuses a value no binding before it met, such as a single value where a map or nested settings go, under Wow configuration values that cannot be read: it names the key and the property source it was set in, and says what the key takes (its type, an enumeration's values, or the keys that go under it), never the value, which may be a secret.
An environment variable named after a Wow group (WOW_KAFKA_…, WOW_CLUSTER_…: the first word of a key), in any case, is checked the same way: Spring reads wow_cluster_forwardtimeout too, so wow_cluster_forwardtimout is refused like WOW_CLUSTER_FORWARDTIMOUT. It is known when Spring reads it for a key in either of Spring's forms: underscores as dots with dashes left out (WOW_COSEC_TENANTLEVEL_ROLES), or the legacy form with dashes written as underscores too (WOW_COSEC_TENANT_LEVEL_ROLES). So a mistyped WOW_CLUSTER_FORWARDTIMOUT refuses the start like wow.cluster.forward-timout; give a variable of your own a name outside these groups. A variable in neither form, some dashes left out and some written as underscores (WOW_LOG_MAX_POLLINTERVAL for wow.log.max-poll-interval), is read by nothing, and refused. A variable whose first word is not a group is left alone, whatever its later words and its case (WOW_APP_KAFKA_URL, wow_pg_password).
A variable cannot write the dash or the dot of a map entry's name, because Spring takes its first word after the map as the entry:
- An entry whose name holds a dot (
wow.aggregates.[shop.cart], a subscription, a dotted error code) is set in the configuration alone. A variable written for it (WOW_AGGREGATES_SHOP_CART_TENANT) is refused. - An entry whose name holds a dash (
wow.peers.eshop-ordering) is defined in the application's file. A variable then overrides its settings in the legacy form, every dash of the key written as an underscore, the entry's and the setting's (WOW_PEERS_ESHOP_ORDERING_PUBLIC_URLforwow.peers.eshop-ordering.public-url). Without that entry the variable reaches nothing, and it is refused, saying so. - Under the chart's
settings, the entry comes asSPRING_APPLICATION_JSON, which overrides every variable: beside it, a variable can only add a setting the tree leaves out. - Written with the dashes left out (
WOW_PEERS_ESHOPORDERING_URL), the variable gives the map a second entry,eshopordering, beside the configuration's; underwow.storesthat is a second store. It is refused, naming the variable to write instead. Alone, it gives the map an entryeshopordering, which no peer namedeshop-orderingmatches. - Two entries of one map that Spring takes for one name are refused the same way, wherever they are written. Spring compares the names without their dashes, underscores and case, except a name in brackets, which it compares as written:
wow.stores.main_storebesidewow.stores.main-storeis refused, naming the entry to keep, the one with the most dashes;wow.peers.Orderingbesidewow.peers.orderingis refused, naming both.
The variables Kubernetes gives a pod for a Service named wow-<group> are left alone (Kubernetes).
What must match across nodes
The nodes of one service form one cluster, so some settings must be the same on every node, and should change only as the reference describes:
- The service's name:
spring.application.name, orwow.servicewhen that is set. It is the name the service's build gives it (wow { service }): a node built with Wow's Gradle plugin refuses to start under another, naming the key to change. A node built without the plugin carries no build name, and its name is not checked (Add Wow to an Existing Service). wow.log.partitions: a power of two that divides 4,096 (64 by default), fixed once the log holds entries. Choose it before the first deployment.- The stores and the placement of each aggregate type:
wow.backend,wow.stores,wow.log.store,wow.snapshot.*,wow.aggregates.*.log.
What Wow derives
A node derives these values from its environment, so most services set none of them. Each key overrides what it derives:
| Value | Derived from | Key |
|---|---|---|
| The service's name, which must be its build's | spring.application.name | wow.service |
| The node's id | A new one each start | wow.node.id |
| The address the node advertises, and the one its internal port binds | 127.0.0.1 in a development profile; otherwise the address this host's name resolves to, refused when it is a public address | wow.node.address, wow.internal.host |
| The state cache | A tenth of the maximum heap, split between the node's contexts | wow.state-cache.capacity |
| How many queries a store runs at once | Its pool: a quarter of a pool the appends share (at least 2), as on MongoDB or on PostgreSQL without a query-data-source; all of a pool of the queries' own, such as a PostgreSQL query-data-source; 16 when the pool does not say its size | wow.query.max-concurrent |
A topic's partitions, replication and min.insync.replicas | The log's partitions; the broker's defaults | wow.log.partitions, wow.kafka.topics.* |
| The backend | The application's DataSource or MongoClient | wow.backend |
| The topic transport | Kafka once wow.kafka.bootstrap-servers is set; in-JVM topics in development | wow.transport |
| Where snapshots are kept, and the store a type's queries read | The log's store; the type's own store | wow.snapshot.store, wow.aggregates.[<context>.<aggregate>].snapshot.store and .query.snapshot.store |
| A peer's nodes | DNS SRV records named after the service its contract names (Configure a peer), or a Spring Cloud service registry (Spring Cloud Discovery) | wow.peer.discovery, wow.peers.<context>.url |
| The client's address behind the gateway | The forwarded headers the gateway writes (server.request.header.forwarded.strategy: web-server) | server.request.header.forwarded.strategy (or the deprecated server.forward-headers-strategy, not both) |
Development and production
A few defaults relax in a development profile, dev or local (wow.dev-profiles), and nowhere else. A profile named test or demo is not one unless wow.dev-profiles lists it: such a profile is often a shared environment's, which must not take its callers from request headers or keep its data in memory. An address states nothing: a node whose wow.internal.host or wow.node.address is a loopback address, or whose host name resolves to one (127.0.1.1 in Debian's /etc/hosts), is a production node without such a profile.
| Without | In development | In production |
|---|---|---|
A DataSource or MongoClient | Runs in memory, with a warning | Refuses to start |
wow.internal.host | The internal port binds 127.0.0.1 | The internal port binds the address this host's name resolves to, and refuses a public one |
So a laptop needs no database, and a production node cannot start without one. wow.ddl: validate keeps a production node from creating tables (PostgreSQL).
See what the node took
Spring Boot Actuator's configprops and env endpoints, when the application exposes them, show the values each key is bound to. Expose them on a management port only: they show the configuration of the node.