diff --git a/Dockerfile b/Dockerfile index aaac206..104ba63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ LABEL maintainer="Kyle Wilcox " ENV ERDDAP_VERSION 2.14 ENV ERDDAP_CONTENT_URL https://github.com/BobSimons/erddap/releases/download/v$ERDDAP_VERSION/erddapContent.zip ENV ERDDAP_WAR_URL https://github.com/BobSimons/erddap/releases/download/v$ERDDAP_VERSION/erddap.war -ENV ERDDAP_DATA /erddapData +ENV ERDDAP_bigParentDirectory /erddapData RUN \ curl -fSL "${ERDDAP_CONTENT_URL}" -o /erddapContent.zip && \ @@ -15,13 +15,33 @@ RUN \ rm /erddap.war && \ sed -i 's##\n&#' ${CATALINA_HOME}/conf/context.xml && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ - mkdir -p ${ERDDAP_DATA} + mkdir -p ${ERDDAP_bigParentDirectory} # Java options COPY files/setenv.sh ${CATALINA_HOME}/bin/setenv.sh -# ERDDAP setup.xml -COPY files/setup.xml ${CATALINA_HOME}/content/erddap/setup.xml +# Default configuration +ENV ERDDAP_baseHttpsUrl="https://localhost:8443" \ + ERDDAP_flagKeyKey="73976bb0-9cd4-11e3-a5e2-0800200c9a66" \ + ERDDAP_emailEverythingTo="nobody@example.com" \ + ERDDAP_emailDailyReportsTo="nobody@example.com" \ + ERDDAP_emailFromAddress="nothing@example.com" \ + ERDDAP_emailUserName="" \ + ERDDAP_emailPassword="" \ + ERDDAP_emailProperties="" \ + ERDDAP_emailSmtpHost="" \ + ERDDAP_emailSmtpPort="" \ + ERDDAP_adminInstitution="Axiom Docker Install" \ + ERDDAP_adminInstitutionUrl="https://github.com/axiom-data-science/docker-erddap" \ + ERDDAP_adminIndividualName="Axiom Docker Install" \ + ERDDAP_adminPosition="Software Engineer" \ + ERDDAP_adminPhone="555-555-5555" \ + ERDDAP_adminAddress="123 Irrelevant St." \ + ERDDAP_adminCity="Nowhere" \ + ERDDAP_adminStateOrProvince="AK" \ + ERDDAP_adminPostalCode="99504" \ + ERDDAP_adminCountry="USA" \ + ERDDAP_adminEmail="nobody@example.com" COPY entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md index f4e5dbb..2adbfd2 100644 --- a/README.md +++ b/README.md @@ -50,10 +50,13 @@ See [these instructions for configuring Tomcat](https://github.com/unidata/tomca ### 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 @@ -65,19 +68,106 @@ See [these instructions for configuring Tomcat](https://github.com/unidata/tomca ```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 ``` - **Any custom setup.xml needs to specify `/erddapData/`** + **If you mount setup.xml file make sure to set `/erddapData/`** + +2. Configure using environmental variables + + You can set environmental variables to configure ERDDAP's `setup.xml` since version 2.14. See the [ERDDAP documentation](https://coastwatch.pfeg.noaa.gov/erddap/download/setup.html#setupEnvironmentVariables) 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.** +3. Configure using a shell script -2. Mount your own `bigParentDirectory`: + 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 + ERDDAP_bigParentDirectory="/erddapData/" + ERDDAP_baseUrl="http://localhost:8080" + ERDDAP_baseHttpsUrl="https://localhost:8443" + ERDDAP_flagKeyKey="73976bb0-9cd4-11e3-a5e2-0800200c9a66" + + ERDDAP_emailEverythingTo="nobody@example.com" + ERDDAP_emailDailyReportsTo="nobody@example.com" + ERDDAP_emailFromAddress="nothing@example.com" + ERDDAP_emailUserName="" + ERDDAP_emailPassword="" + ERDDAP_emailProperties="" + ERDDAP_emailSmtpHost="" + ERDDAP_emailSmtpPort="" + + ERDDAP_adminInstitution="Axiom Docker Install" + ERDDAP_adminInstitutionUrl="https://github.com/axiom-data-science/docker-erddap" + ERDDAP_adminIndividualName="Axiom Docker Install" + ERDDAP_adminPosition="Software Engineer" + ERDDAP_adminPhone="555-555-5555" + ERDDAP_adminAddress="123 Irrelevant St." + ERDDAP_adminCity="Nowhere" + ERDDAP_adminStateOrProvince="AK" + ERDDAP_adminPostalCode="99504" + ERDDAP_adminCountry="USA" + ERDDAP_adminEmail="nobody@example.com" + ``` + +4. Mount your own `bigParentDirectory`: + + ```bash + $ docker run \ + -p 8080:8080 \ -v /path/to/your/erddap/bigParentDirectory:/erddapData \ ... \ axiom/docker-erddap @@ -86,11 +176,11 @@ See [these instructions for configuring Tomcat](https://github.com/unidata/tomca This is **highly** recommended, or nothing will persist across container restarts (logs/cache/etc.) -3. Specify the amount of memory to be allocated: +5. Specify the amount of memory to be allocated: ``` bash - $ docker run \ + -p 8080:8080 \ --env ERDDAP_MIN_MEMORY=4G --env ERDDAP_MAX_MEMORY=8G ... \ axiom/docker-erddap diff --git a/files/setenv.sh b/files/setenv.sh index a740bfa..fd7da26 100755 --- a/files/setenv.sh +++ b/files/setenv.sh @@ -1,5 +1,17 @@ #!/bin/sh +if [ -f "${CATALINA_HOME}/bin/config.sh" ]; +then + set -o allexport + source "${CATALINA_HOME}/bin/config.sh" + set +o allexport +fi + +ERDDAP_CONFIG=$(env | grep --regexp "^ERDDAP_.*$" | sort) +if [ -n "$ERDDAP_CONFIG" ]; then + echo "ERDDAP configured with: $ERDDAP_CONFIG" +fi + # JAVA_OPTS MEMORY="${ERDDAP_MEMORY:-4G}" NORMAL="-server -d64 -Xms${ERDDAP_MIN_MEMORY:-${MEMORY}} -Xmx${ERDDAP_MAX_MEMORY:-${MEMORY}}" diff --git a/files/setup.xml b/files/setup.xml deleted file mode 100644 index 04d5a97..0000000 --- a/files/setup.xml +++ /dev/null @@ -1,490 +0,0 @@ - - - - - -info - - -erddap - - -/erddapData/ - - -nobody@example.com -nobody@example.com - - -.* - - -true - - - - - - - - - - - - -UEPMD5 - - -false - - -http://localhost:8080 - - -https://localhost:8443 - - - - - -false - - -original - - -nothing@example.com - - - - - - - - -Axiom Docker Install -https://github.com/axiom-data-science/docker-erddap -Axiom Docker Install -Software Engineer -555-555-5555 -123 Irrelevant St. -Nowhere -AK -99504 -USA -nobody@example.com - - -true - - -NONE -only accessible to authorized users -NONE -earth science, atmosphere, ocean, biosphere, biology, environment - - - - - -UDUNITS - - -true -true - - -true - -true - - -true - - -true -erdBAssta5day -sst - -0,-75,360,75 - - -73976bb0-9cd4-11e3-a5e2-0800200c9a66 - - -true - - -true - - -true - - - - -60 - - -15 - - -240 - - -10000 - - - - -noaa_simple.gif -noaa20.gif -nlogo.gif -QuestionMark.jpg - - - DejaVu Sans - - - - -true - - -global:cdm_data_type, global:institution, ioos_category, global:keywords, long_name, standard_name, variableName - - -under - - -ERDDAP -ERDDAP (the Environmental Research Division's Data Access Program) -is a data server that gives you a simple, consistent way to download -subsets of scientific datasets in common file formats and make graphs and maps. -This particular ERDDAP installation has oceanographic data -(for example, data from satellites and buoys). - -[standardShortDescriptionHtml] - -]]> - - -