Configuration

Note: This page is for internal Ensign development and will probably not be very useful to Ensign users.

Ensign services are primarily configured using environment variables and will respect dotenv files in the current working directory. The canonical reference of the configuration for an Ensign service is the config package of that service (described below). This documentation enumerates the most important configuration variables, their default values, and any hints or warnings about how to use them.

Required Configuration
If a configuration parameter does not have a default value that means it is required and must be specified by the user! If the configuration parameter does have a default value then that environment variable does not have to be set.

Ensign

The Ensign node is a replica of the Ensign eventing system. Its environment variables are all prefixed with the ENSIGN_ tag. The primary configuration is as follows:

EnvVarTypeDefaultDescription
ENSIGN_MAINTENANCEboolfalseSet node to maintenance mode, which will respond to requests with Unavailable except for status requests.
ENSIGN_LOG_LEVELstringinfoThe verbosity of logging, one of trace, debug, info, warn, error, fatal, or panic.
ENSIGN_CONSOLE_LOGboolfalseIf true will print human readable logs instead of JSON logs for machine consumption.
ENSIGN_BIND_ADDRstring:5356The address and port the Ensign service will listen on.

Monitoring

Ensign uses Prometheus for metrics and observability. The Prometheus metrics server is configured as follows:

EnvVarTypeDefaultDescription
ENSIGN_MONITORING_ENABLEDbooltrueIf true, the Prometheus metrics server is served.
ENSIGN_MONITORING_BIND_ADDRstring:1205The address and port the metrics server will listen on.
ENSIGN_MONITORING_NODE_IDstringOptional - a server name to tag metrics with.

Storage

The Ensign storage configuration defines on disk where Ensign keeps its data. Configure storage as follows:

EnvVarTypeDefaultDescription
ENSIGN_STORAGE_READ_ONLYboolfalseIf true then no writes or deletes will be allowed to the database.
ENSIGN_STORAGE_DATA_PATHstringThe path to a directory on disk where Ensign will store its meta and event data.
ENSIGN_STORAGE_TESTINGboolfalseIf true then a mock store will be opened rather than a leveldb store (should not be used in production).

Note that the Ensign data path must be to a directory. If the directory does not exist, it is created. An error occurs if the path is to a file or the process doesn’t have permissions to access the directory. Ensign will open two different data stores in the data path: one for metadata and the other to store event data locally.

If the testing flag is set to true, a mock store is created that can be used in unit and integration tests.

Authentication

Ensign uses Quarterdeck to authenticate and authorize requests. This configuration defines how Ensign accesses public keys for JWT verification and how the authentication interceptor behaves.

EnvVarTypeDefaultDescription
ENSIGN_AUTH_KEYS_URLstringhttps://auth.rotational.app/.well-known/jwks.jsonThe path to the public keys used to verify JWT tokens.
ENSIGN_AUTH_AUDIENCEstringhttps://ensign.rotational.appThe audience to verify inside of JWT tokens.
ENSIGN_AUTH_ISSUERstringhttps://auth.rotational.appThe issuer to verify inside of JWT tokens.
ENSIGN_AUTH_MIN_REFRESH_INTERVALduration5mThe minimum time to wait before refreshing the JWKS public keys in the validator.

Sentry

Ensign uses Sentry to assist with error monitoring and performance tracing. Configure Ensign to use Sentry as follows:

EnvVarTypeDefaultDescription
ENSIGN_SENTRY_DSNstringThe DSN for the Sentry project. If not set then Sentry is considered disabled.
ENSIGN_SENTRY_SERVER_NAMEstringOptional - a server name to tag Sentry events with.
ENSIGN_SENTRY_ENVIRONMENTstringThe environment to report (e.g. development, staging, production). Required if Sentry is enabled.
ENSIGN_SENTRY_RELEASEstring{{version}}Specify the release of Ensign for Sentry tracking. By default this will be the package version.
ENSIGN_SENTRY_TRACK_PERFORMANCEboolfalseEnable performance tracing to Sentry with the specified sample rate.
ENSIGN_SENTRY_SAMPLE_RATEfloat640.2The percentage of transactions to trace (0.0 to 1.0).
ENSIGN_SENTRY_DEBUGboolfalseSet Sentry to debug mode for testing.
|

Sentry is considered enabled if a DSN is configured. Performance tracing is only enabled if Sentry is enabled and track performance is set to true. If Sentry is enabled, an environment is required, otherwise the configuration will be invalid.

Generally speaking, Ensign should enable Sentry for panic reports but should not enable performance tracing as this slows down the server too much. Note also that the sentry.Config object has a field Repanic that should not be set by the user. This field is used to manage panics in chained interceptors.

Tenant

The Tenant API powers the user front-end for tenant management and configuration. Its environment variables are all prefixed with the TENANT_ tag. The primary configuration is as follows:

EnvVarTypeDefaultDescription
TENANT_MAINTENANCEboolfalseSets the server to maintenance mode, which will respond to requests with Unavailable except for status requests.
TENANT_BIND_ADDRstring:8080The address and port the Tenant service will listen on.
TENANT_MODEstringreleaseSets the Gin mode, one of debug, release, or test.
TENANT_LOG_LEVELstringinfoThe verbosity of logging, one of trace, debug, info, warn, error, fatal, or panic.
TENANT_CONSOLE_LOGboolfalseIf true will print human readable logs instead of JSON logs for machine consumption.
TENANT_ALLOW_ORIGINSstringhttp://localhost:3000A comma separated list of allowed origins for CORS. Set to “*” to allow all origins.

Authentication

Tenant uses Quarterdeck to authenticate and authorize requests. The following configuration defines how Tenant validates JWT tokens passed in from the user that were created by Quarterdeck and secures cookies:

EnvVarTypeDefaultDescription
TENANT_AUTH_KEYS_URLstringhttps://auth.rotational.app/.well-known/jwks.jsonThe path to the public keys used to verify JWT tokens.
TENANT_AUTH_AUDIENCEstringhttps://rotational.appThe audience to verify inside of JWT tokens.
TENANT_AUTH_ISSUERstringhttps://auth.rotational.appThe issuer to verify inside of JWT tokens.
TENANT_AUTH_COOKIE_DOMAINstringrotational.appDefines the domain that is set on cookies including CSRF cookies and token cookies.

Database

Tenant connects to a replicated trtl database for its data storage; the trtl connection is configured as follows:

EnvVarTypeDefaultDescription
TENANT_DATABASE_URLstringtrtl://localhost:4436The endpoint of the trtl database including the scheme (usually the k8s trtl service).
TENANT_DATABASE_INSECUREbooltrueConnect to the trtl database without TLS (default true inside of a k8s cluster).
TENANT_DATABASE_CERT_PATHstringThe path to the mTLS certificate of the client to connect to trtl in an authenticated fashion.
TENANT_DATABASE_POOL_PATHstringThe path to an x509 pool file with trusted trtl servers to connect to in.

Quarterdeck

Tenant connects directly to Quarterdeck in order to send pass-through requests from the user (e.g. for registration, login, etc). This is separate from the authentication configuration used in middleware as this configuration is used to setup a Quarterdeck API client.

EnvVarTypeDefaultDescription
TENANT_QUARTERDECK_URLstringhttps://auth.rotational.appThe Quarterdeck endpoint to create the API client on.
TENANT_QUARTERDECK_WAIT_FOR_READYduration5mThe amount of time to wait for Quarterdeck to come online before exiting with fatal.

SendGrid

Tenant uses SendGrid to assist with email notifications. Configure Tenant to use SendGrid as follows:

EnvVarTypeDefaultDescription
TENANT_SENDGRID_API_KEYstringAPI Key to authenticate to SendGrid with.
TENANT_SENDGRID_FROM_EMAILstringensign@rotational.ioThe email address in the “from” field of emails being sent to users.
TENANT_SENDGRID_ADMIN_EMAILstringadmins@rotational.ioThe email address to send admin emails to from the server.
TENANT_SENDGRID_ENSIGN_LIST_IDstringA contact list to add users to if they sign up for notifications.
TENANT_SENDGRID_TESTINGboolfalseIf in testing mode no emails are actually sent but are stored in a mock email collection.
TENANT_SENDGRID_ARCHIVEstringIf in testing mode, specify a directory to save emails to in order to review emails being generated.

SendGrid is considered enabled if the SendGrid API Key is set. The from and admin email addresses are required if SendGrid is enabled.

If the Ensign List ID is configured then Tenant will add the contact requesting private beta access to that list, otherwise it will simply add the contact to “all contacts”.

Sentry

Tenant uses Sentry to assist with error monitoring and performance tracing. Configure Tenant to use Sentry as follows:

EnvVarTypeDefaultDescription
TENANT_SENTRY_DSNstringThe DSN for the Sentry project. If not set then Sentry is considered disabled.
TENANT_SENTRY_SERVER_NAMEstringOptional - a server name to tag Sentry events with.
TENANT_SENTRY_ENVIRONMENTstringThe environment to report (e.g. development, staging, production). Required if Sentry is enabled.
TENANT_SENTRY_RELEASEstring{{version}}Specify the release of Ensign for Sentry tracking. By default this will be the package version.
TENANT_SENTRY_TRACK_PERFORMANCEboolfalseEnable performance tracing to Sentry with the specified sample rate.
TENANT_SENTRY_SAMPLE_RATEfloat640.2The percentage of transactions to trace (0.0 to 1.0).
TENANT_SENTRY_DEBUGboolfalseSet Sentry to debug mode for testing.

Sentry is considered enabled if a DSN is configured. Performance tracing is only enabled if Sentry is enabled and track performance is set to true. If Sentry is enabled, an environment is required, otherwise the configuration will be invalid.

Note also that the sentry.Config object has a field Repanic that should not be set by the user. This field is used to manage panics in chained interceptors.

Quarterdeck

The Quarterdeck API handles authentication and authorization as well as API keys and billing management for the Ensign managed service. Its environment variables are all prefixed with the QUARTERDECK_ tag. The primary configuration is as follows:

EnvVarTypeDefaultDescription
QUARTERDECK_MAINTENANCEboolfalseSets the server to maintenance mode, which will respond to requests with Unavailable except for status requests.
QUARTERDECK_BIND_ADDRstring:8088The address and port the Quarterdeck service will listen on.
QUARTERDECK_MODEstringreleaseSets the Gin mode, one of debug, release, or test.
QUARTERDECK_LOG_LEVELstringinfoThe verbosity of logging, one of trace, debug, info, warn, error, fatal, or panic.
QUARTERDECK_CONSOLE_LOGboolfalseIf true will print human readable logs instead of JSON logs for machine consumption.
QUARTERDECK_ALLOW_ORIGINSstringhttp://localhost:3000A comma separated list of allowed origins for CORS. Set to “*” to allow all origins.
QUARTERDECK_VERIFY_BASE_URLstringhttps://rotational.app/verifyThe base url to generate verify email links to direct the user to in the email verification path.

SendGrid

Quarterdeck uses SendGrid to assist with email notifications. Configure Quarterdeck to use SendGrid as follows:

EnvVarTypeDefaultDescription
QUARTERDECK_SENDGRID_API_KEYstringAPI Key to authenticate to SendGrid with.
QUARTERDECK_SENDGRID_FROM_EMAILstringensign@rotational.ioThe email address in the “from” field of emails being sent to users.
QUARTERDECK_SENDGRID_ADMIN_EMAILstringadmins@rotational.ioThe email address to send admin emails to from the server.
QUARTERDECK_SENDGRID_ENSIGN_LIST_IDstringA contact list to add users to if they sign up for notifications.
QUARTERDECK_SENDGRID_TESTINGboolfalseIf in testing mode no emails are actually sent but are stored in a mock email collection.
QUARTERDECK_SENDGRID_ARCHIVEstringIf in testing mode, specify a directory to save emails to in order to review emails being generated.

SendGrid is considered enabled if the SendGrid API Key is set. The from and admin email addresses are required if SendGrid is enabled.

If the Ensign List ID is configured then Quarterdeck will add the contact to that list to ensure they receive marketing emails about Ensign.

Rate Limit

In order to prevent brute force attacks on the Quarterdeck system we’ve implemented a rate limiting middleware to prevent abuse. Rate limiting is configured as follows:

EnvVarTypeDefaultDescription
QUARTERDECK_RATE_LIMIT_PER_SECONDfloat6410The maximum number of allowed requests per second.
QUARTERDECK_RATE_LIMIT_BURSTint30Maximum number of requests that is used to track rate of requests (if zero then all requests will be rejected)
QUARTERDECK_RATE_LIMIT_TTLduration5mHow long an IP address is cached for rate limiting purposes.

It is strongly recommended that the default configuration is used.

Database

EnvVarTypeDefaultDescription
QUARTERDECK_DATABASE_URLstringsqlite3:////data/db/quarterdeck.dbThe DSN for the sqlite3 database.
QUARTERDECK_DATABASE_READ_ONLYboolfalseIf true only read-only transactions are allowed.

Quarterdeck uses a Raft replicated Sqlite3 database for authentication. The URI should have the scheme sqlite3:// and then a path to the database. For a relative path, use sqlite3:///path/to/relative.db and for an absolute path use sqlite3:////path/to/absolute.db.

Tokens

EnvVarTypeDefaultDescription
QUARTERDECK_TOKEN_KEYSmap[string]stringThe private keys to load into quarterdeck to issue JWT tokens with.
QUARTERDECK_TOKEN_AUDIENCEstringhttps://rotational.appThe audience to add to the JWT keys for verification.
QUARTERDECK_TOKEN_REFRESH_AUDIENCEstringAn optional additional audience to add only to refresh tokens.
QUARTERDECK_TOKEN_ISSUERstringhttps://auth.rotational.appThe issuer to add to the JWT keys for verification.
QUARTERDECK_TOKEN_ACCESS_DURATIONduration1hThe amount of time that an access token is valid for before it expires.
QUARTERDECK_TOKEN_REFRESH_DURATIONduration2hThe amount of time that a refresh token is valid for before it expires.
QUARTERDECK_TOKEN_REFRESH_OVERLAPduration-15mA negative duration that sets how much time the access and refresh tokens overlap in time validity.

To create an environment variable that is a map[string]string use a string in the following form:

key1:value1,key2:value2

The token keys should be ULIDs keys (for ordering) and a path value to the key pair to load from disk. Generally speaking there should be two keys - the current key and the most recent previous key, though more keys can be added for verification. Only the most recent key will be used to issue tokens, however. For example, here is a valid key map:

01GECSDK5WJ7XWASQ0PMH6K41K:/data/keys/01GECSDK5WJ7XWASQ0PMH6K41K.pem,01GECSJGDCDN368D0EENX23C7R:/data/keys/01GECSJGDCDN368D0EENX23C7R.pem

Future Feature
Note that in the future quarterdeck will generate its own keys and will not need them to be set as in the configuration above.

Reporting

Ensign has a Daily PLG report that is sent to the Rotational admins for product led growth. This reporting tool is configured as follows:

EnvVarTypeDefaultDescription
QUARTERDECK_REPORTING_ENABLE_DAILY_PLGbooltrueEnables the Daily PLG report scheduler.
QUARTERDECK_REPORTING_DOMAINstring“rotational.app”The domain that the report is being generated for.
QUARTERDECK_REPORTING_DASHBOARD_URLstringURL to the Grafana dashboard to include in the email.

Sentry

Quarterdeck uses Sentry to assist with error monitoring and performance tracing. Configure Quarterdeck to use Sentry as follows:

EnvVarTypeDefaultDescription
QUARTERDECK_SENTRY_DSNstringThe DSN for the Sentry project. If not set then Sentry is considered disabled.
QUARTERDECK_SENTRY_SERVER_NAMEstringOptional - a server name to tag Sentry events with.
QUARTERDECK_SENTRY_ENVIRONMENTstringThe environment to report (e.g. development, staging, production). Required if Sentry is enabled.
QUARTERDECK_SENTRY_RELEASEstring{{version}}Specify the release of Ensign for Sentry tracking. By default this will be the package version.
QUARTERDECK_SENTRY_TRACK_PERFORMANCEboolfalseEnable performance tracing to Sentry with the specified sample rate.
QUARTERDECK_SENTRY_SAMPLE_RATEfloat640.2The percentage of transactions to trace (0.0 to 1.0).
QUARTERDECK_SENTRY_DEBUGboolfalseSet Sentry to debug mode for testing.

Sentry is considered enabled if a DSN is configured. Performance tracing is only enabled if Sentry is enabled and track performance is set to true. If Sentry is enabled, an environment is required, otherwise the configuration will be invalid.

Note also that the sentry.Config object has a field Repanic that should not be set by the user. This field is used to manage panics in chained interceptors.

Beacon

A React app delivers Beacon, the Ensign UI. Its environment variables are all prefixed with the REACT_APP tag. The primary configuration is as follows:

EnvVarTypeDefaultDescription
REACT_APP_VERSION_NUMBERstringThe version number of the application build (set by tags in GitHub actions).
REACT_APP_GIT_REVISIONstringThe git revision (short) of the application build (set by tags in GitHub actions).
REACT_APP_USE_DASH_LOCALEboolfalseIf true the “dash” language is included for i18n debugging.

API Information

Connection information for the backend is specified as follows:

EnvVarTypeDefaultDescription
REACT_APP_QUARTERDECK_BASE_URLstringhttps://auth.rotational.app/v1The endpoint and the version of the API to connect to Quarterdeck on.
REACT_APP_TENANT_BASE_URLstringhttps://api.rotational.app/v1The endpoint and the version of the API to connect to Tenant on.

Google Analytics

The React app uses Google Analytics to monitor website traffic. Configure the React app to use Google Analytics as follows:

EnvVarTypeDefaultDescription
REACT_APP_ANALYTICS_IDstringGoogle Analytics tracking ID for the React App.

Sentry

The React app uses Sentry to assist with error monitoring and performance tracing. Configure the React app to use Sentry as follows:

EnvVarTypeDefaultDescription
REACT_APP_SENTRY_DSNstringThe DSN for the Sentry project. If not set then Sentry is considered disabled.
REACT_APP_SENTRY_ENVIRONMENTstringThe environment to report (e.g. development, staging, production). Required if Sentry is enabled.
REACT_APP_SENTRY_EVENT_IDstring

Sentry is considered enabled if a DSN is configured. If Sentry is enabled, an environment is strongly suggested, otherwise the NODE_ENV environment will be used.

Development

Keep up to Date!
It is essential that we keep this configuration documentation up to date. The devops team uses it to ensure its services are configured correctly. Any time a configuration is changed ensure this documentation is also updated!

TODO: this section will discuss confire, how to interpret environment variables from the configuration struct, how to test configuration, and how to add and change configuration variables. This section should also discuss dotenv files, docker compose, and all of the places where configuration can be influenced (e.g. GitHub actions for React builds).

call to action

Feeling stuck?

You don’t have to tough this out on your own. We’re nice and easy to talk to.

Just Ask!