Configuration¶
Configuration is done via a TOML file located at .erddaputil.toml (using the above Docker
configuration). Use the .erddaputil.example.toml file to create this. Common settings are below,
use the typical TOML format for nested keys to specify them, e.g.:
[erddaputil]
secret_key = "foo"
[erddaputil.erddap]
big_parent_directory = "/erddap_data"
Environment variables can also be used by replacing all periods with underscores in the keys below. This does not work for configuration options that are lists at the moment, such as the peppers.
ERDDAPUtil Core¶
- erddaputil.compile_on_boot¶
- Type: boolRequired:
FalseDefault:trueBy default, ERDDAPUtil will attempt to compile the
datasets.xmlfile on boot. Set this tofalseto prevent this behaviour.
- erddaputil.create_default_user_on_boot¶
- Type: boolRequired:
FalseDefault:trueBy default, ERDDAPUtil will attempt to create a user using
erddaputil.default_usernameanderddaputil.default_passwordon boot or reset the password of that user if it already exists. Set this tofalseto prevent this behaviour.
- erddaputil.default_username¶
- Type: strRequired:
FalseDefault:adminThe username to create on boot, if
erddaputil.create_default_user_on_bootis set.
- erddaputil.default_password¶
- Type: strRequired:
FalseDefault:adminThe password to set for the user created on boot, if
erddaputil.create_default_user_on_bootis set.
- erddaputil.fix_erddap_bpd_permissions¶
- Type: boolRequired:
FalseDefault:trueERDDAP’s BPD requires the Tomcat user have access to create and manage the directories within it. When a Docker volume is used, the permissions are not typically correct. Therefore, ERDDAPUtil attempts to correct this on boot to ensure that ERDDAP is useable by running
os.chown()on it (Linux only). Set this tofalseto prevent this behaviour. The Tomcat user ID and group ID can be specified viaerddaputil.erddap.tomcat_uidanderddaputil.erddap.tomcat_gid.
- erddaputil.metrics_manager¶
- Type: strRequired:
FalseLeave this blank to not use the metrics backend or specify a class that has the methods
send_message(metric: _Metric),start(),terminate(), andjoin(). The first will be called every time a metric needs to be updated,start()is used when the metrics are first loaded, andterminate()andjoin()are called in that sequence when shutting down. Since the metrics manager is typically a separate thread,terminate()should instruct the thread to gracefully exit andstart()andjoin()should be inherited fromthreading.Thread.ERDDAPUtil provides
erddaputil.main.metrics.LocalPrometheusSendThreadwhich uses the HTTP API’s Prometheus metrics.
- erddaputil.secret_key¶
- Type: strRequired:
TrueThis should be a secret that is the same between all servers that will share an AMPQ exchange or daemon and is used to validate that the messages passed are not malicious. It should have at least 192 bits of randomness.
- erddaputil.show_config¶
- Type: boolRequired:
FalseDefault:falseSet to
trueto dump the configuration to stdout on boot. This is useful for debugging.
- erddaputil.use_ampq_exchange¶
- Type: boolRequired:
FalseDefault:falseSet this to
trueto use the AMPQ features.
- erddaputil.use_local_daemon¶
- Type: boolRequired:
FalseDefault:trueSet this to
falseif you want to only send messages to AMPQ from the CLI or HTTP API.
ERDDAP Configuration¶
- erddaputil.erddap.base_url¶
- Type: strRequired:
FalseThe base URL for ERDDAP (e.g.
http://localhost:8080/erddap). Note that, unlike ERDDAP, this should include the/erddappath.
- erddaputil.erddap.big_parent_directory¶
- Type: pathRequired:
FalseSet to the same value as ERDDAP’s
bigParentDirectoryconfiguration value
- erddaputil.erddap.datasets_d¶
- Type: pathRequired:
FalseSet to the directory containing XML files with dataset definitions in them. These should be identical to the ones created for ERDDAP, but each in their own XML file. Each XML file should contain exactly one
<dataset>tag as the root-level element. While ERDDAP requires datasets use ISO-8859-1 encoding, these datasets can use any encoding as long as it is declared and compatible with ISO-8859-1 (illegal characters will be replaced).
- erddaputil.erddap.datasets_xml_template¶
- Type: pathRequired:
FalseBy default, ERDDAPUtil will use an empty
<erddapDatasets>tag to generatedatasets.xml. If you want to supply your own template, provide it here. ERDDAPUtil will only modify it by (a) adding all of the datasets found indatasets.dand (b) updating the block and allow lists. Your template file may use a different character encoding as long as it is ISO-8859-1 compatible.
- erddaputil.erddap.ip_block_list¶
- Type: pathRequired:
FalseA path to a text file of IP addresses, ranges, or subnets to block requests from (one entry per line). Defaults to
{BIG_PARENT_DIRECTORY}/.ip_block_list.txt
- erddaputil.erddap.subscription_block_list¶
- Type: pathRequired:
FalseA path to a text file of emails to block subscriptions for (one email per line). Defaults to
{BIG_PARENT_DIRECTORY}/.email_block_list.txt
- erddaputil.erddap.unlimited_allow_list¶
- Type: pathRequired:
FalseA path to a text file of IP addresses, ranges, or subnets to allow unlimited access to (one entry per line). Defaults to
{BIG_PARENT_DIRECTORY}/.unlimited_allow_list.txt
Tomcat Configuration¶
- erddaputil.tomcat.log_directory¶
- Type: strRequired:
FalseThe directory where Tomcat’s access logs are written to. If omitted, Tomcat log parsing and management will be disabled.
- erddaputil.tomcat.log_prefix¶
- Type: strRequired:
FalseDefault:access_logThe prefix for Tomcat’s access log files (should match the setting in AccessLogValve).
- erddaputil.tomcat.log_suffix¶
- Type: strRequired:
FalseThe suffix for Tomcat’s access log files (should match the setting in AccessLogValve).
- erddaputil.tomcat.log_pattern¶
- Type: strRequired:
FalseDefault:commonThe pattern for Tomcat’s access log files (should match the setting in AccessLogValve).
- erddaputil.tomcat.log_encoding¶
- Type: strRequired:
FalseDefault:utf-8The encoding for Tomcat’s access log files (should match the setting in AccessLogValve).
- erddaputil.tomcat.major_version¶
- Type: intRequired:
FalseDefault:10The major version of Tomcat in use. What is most important is that this is 10 or higher on Tomcat 10+ and under 10 on versions under 10 as this affects how some log strings are parsed.
- erddaputil.tomcat.gid¶
- Type: intRequired:
FalseDefault:1000The group ID that tomcat runs as. This is used only if
erddaputil.fix_erddap_bpd_permissionsis set totrue.
- erddaputil.tomcat.uid¶
- Type: intRequired:
FalseDefault:1000The user ID that tomcat runs as. This is used only if
erddaputil.fix_erddap_bpd_permissionsis set totrue.
Dataset Management¶
- erddaputil.dataset_manager.backups¶
- Type: pathRequired:
FalseIf specified, whenever a new
datasets.xmlfile is generated, the old one will be backed-up into this folder. Backups are cleaned up according to the below retention setting.
- erddaputil.dataset_manager.backup_retention_days¶
- Type: intRequired:
FalseDefault:31Backups of
datasets.xmlare deleted after the given number of days.
- erddaputil.dataset_manager.max_delay_seconds¶
- Type: floatRequired:
FalseDefault:0ERDDAPUtil delays briefly before performing a reload of a dataset, in case another similar request comes in (e.g. if your automation pipeline is pushing dozens of requests at once). This setting allows you to control the longest ERDDAPUtil will wait after the last request for a given dataset to be reloaded before it will execute the request. Set to 0 to always immediately execute every request for a reload.
- erddaputil.dataset_manager.max_pending¶
- Type: intRequired:
FalseDefault:0ERDDAPUtil delays briefly before performing a reload of a dataset, in case another similar request comes in (e.g. if your automation pipeline is pushing dozens of requests at once). This setting allows you to control the maximum number of datasets pending reload; once the threshold is exceeded, the oldest request is executed immediately. Set to 0 to ignore the threshold.
- erddaputil.dataset_manager.max_recompile_delay¶
- Type: floatRequired:
FalseDefault:0Similar to how dataset reloads are delayed, recompilation can also be delayed for similar reasons. ERDDAPUtil will wait until this many seconds have elapsed since the last request for recompilation before actually performing the recompilation. Set to 0 to always recompile immediately when requested.
- erddaputil.dataset_manager.skip_misconfigured_datasets¶
- Type: boolRequired:
FalseDefault:trueWhen recompiling datasets, users may instruct ERDDAPUtil to either skip datasets that are not well-formed XML, raise an error and fail when such a dataset is found, or use the default value. This is the default value; set to
trueto skip the datasets (the default) orfalseto raise an error. Note that failed datasets are still logged by ERDDAPUtil so they can be remedied; iffalse, this mostly means that ERDDAPUtil will not updatedatasets.xmluntil the file is fixed (the default is to omit it fromdatasets.xml)
Log Management¶
- erddaputil.logman.enabled¶
- Type: boolRequired:
FalseDefault:trueSet to
falseto disable log management.
- erddaputil.logman.file_prefixes¶
- Type: listRequired:
FalseDefault:logArchivedAt,logPreviousArchivedAt,emailLogA list of files to remove by prefix. Includes all of ERDDAP’s log files by default.
- erddaputil.logman.retention_days¶
- Type: intRequired:
FalseDefault:31Days to keep ERDDAP log files (i.e. files in
{BIG_PARENT_DIRECTORY}/logs) before removing them.
- erddaputil.logman.sleep_time_seconds¶
- Type: floatRequired:
FalseDefault:3600Number of seconds to wait between log clean-up jobs.
- erddaputil.logman.include_tomcat¶
- Type: boolDefault:
falseWhether to cleanup tomcat log files.
- erddaputil.logman.include_tomtail¶
- Type: boolDefault:
trueWhether to cleanup tomtail output files.
- erddaputil.logman.include_erddap¶
- Type: boolDefault:
trueWhether to cleanup ERDDAP log files.
Tomcat Log Parsing¶
- erddaputil.logman.enabled¶
- Type: boolRequired:
FalseDefault:trueSet to
falseto disable log parsing.
- erddaputil.logman.sleep_time_seconds¶
- Type: floatRequired:
FalseDefault:3600Number of seconds to wait between checking the log files.
- erddaputil.logman.memory_file¶
- Type: strRequired:
FalseDefault:./.tomtail.memFile to save information about the tomcat logs to.
- erddaputil.logman.output_directory¶
- Type: strRequired:
FalseSet to a directory to write output files to.
- erddaputil.logman.output_file_pattern¶
- Type: strRequired:
FalseDefault:erddap_access_log_%Y%m%d.logUsed as a parameter to
strftimeto format the name of the output file. Log files are rotated based on this value returning a different value.
- erddaputil.logman.output_pattern¶
- Type: strRequired:
FalseDefault:%dataset_id %request_type %s %b %T "%U%q"Used to format the output string for the output files. All placeholders below will return “-” if not available in the logs. The
Output Pattern Placeholders¶ Placeholder
Value
%a
Remote IP (see tomcat docs)
%U
Request URI (see tomcat docs)
%T
Request processing time in seconds (see tomcat docs)
%s
Request status (see tomcat docs)
%r
Request first line (see tomcat docs)
%q
Query string (see tomcat docs)
%m
Request method (see tomcat docs)
%h
Host (see tomcat docs)
%b
Bytes (see tomcat docs for %B)
%(request_type)s
Either
web(default),data(for data downloads), ormetadata(metadata downloads)%(dataset_id)s
The ID of the dataset or - if not detected.
%(dap_variables)s
A semi-colon delimited list of DAP variable names included in the request
%(dap_constraints)s
An ampersand delimited list of DAP constraints included in the request
%(dap_grid_bounds)s
A semi-colon delimited list of bounds on a griddap request for ERDDAP
AMPQ Integration¶
- erddaputil.ampq.cluster_name¶
- Type: strRequired:
FalseIf you are using AMPQ, this should be a unique value for each set of ERDDAP machines that should all respond to the same commands.
- erddaputil.ampq.connection¶
- Type: strRequired:
FalseEither a string for
pika.connection.URLParameters(for pika integration) or the connection string (for Azure Service Bus)
- erddaputil.ampq.create_queue¶
- Type: boolRequired:
FalseDefault:trueIf set to false, prevents ERDDAPUtil from automatically trying to create and bind the queue or create the subscription/rules.
- erddaputil.ampq.exchange_name¶
- Type: strRequired:
FalseDefault:erddap_cncThe RabbitMQ exchange name or the Azure Service Bus topic name.
- erddaputil.ampq.hostname¶
- Type: strRequired:
FalseIf you are using AMPQ, this should be a unique value for each machine. Defaults to
socket.gethostname()
- erddaputil.ampq.implementation¶
- Type: strRequired:
FalseDefault:pikaSet to
pikaorazure_service_busdepending which client library to use.
Web API¶
- erddaputil.webapp.enable_management_api¶
- Type: boolRequired:
FalseDefault:trueSet to
falseto disable the management API
- erddaputil.webapp.enable_metrics_collector¶
- Type: boolRequired:
FalseDefault:trueSet to
falseto disable the metrics collector (this is like our own pushgateway)
- erddaputil.webapp.iterations_jitter¶
- Type: intRequired:
FalseDefault:100000ERDDAPUtil uses
hashlib.pbkdf2_hmac()to hash and store user passwords, using a unique salt and number of iterations for each user. The number of iterations will be up to this value higher thanerddaputil.webapp.min_iterations, chosen at random.
- erddaputil.webapp.min_iterations¶
- Type: intRequired:
FalseDefault:700000ERDDAPUtil uses
hashlib.pbkdf2_hmac()to hash and store user passwords, using a unique salt and number of iterations for each user. The number of iterations will be at least this many.
- erddaputil.webapp.password_file¶
- Type: pathRequired:
FalseSet to the path of a file where passwords for the web API will be stored.
- erddaputil.webapp.password_hash¶
- Type: strRequired:
FalseDefault:sha256Set to the name of a hash function supported by
hashlib.
- erddaputil.webapp.peppers¶
- Type: listRequired:
TrueSet to a list of random strings that are hard to guess. The first one will be used to create new passwords and they will all be tried when validating a user’s password.
- erddaputil.webapp.salt_length¶
- Type: intRequired:
FalseDefault:16The length of the salt for new passwords (in bytes). Salts are generated using
secrets.token_urlsafe()
Metrics Manager - LocalPrometheus¶
- erddaputil.localprom.host¶
- Type: strRequired:
FalseDefault:localhostThe host to push statistics to.
- erddaputil.localprom.port¶
- Type: intRequired:
FalseDefault:7193The port to push statistics to
- erddaputil.localprom.username¶
- Type: strRequired:
FalseThe username to login to the web API with.
- erddaputil.localprom.password¶
- Type: strRequired:
FalseThe password to login to the web API with.
- erddaputil.localprom.batch_size¶
- Type: intRequired:
FalseDefault:200The maximum number of metric updates to send it one batch to the web API.
- erddaputil.localprom.batch_wait_seconds¶
- Type: floatRequired:
FalseDefault:2The maximum amount of time to delay sending metrics while waiting for a whole batch.
- erddaputil.localprom.max_retries¶
- Type: intRequired:
FalseDefault:3The maximum number of times to retry sending a batch to the web API before discarding them. Set to
-1to retry forever or0to only try once. When the daemon is being shutdown, this is overridden to not retry at all.
- erddaputil.localprom.max_tasks¶
- Type: intRequired:
FalseDefault:5The maximum number of batches that will be handled at the same time (defaults to 5). Metrics wait in a queue while not being handled.
- erddaputil.localprom.retry_delay_seconds¶
- Type: floatRequired:
FalseDefault:2The delay between retries to send metrics.
Status Scraper¶
- erddaputil.status_scraper.enabled¶
- Type: boolRequired:
FalseDefault:trueSet to
falseto disable the scraping ofstatus.html.
- erddaputil.status_scraper.memory_path¶
- Type: pathRequired:
FalseDefault:./.status_scrape.memSet the path of a file where information about the last scrape of status.html is stored.
- erddaputil.status_scraper.sleep_time_seconds¶
- Type: floatRequired:
FalseDefault:300The time to wait between scrapes.
- erddaputil.status_scraper.start_delay_seconds¶
- Type: floatRequired:
FalseDefault:180.0The time to wait after startup before starting to scrape to give ERDDAP time to boot.
Daemon Service¶
- erddaputil.daemon.host¶
- Type: strRequired:
FalseDefault:127.0.0.1The host the ERDDAP HTTP, CLI, and AMPQ APIs will send messages to.
- erddaputil.daemon.port¶
- Type: intRequired:
FalseDefault:9172The port the ERDDAP HTTP, CLI, and AMPQ APIs will send messages to.
- erddaputil.service.host¶
- Type: strRequired:
FalseDefault:127.0.0.1The IP address the ERDDAPUtil service will listen to.
- erddaputil.service.port¶
- Type: intRequired:
FalseDefault:9172The port the ERDDAPUtil service will listen on.
- erddaputil.service.backlog¶
- Type: intRequired:
FalseDefault:20The backlog of TCP connections that the daemon server will hold.
- erddaputil.service.listen_block_seconds¶
- Type: floatRequired:
FalseDefault:0.25The time to block while waiting for a new connection. Tidying jobs will be run approximately this often.