-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from axiom-data-science/env-variables
Allow setup.xml configuration via ENV variables
- Loading branch information
Showing
4 changed files
with
130 additions
and
498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ LABEL maintainer="Kyle Wilcox <[email protected]>" | |
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#</Context>#<Resources cachingAllowed="true" cacheMaxSize="100000" />\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="[email protected]" \ | ||
ERDDAP_emailDailyReportsTo="[email protected]" \ | ||
ERDDAP_emailFromAddress="[email protected]" \ | ||
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="[email protected]" | ||
|
||
COPY entrypoint.sh / | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 `<bigParentDirectory>/erddapData/</bigParentDirectory>`** | ||
**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](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="[email protected]" \ | ||
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="[email protected]" \ | ||
-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="[email protected]" | ||
``` | ||
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="[email protected]" | ||
ERDDAP_emailDailyReportsTo="[email protected]" | ||
ERDDAP_emailFromAddress="[email protected]" | ||
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="[email protected]" | ||
``` | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.