diff --git a/README.md b/README.md index 20b7fe63dcafc04347cdf2c6dfe80b0bbb5ba797..a3cbad7b42fc64042f8d723a1e1ecbf9789b39d4 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,38 @@ ## vlkb-siav2 -is a web-application to discover astronomical data stored in FITS-files and described in a VO ObsCore table. -It implements the SIA version 2, IVOA recommendation (https://ivoa.net/documents/SIA/20151223/) with optional VLKB-specific features: +is a web-application to discover astronomical data (supports FITS-files) and described in a VO ObsTAP table +(https://ivoa.net/documents/ObsCore). +It implements the SIA version 2, IVOA recommendation (https://ivoa.net/documents/SIA) with optional VLKB-specific features: - provides overlap code - the filtering paramters (POS, BAND) can be given in GALACTIC and VELO-LSRK-km/s coordinates systems -- handles addtional metadata about the surveys (name, species, transformation) -- VOTable response includes composed URLs for file download, file-cutout and files-demosaic services -The service consists of **vlkb-siav2** web-application and associated **vlkb-obscore** command line tool to create the VO ObsCore table from FITS-files. +The service consists of **vlkb-siav2** web-application and associated **vlkb-obscore** command line tool to create the ObsTAP table from FITS-files headers. The vlkb-obscore cli is available from https://ict.inaf.it/gitlab/butora/vlkb-datasets . Dockerized version of the web-app is available from https://ict.inaf.it/gitlab/butora/vlkb-datasets-docker . +## Docker image + +To configure the application choose a context-root where the SIAv2 can be accessed, +provide database URI which points to the ObsTAP table and provide URL for data-access +(typically a SODA service). +Example compose.yaml entry for VLKB-SIAv2: + +```yaml + vlkb-siav2: + container_name: vlkb-siav2 + image: git.ia2.inaf.it:5050/vialactea/vlkb-siav2/siav2:1.6 + ports: + - 8080:8080 + environment: + - DISCOVERY_CONTEXT_ROOT=vlkb#datasets#siav2 + - DB_URI=jdbc:postgresql://vlkb-db:5432/vialactea + - DB_USERNAME=vialactea + - DB_PASSWORD=ia2vlkb + - CUTOUT_SERVICE_URL=http://vlkb-devel.ia2.inaf.it:8004/vlkb/datasets/soda +``` + ## Installation There is a war-package for the search web-application and the package (deb or rpm) with linux diff --git a/data-discovery/src/main/java/search/DbPSearch.java b/data-discovery/src/main/java/search/DbPSearch.java index 3050c5456ec47ad786b3813a364f566f1cbcb78a..60c0969508d46a3bf65570629d0244c13d3ab909 100644 --- a/data-discovery/src/main/java/search/DbPSearch.java +++ b/data-discovery/src/main/java/search/DbPSearch.java @@ -37,7 +37,7 @@ public class DbPSearch public String[] queryOverlapingPubdid(Coord coord) { - LOGGER.info("trace"); + LOGGER.fine("trace"); String inputRegion = toPgSphereSqlTypeString(coord.pos); String dbRegion = toRegionColumnName(coord.pos.system); @@ -90,11 +90,11 @@ public class DbPSearch //theQuery += " ORDER BY obs_collection"; - LOGGER.info(theQuery); + LOGGER.fine(theQuery); List<String> pubdidList = new ArrayList<>(); - LOGGER.info("Connecting to: " + dbConn.uri() + LOGGER.fine("Connecting to: " + dbConn.uri() + " with optional user/pwd: " + dbConn.userName() +" / "+ dbConn.password() ); try( @@ -116,7 +116,7 @@ public class DbPSearch String[] pubdidArr = pubdidList.toArray(new String[0]); - LOGGER.info("pubdidArr[] length: " + pubdidArr.length); + LOGGER.fine("pubdidArr[] length: " + pubdidArr.length); return pubdidArr; } @@ -153,7 +153,7 @@ public class DbPSearch public FormatResponseFilter.ObsCore[] queryOutputData(String[] pubdidArr, Pos pos) { - LOGGER.info(""); + LOGGER.fine("trace"); String commaSepPubdids = String.join("\',\'", pubdidArr); @@ -167,11 +167,11 @@ public class DbPSearch theQuery += " ORDER BY obs_collection"; - //LOGGER.info(theQuery); + //LOGGER.fine(theQuery); List<FormatResponseFilter.ObsCore> obsCoreList = new ArrayList<>(); - LOGGER.info("Connecting to: " + dbConn.uri() + LOGGER.fine("Connecting to: " + dbConn.uri() + " with optional user/pwd: " + dbConn.userName() +" / "+ dbConn.password() ); try( Connection conn = DriverManager.getConnection(dbConn.uri(), dbConn.userName(), dbConn.password()); @@ -237,7 +237,7 @@ public class DbPSearch obsCoreList.add(obsCore); } - LOGGER.info("From DB collected # of ObsCore : " + obsCoreList.size()); + LOGGER.fine("From DB collected # of ObsCore : " + obsCoreList.size()); } catch (SQLException se) { @@ -336,12 +336,12 @@ public class DbPSearch private void logSqlExInfo(SQLException se) { - LOGGER.info("SQLState : " + se.getSQLState()); - LOGGER.info("ErrorCode: " + se.getErrorCode()); - LOGGER.info("Message : " + se.getMessage()); + LOGGER.fine("SQLState : " + se.getSQLState()); + LOGGER.fine("ErrorCode: " + se.getErrorCode()); + LOGGER.fine("Message : " + se.getMessage()); Throwable t = se.getCause(); while(t != null) { - LOGGER.info("Cause: " + t); + LOGGER.fine("Cause: " + t); t = t.getCause(); } } diff --git a/data-discovery/src/main/java/webapi/SearchServlet.java b/data-discovery/src/main/java/webapi/SearchServlet.java index 3c0e46c2928300a97cc90adc0ecdd8eaebff75e7..ae7ffff7a63ba033f118f50d4e74a1e35c519989 100644 --- a/data-discovery/src/main/java/webapi/SearchServlet.java +++ b/data-discovery/src/main/java/webapi/SearchServlet.java @@ -35,7 +35,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet { super.init(); - LOGGER.info("DB : " + settings.dbConn.toString()); + LOGGER.config("DB: " + settings.dbConn.toString()); } protected void doMultiValuedParamNotSupported(String message, PrintWriter printWriter) @@ -57,7 +57,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, UnsupportedEncodingException { - LOGGER.info("trace"); + LOGGER.fine("trace"); legacyLogEntry(request); try @@ -105,13 +105,15 @@ public class SearchServlet extends javax.servlet.http.HttpServlet } String[] pubdidArr = dbps.queryOverlapingPubdid(coord); + LOGGER.info("Found " + pubdidArr.length + " records"); + final String RESPONSE_ENCODING = "UTF-8"; /* if filters installed response will be wrapped */ if(response instanceof FormatResponseWrapper) { - LOGGER.info("response-type is FormatResponseWrapper"); + LOGGER.finest("response-type is FormatResponseWrapper"); response.setContentType("text/plain"); response.setCharacterEncoding(RESPONSE_ENCODING); @@ -123,7 +125,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet } else { - LOGGER.info("response-type is HttpServletResponse"); + LOGGER.finest("response-type is HttpServletResponse"); response.setContentType("text/plain"); response.setCharacterEncoding(RESPONSE_ENCODING); @@ -138,7 +140,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet } catch(MultiValuedParamNotSupported ex) { - LOGGER.info("MultiValuedParamNotSupported: " + ex.getMessage()); + LOGGER.warning("MultiValuedParamNotSupported: " + ex.getMessage()); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); response.setContentType("text/plain"); @@ -149,7 +151,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet } catch(IllegalArgumentException ex) { - LOGGER.info("IllegalArgumentException: " + ex.getMessage()); + LOGGER.warning("IllegalArgumentException: " + ex.getMessage()); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); response.setContentType("text/plain"); @@ -160,7 +162,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet } catch(Exception ex) { - LOGGER.info("Exception: " + ex.getMessage()); + LOGGER.warning("Exception: " + ex.getMessage()); ex.printStackTrace(); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); @@ -183,7 +185,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet requestURL.append("?").append(request.getQueryString()); String completeURL = requestURL.toString(); String className = this.getClass().getSimpleName(); - LOGGER.info(className + " vlkb req from: " + LOGGER.finest(className + " vlkb req from: " + request.getRemoteAddr() + " doGet: " + URLDecoder.decode(completeURL, "UTF-8")); } diff --git a/data-discovery/src/main/java/webapi/SearchSettings.java b/data-discovery/src/main/java/webapi/SearchSettings.java index bf8c0ea3f26799415779a6dc85c296cffaacb65f..9e764a024b6a0e0c729efc30a1610d91a4bfae0c 100644 --- a/data-discovery/src/main/java/webapi/SearchSettings.java +++ b/data-discovery/src/main/java/webapi/SearchSettings.java @@ -9,7 +9,7 @@ import java.io.PrintWriter; class SearchSettings { - private static final Logger LOGGER = Logger.getLogger("SearchSettings"); + //private static final Logger LOGGER = Logger.getLogger("SearchSettings"); public static class DefaultParamValues { diff --git a/data-discovery/src/main/java/webapi/formatfilter/FormatResponseFilter.java b/data-discovery/src/main/java/webapi/formatfilter/FormatResponseFilter.java index dd9163012d5a835b6d9986075c5a2f62b4ea0043..126b5e64f0e77c5c0fe06e5d47ed867e17427fc4 100644 --- a/data-discovery/src/main/java/webapi/formatfilter/FormatResponseFilter.java +++ b/data-discovery/src/main/java/webapi/formatfilter/FormatResponseFilter.java @@ -70,11 +70,11 @@ public class FormatResponseFilter implements Filter @Override public void init(FilterConfig filterConfig) throws ServletException { - LOGGER.info("trace"); + LOGGER.fine("trace"); String surveysAbsPathname = settings.serviceUrls.surveysAbsPathname(); - LOGGER.info("Default charset: " + Charset.defaultCharset()); - LOGGER.info("DB: " + settings.dbConn.toString()); + LOGGER.config("Default charset: " + Charset.defaultCharset()); + LOGGER.config("DB: " + settings.dbConn.toString()); } @@ -82,7 +82,7 @@ public class FormatResponseFilter implements Filter public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { LOGGER.fine("trace"); - LOGGER.info("REQUEST START ============================================================================================="); + LOGGER.fine("REQUEST START ============================================================================================="); long startTime_msec = System.currentTimeMillis(); FormatResponseWrapper responseWrapper = new FormatResponseWrapper((HttpServletResponse) response); @@ -151,7 +151,7 @@ public class FormatResponseFilter implements Filter LOGGER.fine("SearchServlet returned no ID's."); } - LOGGER.info("REQUEST END ============================================================================================="); + LOGGER.fine("REQUEST END ============================================================================================="); } @@ -159,7 +159,7 @@ public class FormatResponseFilter implements Filter @Override public void destroy() { - LOGGER.info("trace"); + LOGGER.fine("trace"); } @@ -217,7 +217,7 @@ public class FormatResponseFilter implements Filter private FormatResponseFilter.ObsCore[] queryObsCore(String[] pubdidArr, Pos pos)//, String fitsRemotePath) { - LOGGER.info("trace"); + LOGGER.fine("trace"); DbPSearch dbps; synchronized(DbPSearch.class) @@ -337,7 +337,7 @@ public class FormatResponseFilter implements Filter // generate cutout/merge queryStrings private String toQueryString(Pos pos, Band band) { - LOGGER.info("trace"); + LOGGER.fine("trace"); StringBuilder sb = new StringBuilder(); @@ -358,7 +358,7 @@ public class FormatResponseFilter implements Filter break; default: - LOGGER.info("Coord::toQueryString: unknown shape: " + pos.shape.toString()); + LOGGER.warning("Coord::toQueryString: unknown shape: " + pos.shape.toString()); } } sb.append("&POSSYS=" + pos.system.toString()); diff --git a/data-discovery/src/main/java/webapi/formatfilter/FormatResponseSettings.java b/data-discovery/src/main/java/webapi/formatfilter/FormatResponseSettings.java index 3c582d88b9f28b65a3a4c5058ae49c58461a68cb..803a6bf20a73c021f14aaf31432e3b267aee2404 100644 --- a/data-discovery/src/main/java/webapi/formatfilter/FormatResponseSettings.java +++ b/data-discovery/src/main/java/webapi/formatfilter/FormatResponseSettings.java @@ -9,7 +9,7 @@ import java.io.PrintWriter; class FormatResponseSettings { - private static final Logger LOGGER = Logger.getLogger("FormatResponseSettings"); + //private static final Logger LOGGER = Logger.getLogger("FormatResponseSettings"); public static class DefaultParamValues { diff --git a/data-discovery/src/main/resources/formatresponsefilter.properties b/data-discovery/src/main/resources/formatresponsefilter.properties index 179196d9730a483fe04015190da42a0aa1714ca6..a0f22f9a9a59bb8b9046e8af8d3c6243889f1502 100644 --- a/data-discovery/src/main/resources/formatresponsefilter.properties +++ b/data-discovery/src/main/resources/formatresponsefilter.properties @@ -1,17 +1,4 @@ -# database with 'obscore' table -#db_uri=jdbc:postgresql://localhost:5432/vialactea -#db_schema=datasets -db_user_name= -db_password= - -# VLKB-legacy: surveys metadata in csv file -surveys_metadata_abs_pathname= - -# these URL's (up to '?') are used in response.xml so client can access those services +# accessURL in service descriptors of the VOTable response cutout_url= -merge_url= - -# set reponse format -# response_format=application/x-votable+xml diff --git a/docker/Dockerfile b/docker/Dockerfile index b9cda7f8f67ac5c437f0d1936f11d1f09cdd56c8..16ff55b4231ad18d864e9abcef47b4aca3ee9eb8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,41 +1,56 @@ -FROM debian:bullseye-slim -LABEL Description="vlkb tomcat9" +FROM tomcat:9-jre17-temurin-jammy +# From: https://hub.docker.com/_/tomcat/ +# The default Tomcat environment in the image is: +# CATALINA_BASE: /usr/local/tomcat +# CATALINA_HOME: /usr/local/tomcat +# CATALINA_TMPDIR: /usr/local/tomcat/temp +# JRE_HOME: /usr +# CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar +# The configuration files are available in /usr/local/tomcat/conf/. + +ENV CATALINA_BASE=/usr/local/tomcat +ENV CATALINA_HOME=/usr/local/tomcat WORKDIR /root ENV HOME /root +RUN apt-get -y update \ + && apt-get -y install apt-utils unzip -RUN apt -y update \ - && apt -y install sudo procps psmisc tree wget curl vim make build-essential checkinstall git \ - libcfitsio-dev libpqxx-dev librabbitmq-dev libcsv-dev gfortran \ - openjdk-17-jre-headless unzip \ - rabbitmq-server openjdk-17-jre openjdk-17-jdk tomcat9 tomcat9-admin \ - postgresql-client - -ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 -ENV CATALINA_BASE=/var/lib/tomcat9 -ENV CATALINA_HOME=/usr/share/tomcat9 -ENV CATALINA_TMPDIR=/tmp ENV WEBAPP_DIR=/webapps/vlkb-siav2 RUN mkdir -p ${WEBAPP_DIR} ARG VLKB_VERSION COPY vlkb-siav2-${VLKB_VERSION}.war ${WEBAPP_DIR}/ -RUN cd ${WEBAPP_DIR} && jar -xf vlkb-siav2-${VLKB_VERSION}.war \ - && mkdir /srv/surveys +RUN cd ${WEBAPP_DIR} && unzip vlkb-siav2-${VLKB_VERSION}.war # Tomcat must load postgresql DB driver, vlkb-siav2 does not explicitely load it -COPY deps/postgresql-*.jar /var/lib/tomcat9/lib +COPY deps/postgresql-*.jar ${CATALINA_BASE}/lib/ + +# config open access on 8080 port +COPY deps/server.xml deps/server-connector.xml* ${CATALINA_BASE}/conf/ +# config logginf +COPY deps/siav2.logging.properties ${CATALINA_BASE}/conf/ +COPY deps/setenv.sh ${CATALINA_BASE}/bin/ + +# modif permissions to allow run as non-root: may need to config TSL and ROOT-CONTEXT +WORKDIR ${CATALINA_BASE} +RUN chmod -R a+rwX conf -# configure +# enable config at start-up +RUN chmod a+rw ${WEBAPP_DIR}/WEB-INF/web.xml \ + && chmod a+rw ${WEBAPP_DIR}/WEB-INF/classes/search.properties \ + && chmod a+rw ${WEBAPP_DIR}/WEB-INF/classes/formatresponsefilter.properties -COPY deps/server.xml deps/server-connector.xml /etc/tomcat9/ -COPY entrypoint.sh /root +# set default +env DISCOVERY_CONTEXT_ROOT=datasets -RUN echo "alias log-catalina='ls -t /var/log/tomcat9/catalina*.log | head -n 1 | xargs tail -200 '" >> /root/.bashrc +# configure during start-up +COPY start-siav2.sh /root # run -RUN pwd && chmod +x /root/entrypoint.sh -CMD ["sh", "-c", "/root/entrypoint.sh"] +RUN chmod +rx /root && chmod +rx /root/start-siav2.sh +USER 1000:1000 +CMD ["sh", "-c", "/root/start-siav2.sh"] diff --git a/docker/deps/server.xml b/docker/deps/server.xml index 3ea14238c9561459974a2e3bf1c2c5d4c7730663..637d394091f728eeba38aae28ee29c1513ab0658 100644 --- a/docker/deps/server.xml +++ b/docker/deps/server.xml @@ -6,7 +6,7 @@ <Server port="-1" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> - <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> + <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="off" /> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> diff --git a/docker/deps/setenv.sh b/docker/deps/setenv.sh new file mode 100755 index 0000000000000000000000000000000000000000..544ac3d546c52c91d612846157edaa0018daaf7e --- /dev/null +++ b/docker/deps/setenv.sh @@ -0,0 +1 @@ +CATALINA_LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/siav2.logging.properties" diff --git a/docker/deps/siav2.logging.properties b/docker/deps/siav2.logging.properties new file mode 100644 index 0000000000000000000000000000000000000000..637609129c961444bb78bcd234fc26d67f6532c6 --- /dev/null +++ b/docker/deps/siav2.logging.properties @@ -0,0 +1,68 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#handlers = 1catalina.org.apache.juli.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler + +handlers = java.util.logging.ConsoleHandler + +#.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler +.handlers = java.util.logging.ConsoleHandler + +############################################################ +# Handler specific properties. +# Describes specific configuration info for Handlers. +############################################################ + +#1catalina.org.apache.juli.AsyncFileHandler.level = ALL +#1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs +#1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina. +#1catalina.org.apache.juli.AsyncFileHandler.maxDays = 90 +#1catalina.org.apache.juli.AsyncFileHandler.encoding = UTF-8 + +#2localhost.org.apache.juli.AsyncFileHandler.level = ALL +#2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs +#2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost. +#2localhost.org.apache.juli.AsyncFileHandler.maxDays = 90 +#2localhost.org.apache.juli.AsyncFileHandler.encoding = UTF-8 + +#3manager.org.apache.juli.AsyncFileHandler.level = ALL +#3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs +#3manager.org.apache.juli.AsyncFileHandler.prefix = manager. +#3manager.org.apache.juli.AsyncFileHandler.maxDays = 90 +#3manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8 + +#4host-manager.org.apache.juli.AsyncFileHandler.level = ALL +#4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs +#4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager. +#4host-manager.org.apache.juli.AsyncFileHandler.maxDays = 90 +#4host-manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8 + +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter +java.util.logging.ConsoleHandler.encoding = UTF-8 + + +############################################################ +# Facility specific properties. +# Provides extra control for each logger. +############################################################ + +org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO +org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = java.util.logging.ConsoleHandler + + +# vlkb-siav2 +SearchServlet.level = CONFIG + diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh deleted file mode 100755 index ee4488f8dc67652cac460133ed6411c3b7c6b9c6..0000000000000000000000000000000000000000 --- a/docker/entrypoint.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -set +e -LOG_FILE=/tmp/entrypoint.log - -{ -date -whoami -env - -######################################################################### -echo "run-time config (compose.yaml):" -echo "SECURITY : "$SECURITY -echo "DISCOVERY_CONTEXT_ROOT : "$DISCOVERY_CONTEXT_ROOT -echo "DB_* : "$DB_URI" ["$DB_SCHEMA"] "$DB_USERNAME" / "$DB_PASSWORD -echo "METADATA_PATHNAME : "$METADATA_PATHNAME -echo "CUTOUT_SERVICE_URL : "$CUTOUT_SERVICE_URL -echo "MERGE_SERVICE_URL : "$MERGE_SERVICE_URL -echo "RESPONSE_FORMAT : "$RESPONSE_FORMAT - -echo "build-time config'd (Dockefile):" -echo "WEBAPP_DIR : "$WEBAPP_DIR -echo "JAVA_HOME : "$JAVA_HOME -echo "CATALINA_BASE : "$CATALINA_BASE -echo "CATALINA_HOME : "$CATALINA_HOME -echo "CATALINA_TMPDIR : "$CATALINA_TMPDIR -######################################################################### - -echo "<Context docBase=\"$WEBAPP_DIR\"/>" > $CATALINA_BASE/conf/Catalina/localhost/$DISCOVERY_CONTEXT_ROOT.xml - - -# configure DB with ObsCore - -{ - echo "db_uri=$DB_URI" - echo "db_schema=$DB_SCHEMA" - echo "db_user_name=$DB_USERNAME" - echo "db_password=$DB_PASSWORD" -} >> $WEBAPP_DIR/WEB-INF/classes/search.properties - - -# configure response format - -grep db_ $WEBAPP_DIR/WEB-INF/classes/search.properties > $WEBAPP_DIR/WEB-INF/classes/formatresponsefilter.properties -{ - echo "surveys_metadata_abs_pathname=$METADATA_PATHNAME" - echo "cutout_url=$CUTOUT_SERVICE_URL" - echo "merge_url=$MERGE_SERVICE_URL" - if test -n "$RESPONSE_FORMAT" - then - echo "response_format=$RESPONSE_FORMAT" - fi -} >> $WEBAPP_DIR/WEB-INF/classes/formatresponsefilter.properties - - -# configure security - -case $SECURITY in - ia2token) - cd $WEBAPP_DIR/WEB-INF/ && rm -f web.xml && cp web-cutout-$SECURITY.xml web.xml && cd - - cp /etc/pki/tls/server-connector.xml /etc/tomcat9/ - cp /etc/pki/tls/auth*.properties $WEBAPP_DIR/WEB-INF/classes/ - rm -f $WEBAPP_DIR/WEB-INF/lib/jjwt-*0.12*.jar - ;; - iamtoken) - cd $WEBAPP_DIR/WEB-INF/ && rm -f web.xml && cp web-cutout-$SECURITY.xml web.xml && cd - - cp /etc/pki/tls/server-connector.xml /etc/tomcat9/ - cp /etc/pki/tls/iamtoken.properties $WEBAPP_DIR/WEB-INF/classes/ - rm -f $WEBAPP_DIR/WEB-INF/lib/jjwt-*0.11*.jar - ;; - *) - echo "Security not configured, runs open." - ;; -esac - - -################################################################### -date - -} 1> $LOG_FILE 2>&1 - -/usr/libexec/tomcat9/tomcat-start.sh & - -wait -n - diff --git a/docker/example-compose.yaml b/docker/example-compose.yaml index 3a7aaf7e7fb8122adef224b0e4b9bba4654d79aa..ef7e07e1160ea461ee047cf3470fc7f35937d0ed 100644 --- a/docker/example-compose.yaml +++ b/docker/example-compose.yaml @@ -11,34 +11,22 @@ services: ports: - 5432:5432 environment: - - SECURITY= - POSTGRES_PASSWORD=ia2vlkb volumes: - postgres-data:/var/lib/postgresql/data - vlkb-siav2: container_name: vlkb-siav2 image: siav2:latest ports: - 8080:8080 environment: - - SECURITY= - #- SECURITY=ia2token - DISCOVERY_CONTEXT_ROOT=vlkb#datasets#siav2 - DB_URI=jdbc:postgresql://vlkb-db:5432/vialactea - DB_USERNAME=vialactea - DB_PASSWORD=ia2vlkb - - METADATA_PATHNAME=/srv/surveys/survey_populate.csv - CUTOUT_SERVICE_URL=http://vlkb-devel.ia2.inaf.it:8004/vlkb/datasets/vlkb_cutout - - MERGE_SERVICE_URL=http://vlkb-devel.ia2.inaf.it:8004/vlkb/datasets/vlkb_merge - #- RESPONSE_FORMAT=application/x-vlkb+xml - #- RESPONSE_FORMAT=application/x-votable+xml - #- VLKBOBSCORE_PG_URI=postgresql://vialactea:ia2vlkb@localhost:5432/vialactea - volumes: - - /srv/vlkb/surveys:/srv/surveys:z - #- ./ssl:/etc/pki/tls:z - #restart: always + volumes: postgres-data: diff --git a/docker/start-siav2.sh b/docker/start-siav2.sh new file mode 100755 index 0000000000000000000000000000000000000000..876e366ebc1540d294b406084b9d2f856f1c48e6 --- /dev/null +++ b/docker/start-siav2.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set +e + +{ +date +whoami +env + +# configure CONTEXT_ROOT + +mkdir -p $CATALINA_BASE/conf/Catalina/localhost +echo "<Context docBase=\"$WEBAPP_DIR\"/>" > $CATALINA_BASE/conf/Catalina/localhost/$DISCOVERY_CONTEXT_ROOT.xml + + +# configure DB with ObsTAP +{ + echo "db_uri=$DB_URI" + echo "db_schema=$DB_SCHEMA" + echo "db_user_name=$DB_USERNAME" + echo "db_password=$DB_PASSWORD" +} > $WEBAPP_DIR/WEB-INF/classes/search.properties + + +# configure response format +{ + echo "db_uri=$DB_URI" + echo "db_schema=$DB_SCHEMA" + echo "db_user_name=$DB_USERNAME" + echo "db_password=$DB_PASSWORD" + + echo "cutout_url=$CUTOUT_SERVICE_URL" +} > $WEBAPP_DIR/WEB-INF/classes/formatresponsefilter.properties + + + +################################################################### +date + +} 1> /tmp/start-siav2.log 2>&1 + +$CATALINA_HOME/bin/catalina.sh run +