-
Notifications
You must be signed in to change notification settings - Fork 1
CDAWeb Server Configuration
The CDAWeb HAPI server based on server-java uses CDAWeb web services to get file listings, and then web services are used to generate CDF files when virtual variables are needed and CDF files directly when they are not. For example, a request for AC_H0_MFI for 2025-02-08 through 2025-02-09 will call the services to see that two CDF files can be used to service the request, and since no virtual variables are used, the data can be read from the files directly. A request for AC_OR_SSC does use virtual variables, and web services are called to retrieve CDF files to service the request.
The catalog and info requests are serviced using static files, which are kept and updated regularly by an external process. These files can be remote, and are currently served from the site https://cottagesystems.com/~jbf/hapi/p/cdaweb/data/hapi/catalog.json and https://cottagesystems.com/~jbf/hapi/p/cdaweb/data/hapi/info/ The intent is the process will be migrated to be co-located with the server soon.
The HAPI server is distributed as a war file which is built by Jeremy at his site. Directions could easily be created. Note this war file contains both server-java and the CDAWeb code, along with some other servers. The CDAWeb code can be built separately and linked in separately as well, using the server-java instructions for loading an external jar file. (This is just a reference to the jar file in the configuration.)
The war file is connected to the server depending on the server run, and should be documented elsewhere. It expects "hapi" to be in requests, so for example if the installation location is https://cottagesystems.com/server/cdaweb/hapi, then it should be installed at https://cottagesystems.com/server/cdaweb/.
By default the web app will look in /tmp/hapi-server/config/config.json for its configuration. The file may already be set up to be the CDAWeb server, or it can be set using the configuration at https://github.com/hapi-server/server-java/blob/main/CDAWebServer/src/org/hapiserver/source/cdaweb/config.json. This file should be downloaded (from the raw link) and put at /tmp/hapi-server/config/config.json. Note server-java's configuration can be moved, using the environment variable HAPI_HOME or the servlet initParam "hapi_home".
The configuration file config.json will contain a tag "options" which looks like:
{
"options": {
"cdawmetaDir":"https://cottagesystems.com/~jbf/hapi/p/cdaweb/",
"cdawmetaDir_doc":"location for the server",
"cacheDir":"file:///tmp/cdaweb-hapi/cache/",
"cacheDir_doc": "read-write location where files will be downloaded.",
"catalogHome": "${cdawmetaDir}/data/hapi/catalog.json",
"catalogHome_doc": "read-only location of the catalog file",
"infoHome": "${cdawmetaDir}/data/hapi/info/",
"infoHome_doc": "read-only root folder (website or file://...) containing \"info\" directory and \"catalog.json\"",
"metaHome": "${cdawmetaDir}/data/cdfmetafile/",
"metaHome_doc": "read-only root folder (website or file://...) containing \"info\" directory with file listings."
},
...
}
Though cdawmetaDir
and cacheDir
are URLs, they should always be files local to the machine the server is running on. During testing, cdawmetaDir
can be a remote site, and will be https://cottagesystems.com/~jbf/hapi/p/cdaweb/
. Soon this
external process will be moved to CDAWeb and it should be a directory containing "data/hapi/" and "data/cdfmetafile/".
cacheDir
is the location where responses from web services are stored. These are CDF files, and will be used for short
periods (five minutes, presently) to service requests.
The HAPI_HOME/config/config.json contains a section "about" which can be used to do some minimal branding.
When the file timestamp of HAPI_HOME/config/config.json is updated, then the server configuration is reloaded.
Configuration can be confirmed by navigating to the web directory (see https://cottagesystems.com/server/cdaweb/hapi for example), and seeing that ten or so parameters are presented.