https://github.com/axiom-data-science/docker-erddap

A feature full Tomcat (SSL over APR, etc.) running ERDDAP

https://github.com/axiom-data-science/docker-erddap

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 11 committers (9.1%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.9%) to scientific vocabulary

Keywords

erddap ocean-sciences

Keywords from Contributors

archival versions sequences generic projection interactive finite-volume optim urban controllers
Last synced: 5 months ago · JSON representation

Repository

A feature full Tomcat (SSL over APR, etc.) running ERDDAP

Basic Info
  • Host: GitHub
  • Owner: axiom-data-science
  • Language: Shell
  • Default Branch: main
  • Homepage:
  • Size: 126 KB
Statistics
  • Stars: 17
  • Watchers: 10
  • Forks: 26
  • Open Issues: 5
  • Releases: 7
Topics
erddap ocean-sciences
Created about 10 years ago · Last pushed about 1 year ago
Metadata Files
Readme

README.md

ERDDAP on Docker

ERDDAP docker image with experimental features (datasets.d, see below).

Upstream Official ERDDAP Docker Image

As of version v2.27.0 this image (axiom/docker-erddap) is derived from the official ERDDAP Docker image (erddap/erddap).

If you are not using any experimental functionality offered by the axiom image (notably datasets.d), you are recommended to use the official ERDDAP Docker image instead.

See https://hub.docker.com/r/erddap/erddap for more details.

Versions

Most recent versions:

  • axiom/docker-erddap:latest
  • axiom/docker-erddap:v2.27.0
  • axiom/docker-erddap:2.25.1-jdk21-openjdk

See all versions available here. As always, consult the ERDDAP Changes documentation before upgrading your server.

Use any of the latest-* images with caution as they follow the upstream image, and is not as thoroughly tested as tagged images.

Breaking changes

  • v2.27.0 ** CORS is now off by default. To enable it, set ERDDAP_enableCors=true.

Quickstart

bash docker run -d -p 8080:8080 axiom/docker-erddap:latest-jdk21-openjdk

Running ERDDAP CLI Tools

GenerateDatasetsXml

bash docker run --rm -it \ -v $(pwd)/logs:/erddapData/logs \ --workdir /usr/local/tomcat/webapps/erddap/WEB-INF \ axiom/docker-erddap:latest \ bash GenerateDatasetsXml.sh -verbose

or, generate a basic dataset configuration without input for later customization

bash ./make-dataset-xml.sh /path/to/your.csv EDDTableFromAsciiFiles > /path/to/your-dataset.xml

Configuration

Tomcat

See these instructions for configuring Tomcat from the Tomcat image this image borrows from (unidata/tomcat-docker).

CORS

CORS is off by default. To enable it, set ERDDAP_enableCors=true.

ERDDAP

Any number of these options can be taken to configure your ERDDAP container instance to your liking.

  1. Mount your own content/erddap directory:

    bash docker run \ -p 8080:8080 \ -v /path/to/your/erddap/directory:/usr/local/tomcat/content/erddap \ ... \ axiom/docker-erddap

    Your content directory should contain a setup.xml and dataset.xml file. It can also include CSS assets that you reference in your custom setup.xml file.

    If you just want to change setup.xml and dataset.xml, you can mount them individually:

    bash $ docker run \ -p 8080:8080 \ -v /path/to/your/setup.xml:/usr/local/tomcat/content/erddap/setup.xml \ -v /path/to/your/datasets.xml:/usr/local/tomcat/content/erddap/datasets.xml \ ... \ axiom/docker-erddap

    If you mount setup.xml file make sure to set <bigParentDirectory>/erddapData/</bigParentDirectory>

  2. Configure using environmental variables

    You can set environmental variables to configure ERDDAP's setup.xml since version 2.14. See the ERDDAP documentation for details. This can be very useful so you don't need to mount a custom setup.xml file into your container. If taking this approach you should look into setting the following ERDDAP config options:

* `ERDDAP_baseUrl`
* `ERDDAP_baseHttpsUrl`
* `ERDDAP_flagKeyKey`
* `ERDDAP_emailEverythingTo`
* `ERDDAP_emailFromAddress`
* `ERDDAP_emailUserName`
* `ERDDAP_emailPassword`
* `ERDDAP_emailSmtpHost`
* `ERDDAP_emailSmtpPort`
* `ERDDAP_adminInstitution`
* `ERDDAP_adminInstitutionUrl`
* `ERDDAP_adminIndividualName`
* `ERDDAP_adminPosition`
* `ERDDAP_adminPhone`
* `ERDDAP_adminAddress`
* `ERDDAP_adminCity`
* `ERDDAP_adminStateOrProvince`
* `ERDDAP_adminPostalCode`
* `ERDDAP_adminCountry`
* `ERDDAP_adminEmail`

For example:

```bash
docker run \
    -p 8080:8080 \
    -e ERDDAP_baseURL="http://localhost:8080" \
    -e ERDDAP_adminEmail="set_via_container_env@example.com" \
    axiom/docker-erddap
```

**Depending on your container environment, it may pass in it's own environment variables relating to your resources. Potentially there could be a collision with the `ERDDAP_*` config variables if any of your resources start with ERDDAP.**
  1. Configure using a shell script

    You can mount a file called config.sh to ${CATALINA_HOME}/bin/config.sh that sets any ERDDAP configuration environmental variables you want to use. This is sourced in the container-provided setenv.sh file and and all variables will be exported to be used by ERDDAP for configuration. These will take precedence over environmental variable specified when running the container (see above).

    bash $ docker run \ -p 8080:8080 \ -e ERDDAP_adminEmail="overridden_by_config_file@example.com" \ -v /path/to/your/config.sh:/usr/local/tomcat/bin/config.sh \ ... \ axiom/docker-erddap

    where config.sh contains any of the ERDDAP environmental configuration variables:

    sh ERDDAP_adminEmail="this_is_used@example.com"

    You can set any number of configuration variables in the config.sh.

    ```bash ERDDAPbigParentDirectory="/erddapData/" ERDDAPbaseUrl="http://localhost:8080" ERDDAPbaseHttpsUrl="https://localhost:8443" ERDDAPflagKeyKey="73976bb0-9cd4-11e3-a5e2-0800200c9a66"

    ERDDAPemailEverythingTo="nobody@example.com" ERDDAPemailDailyReportTo="nobody@example.com" ERDDAPemailFromAddress="nothing@example.com" ERDDAPemailUserName="" ERDDAPemailPassword="" ERDDAPemailProperties="" ERDDAPemailSmtpHost="" ERDDAPemailSmtpPort=""

    ERDDAPadminInstitution="Axiom Docker Install" ERDDAPadminInstitutionUrl="https://github.com/axiom-data-science/docker-erddap" ERDDAPadminIndividualName="Axiom Docker Install" ERDDAPadminPosition="Software Engineer" ERDDAPadminPhone="555-555-5555" ERDDAPadminAddress="123 Irrelevant St." ERDDAPadminCity="Nowhere" ERDDAPadminStateOrProvince="AK" ERDDAPadminPostalCode="99504" ERDDAPadminCountry="USA" ERDDAP_adminEmail="nobody@example.com" ```

  2. Mount your own bigParentDirectory:

    bash docker run \ -p 8080:8080 \ -v /path/to/your/erddap/bigParentDirectory:/erddapData \ ... \ axiom/docker-erddap

    This is highly recommended, or nothing will persist across container restarts (logs/cache/etc.)

  3. Specify the amount of heap memory (using Java's Xms and Xmx) to be allocated:

    bash docker run \ -p 8080:8080 \ --env ERDDAP_MEMORY=10G ... \ axiom/docker-erddap

    You may also explicity set ERDDAP_MIN_MEMORY and ERDDAP_MAX_MEMORY value (these map to Xms and Xmx respectively), but generally the best practice is to set these to the same value to prevent costly heap resizing at runtime.

    bash docker run \ -p 8080:8080 \ --env ERDDAP_MIN_MEMORY=8G --env ERDDAP_MAX_MEMORY=8G ... \ axiom/docker-erddap

    Alternatively, you can set ERDDAP_MAX_RAM_PERCENTAGE set the maximum Java heap size to a percentage of the memory available to the container. This option sets the JVM option -XX:MaxRAMPercentage. For example, to limit the container's memory to 10GB and allow the Java heap size to use 90% of that amount:

    bash docker run \ -p 8080:8080 \ --memory 10g \ --env ERDDAP_MAX_RAM_PERCENTAGE=90 \ ... \ axiom/docker-erddap

datasets.d mode - EXPERIMENTAL

Typically ERDDAP is configured with a single datasets.xml configuration file describing all datasets to be served by ERDDAP, plus some global configuration options. This file is described in detail in the official ERDDAP documentation.

docker-erddap provides an alternative datasets.d mode, where datasets.xml dataset elements can be stored in separate files inside a datasets.d directory. At startup time, the /datasets.d directory is scanned for any files ending in .xml, and matching files are concatenated (sorted by file path inside /datasets.d) into a generated datasets.xml file (specifically, an empty <erddapDatasets /> element).

In this mode, top level datasets.xml elements like <cacheMinutes>, <standardLicense>, etc can be configured using ERDDAP_DATASET_* environment variables. These behave much like the ERDDAP_* environment variables which affect setup.xml values (see the ERDDAP docs for more details), but affect top level datasets.xml values instead. For example, to set the standardLicense:

bash docker run -d -v $(pwd)/datasets.d:/datasets.d:ro \ -e ERDDAP_DATASETS_standardLicense="<h1>Use as you wish</h1>" \ --name erddap axiom/docker-erddap

Note that in this mode, the datasets.xml file in the ERDDAP content directory (/usr/local/tomcat/content/erddap) is replaced by the generated datasets.xml. A backup of the original datasets.xml is created if one doesn't already exist.

Consequently, when using datasets.d mode it is not necessary to mount the ERDDAP content directory at all. The contents of datasets.d provide all of the dataset configuration, and any top level datasets.xml configuration is performed through `ERDDAPDATASETS* env vars.

For an example of running with datasets.d mode, see the docker-compose example in examples.

Generation of datasets.xml is handled in a script (datasets.d.sh) which prints to stdout and can be tested outside of docker-erddap initialization.

Example:

shell ERDDAP_DATASETS_cacheMinutes=20 ./datasets.d.sh -d examples/datasets.d

As of version v2.27.0 environment variables in the generated datasets.xml file will also be replaced using envsubst.

Elegantly removing datasets in datasets.d mode

ERDDAP has a specific process to remove a previously served dataset:

  • Edit the dataset's datasets.xml element and set the active attribute to false.
  • Allow ERDDAP to detect the inactive dataset on the next update (or set a reload flag detect the change immediately)
  • Once ERDDAP has removed the dataset, remove the dataset's datasets.xml element (or leave as-is with active="false")

Failure to follow this process will result in "orphan" datasets in the ERDDAP configuration.

To allow datasets.d mode to automatically detect removed datasets (dataset ids in the running ERDDAP configuration but not present in the newly generated datasets.xml), you can set environment variable DATASETSD_MARK_REMOVED_DATASETS_INACTIVE=1 or pass the -i flag to ./datasets.d.sh when running manually. This behavior may become the default in the future.

Initialization scripts (/init.d) - EXPERIMENTAL

Additional configuration can be performed by placing executable files and/or shell scripts in /init.d. These executables will be run on every container start up, so they must be idempotent. This functionality is inspired by the postgres Docker image's /docker-entrypoint-initdb.d.

Example:

```shell

remove .hdf and .nc files from range request exclusion

mkdir -p init.d cat << 'EOF' > init.d/10-remove-hdf-nc-range-request-exclusion.sh sed -i 's/.hdf, .nc, //g' ${CATALINA_HOME}/webapps/erddap/WEB-INF/classes/gov/noaa/pfel/erddap/util/messages.xml EOF

chmod +x init.d/10-remove-hdf-nc-range-request-exclusion.sh

docker run -d -p 8080:8080 -v $(pwd)/init.d:/init.d:ro --name erddap axiom/docker-erddap ```

Log Consolidation - EXPERIMENTAL

ERDDAP writes logs to a logs/log.txt file relative to ERDDAP's bigParentDirectory. The log format doesn't adhere to a standard logging format and isn't easily parsable. The logs also don't provide timestamps for when the logs messages were written. To enhance the logging experience when using this docker image you can run a sidecar rsyslog container that will:

  • Consolidate the log files from ERDDAP and Tomcat (both application and access)
  • Add a timestamp to the ERDDAP logs
  • Filter out some ERDDAP log "noise" (opinionated)
  • Send the consolidated and filtered log messages to stdout

For an example of running with a sidecar rsyslog container, see the docker-compose example in examples. The supporting rsyslog configuration files are located in rsyslog. Please note that this requires both the ERDDAP bigParentDirectory and Tomcat's log directory to be bind mounted to the host from the ERDDAP container or managed in Docker named volumes mounted to both the ERDDAP and rsyslog containers.

Example consolidated log:

log erddap-rsyslogd_1 | [TOMCAT] 08-Jul-2022 04:44:14.004 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] erddap-rsyslogd_1 | [TOMCAT] 08-Jul-2022 04:44:14.011 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 3582 ms ... erddap-rsyslogd_1 | [ERDDAP] 2022-07-08T04:44:19Z Major LoadDatasets Time Series: MLD Datasets Loaded Requests (median times in ms) Number of Threads MB Open erddap-rsyslogd_1 | timestamp time nTry nFail nTotal nSuccess (median) nFail (median) memFail tooMany tomWait inotify other inUse Files erddap-rsyslogd_1 | ---------------------------- ----- ----------------- ------------------------------------------------ --------------------- ----- ----- erddap-rsyslogd_1 | 2022-07-08T04:44:18+00:00 1s 1 0 2 1 ( 8) 0 ( 0) 0 0 10 1 17 44 0% ... erddap-rsyslogd_1 | [ACCESS] 127.0.0.1 - - [08/Jul/2022:04:44:17 +0000] "GET /erddap/index.html HTTP/1.1" 200 25268 erddap-rsyslogd_1 | [ACCESS] 127.0.0.1 - - [08/Jul/2022:04:44:27 +0000] "GET /erddap/index.html HTTP/1.1" 200 25268

Owner

  • Name: Axiom Data Science
  • Login: axiom-data-science
  • Kind: organization
  • Location: United States

GitHub Events

Total
  • Create event: 4
  • Release event: 1
  • Issues event: 6
  • Watch event: 3
  • Member event: 1
  • Issue comment event: 12
  • Push event: 12
  • Pull request event: 8
  • Pull request review comment event: 5
  • Pull request review event: 5
  • Fork event: 2
Last Year
  • Create event: 4
  • Release event: 1
  • Issues event: 6
  • Watch event: 3
  • Member event: 1
  • Issue comment event: 12
  • Push event: 12
  • Pull request event: 8
  • Pull request review comment event: 5
  • Pull request review event: 5
  • Fork event: 2

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 86
  • Total Committers: 11
  • Avg Commits per committer: 7.818
  • Development Distribution Score (DDS): 0.5
Past Year
  • Commits: 14
  • Committers: 2
  • Avg Commits per committer: 7.0
  • Development Distribution Score (DDS): 0.429
Top Committers
Name Email Commits
Kyle Wilcox k****e@a****m 43
Shane St Savage s****e@a****o 18
Alex Kerney a****k@m****m 8
Shane St Savage s****e@a****m 4
Rich Signell r****l@u****v 4
Kyle Wilcox w****e@g****m 3
Filipe Fernandes o****f@g****m 2
Eric Bridger e****r@g****g 1
Nate n****k@h****g 1
dependabot[bot] 4****] 1
Marc Portier m****r@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 2 years ago

All Time
  • Total issues: 30
  • Total pull requests: 39
  • Average time to close issues: 2 months
  • Average time to close pull requests: 9 days
  • Total issue authors: 18
  • Total pull request authors: 10
  • Average comments per issue: 3.0
  • Average comments per pull request: 1.46
  • Merged pull requests: 35
  • Bot issues: 6
  • Bot pull requests: 2
Past Year
  • Issues: 2
  • Pull requests: 8
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 14 hours
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 1.5
  • Average comments per pull request: 0.5
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • github-actions[bot] (11)
  • joefutrelle (4)
  • aded (2)
  • rsignell-usgs (2)
  • srstsavage (2)
  • marc-portier (2)
  • RoryMMMM (2)
  • ebridger (1)
  • sccoos (1)
  • turnbullerin (1)
  • abkfenris (1)
  • MathewBiddle (1)
  • ioulosve (1)
  • sjbruce (1)
  • rustychris (1)
Pull Request Authors
  • srstsavage (26)
  • kwilcox (10)
  • callumrollo (4)
  • abkfenris (4)
  • ocefpaf (3)
  • n-a-t-e (2)
  • dependabot[bot] (2)
  • rsignell-usgs (2)
  • marc-portier (1)
  • jcermauwedu (1)
  • ebridger (1)
  • tjcrone (1)
Top Labels
Issue Labels
erddapversion (11)
Pull Request Labels
dependencies (2)

Dependencies

.github/workflows/erddap_version.yml actions
  • actions/checkout v1 composite
  • actions/github-script v3 composite
.github/workflows/push.yml actions
  • actions/cache v2 composite
  • actions/checkout v1 composite
  • docker/build-push-action v2 composite
  • docker/login-action v1 composite
  • docker/metadata-action v4 composite
  • docker/setup-buildx-action v1 composite
  • ifaxity/wait-on-action v1 composite
Dockerfile docker
  • ${BASE_IMAGE} latest build
examples/docker-compose.yml docker
  • gynter/rsyslog-relp alpine