From fae8660bb2a350d0594ee91f45658105bcd7acb8 Mon Sep 17 00:00:00 2001 From: gothub Date: Tue, 24 May 2022 15:25:42 -0700 Subject: [PATCH] Source code/docs cleanup --- Docker/metadig-controller/Dockerfile | 12 ++-- README.md | 57 +++++++++++++++++-- pom.xml | 10 ++-- .../edu/ucsb/nceas/mdq/rest/RootResource.java | 2 +- .../ucsb/nceas/mdq/rest/ScoresResource.java | 5 +- 5 files changed, 66 insertions(+), 20 deletions(-) diff --git a/Docker/metadig-controller/Dockerfile b/Docker/metadig-controller/Dockerfile index cea5000..b2ee370 100644 --- a/Docker/metadig-controller/Dockerfile +++ b/Docker/metadig-controller/Dockerfile @@ -1,5 +1,5 @@ #FROM tomcat:8.5 -FROM tomcat:8.5-alpine +FROM tomcat:8-alpine MAINTAINER slaughter@nceas.ucsb.edu @@ -10,12 +10,12 @@ MAINTAINER slaughter@nceas.ucsb.edu RUN mkdir -p /etc/dataone/index && touch /etc/dataone/index/d1client.properties && touch /etc/dataone/node.properties && touch /etc/dataone/index/cn-index-processor.properties # Add R runtime and install packages required by the quality suites -COPY metadig_0.2.0.tar.gz ./metadig.tar.gz -COPY ./r-cmds.txt r-cmds.txt +#COPY metadig_0.2.0.tar.gz ./metadig.tar.gz +#COPY ./r-cmds.txt r-cmds.txt RUN apk update -RUN apk add g++ R R-dev R-doc libc-dev openssl-dev libxml2 libxml2-dev -RUN echo 'options(repos = c(CRAN = "https://cran.cnr.berkeley.edu/"))' >> /usr/lib/R/etc/Rprofile.site -RUN Rscript --vanilla r-cmds.txt +#RUN apk add g++ R R-dev R-doc libc-dev openssl-dev libxml2 libxml2-dev +#RUN echo 'options(repos = c(CRAN = "https://cran.cnr.berkeley.edu/"))' >> /usr/lib/R/etc/Rprofile.site +#RUN Rscript --vanilla r-cmds.txt # add context to /usr/local/tomcat/webapps COPY ./server.xml /usr/local/tomcat/conf/server.xml diff --git a/README.md b/README.md index e732c6a..512fb91 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,13 @@ # MetaDIG webapp Web service for interacting with the [MetaDIG Engine](https://github.com/NCEAS/metadig-engine) API. -This project builds a 'quality.war' file that can be deployed in the Tomcat webapps directory. Depending on the Tomcat configuration, the war may be unpacked automatically each time a new version is copied in place. +This project builds a 'metadig-webapp.war' file that can be deployed in the Tomcat webapps directory. Depending on the Tomcat configuration, the war may be unpacked automatically each time a new version is copied in place. -We have been experimenting with Circle CI to provide continuous builds as well as tagged releases of this product. -See Circle CI in case a production-ready release is available: https://circleci.com/gh/NCEAS/mdq-webapp +The Docker container is also delivered to DockerHub that can be obtained with + +``` +docker pull metadig/metadig-controller +``` ## The REST API Typically, the API is used to: @@ -13,5 +16,49 @@ Typically, the API is used to: In the future, we will expose more administrative functions like modifying and adding checks and suites, but for now those actions are reserved for the MDQ admins. -## Aggregations -We are relying on Metacat's SOLR indexing capabilities to summarize 'Run' documents. These objects capture the complete results of running a suite against a given metadata document and metacat-index has a processor that knows how to extract pertinent fields from the run document for the index. Then faceted queries can be performed over the SOLR index and many different summary reports can be generated from the raw index information. See the MDQ index configuration in metacat-index for more details on the fields that are extracted: https://code.ecoinformatics.org/code/metacat/trunk/metacat-index/src/main/resources/application-context-mdq.xml +### metadig-webapp + +The [`metadig-webapp` git repository](https://github.com/NCEAS/metadig-webapp) provides a REST API fronend to metadig-engine that can be deployed as a Tomcat servlet or Docker container. + +This repo builds the `metadig-webapp.war` file that can be run as a servlet inside a Tomcat instance. + +Also built is the `metadig-controller` Docker container that includes a Tomcat instance that the `metadig-webapp` servlet runs in. This servlet implements the metadig REST API. + +The metadig-webapp is dependant on the metadig-engine jar file, which is provided by the metadig-engine build. + +In order to build metadig-webapp: +- mvn clean +- mvn package + +The metadig-webapp Docker images are build with the command: +``` +mvn docker:build docker:push +``` + +These images are pushed to the `metadig` Docker Hub, for example: https://hub.docker.com/repository/docker/metadig/metadig-controller. + +Authorization for Docker Hub can be setup in several ways. One method is to create or append to the local file ~/.m2/settings, which allows the Maven build to set the necessary credentials to DockerHub during the push. An example of this file is: + +``` + + + + + + + + docker.io + [place username here] + [place password here] + + + + + + + +``` + +The appropriate usename and password is available from the NCEAS secure repo. diff --git a/pom.xml b/pom.xml index eee3f0a..8a4b4ac 100644 --- a/pom.xml +++ b/pom.xml @@ -6,8 +6,8 @@ UTF-8 metadig - 2.3.0 - 2.3.0 + 2.4.0 + 2.4.0 4.0.0 @@ -15,7 +15,7 @@ edu.ucsb.nceas metadig-webapp war - 2.3.0 + 2.4.0 metadig-webapp @@ -44,7 +44,7 @@ - + @@ -59,7 +59,7 @@ ${docker.repo}/metadig-controller:${docker.tag} - ${project.basedir}/Kubernetes/metadig-controller + ${project.basedir}/Docker/metadig-controller diff --git a/src/main/java/edu/ucsb/nceas/mdq/rest/RootResource.java b/src/main/java/edu/ucsb/nceas/mdq/rest/RootResource.java index 3561540..69f843d 100644 --- a/src/main/java/edu/ucsb/nceas/mdq/rest/RootResource.java +++ b/src/main/java/edu/ucsb/nceas/mdq/rest/RootResource.java @@ -47,7 +47,7 @@ public String showHelp(@Context UriInfo r) { sb.append("
"
     			+ ResourceDocumenter.inspectClass(RunsResource.class)
     			+ "
"); - sb.append("

Graph"); + sb.append("

Scores"); sb.append("

"
             	+ ResourceDocumenter.inspectClass(ScoresResource.class)
             	+ "
"); diff --git a/src/main/java/edu/ucsb/nceas/mdq/rest/ScoresResource.java b/src/main/java/edu/ucsb/nceas/mdq/rest/ScoresResource.java index ee9ee55..9e48370 100644 --- a/src/main/java/edu/ucsb/nceas/mdq/rest/ScoresResource.java +++ b/src/main/java/edu/ucsb/nceas/mdq/rest/ScoresResource.java @@ -89,6 +89,7 @@ public Response getScores(@QueryParam("id") String collectionId, // The portal s File statsFile = null; String mediaType = null; + mdFile.setSuiteId(suiteId); // Return the statistics in the format (media type) requested from the HTML 'Accept' header String resultString = null; @@ -102,13 +103,11 @@ public Response getScores(@QueryParam("id") String collectionId, // The portal s if (mt.equals(TEXT_CSV_TYPE)) { // Return a CVS file with the statistics mediaType = TEXT_CSV; - mdFile.setSuiteId(suiteId); mdFile.setStorageType(StorageType.DATA.toString()); mdFile.setMediaType(mediaType); } else { log.debug("Will return mediaType: " + IMAGE_PNG); mediaType = IMAGE_PNG; - mdFile.setSuiteId(suiteId); mdFile.setStorageType(StorageType.GRAPH.toString()); mdFile.setMediaType(mediaType); } @@ -147,8 +146,8 @@ public Response getScores(@QueryParam("id") String collectionId, // The portal s public Response run( @QueryParam("id") String collectionId, @QueryParam("suite") String suiteId, - @QueryParam("format") String formatFamily, @QueryParam("node") String nodeId, + @QueryParam("format") String formatFamily, @Context Request r) throws UnsupportedEncodingException, JAXBException {