The myquery web service provides a simple query interface to the Jefferson Lab MYA archiver via jmyapi.
The primary goal of myquery is to allow users simple, programmatic access to MYA data without any dependencies on a specific language or requiring wrapping a command line tool. The myquery server supports HTTP requests and returns JSON responses.
Supports querying channel history over a time interval and at a specific point in time, and includes simple forms that allow users to easily generate a valid query string for each type of supported query.
See: Public MYA Web Service (auth required from offsite).
- Grab project
git clone https://github.com/JeffersonLab/myquery
cd myquery
- Launch Compose
docker compose up
- Use web browser to request channel list
http://localhost:8080/myquery/channel?q=channel%25&m=docker
- Download Java JDK 17+
- Download Apache Tomcat 10+ (Compiled against Jakarta EE)
- Download MariaDB Driver and drop it into the Tomcat lib directory
- Download myquery.war and drop it into the Tomcat webapps directory
- Configure Tomcat
- Start Tomcat and navigate your web browser to localhost:8080/myquery
A deployments.properites file must be placed in the lib directory of Tomcat. Download the mariadb database driver and place it in the lib directory of Tomcat. A new context.xml file is needed in the Tomcat conf directory that includes a DataSource for each host in the deployments.properties.
You can enable the Tomcat CORS filter for cross origin support by setting the environment variable CORS_ALLOWED_ORIGINS
to the orgins you'd like to support. See Docker Compose example.
This project is built with Java 17 (compiled to Java 17 bytecode), and uses the Gradle 7 build tool to automatically download dependencies and build the project from source:
git clone https://github.com/JeffersonLab/myquery
cd myquery
gradlew build
Note: If you do not already have Gradle installed, it will be installed automatically by the wrapper script included in the source
Note for JLab On-Site Users: Jefferson Lab has an intercepting proxy
In order to iterate rapidly when making changes it's often useful to run the app directly on the local workstation, perhaps leveraging an IDE. In this scenario run the service dependencies with:
docker compose -f deps.yml up
Note: The local install of Tomcat should be configured to proxy connections to mya via localhost and therefore deployments.properties
should contain:
port=3306
docker.master.host=mya
docker.hosts=mya
proxy.host.mya=localhost
Further, the local mya DataSource must also leverage localhost port forwarding so the context.xml
URL field should be: url="jdbc:mariadb://localhost:3306/archive"
.
Continuous Integration (CI) is setup using GitHub Actions, so on push tests are automatically run unless [no ci]
is included in the commit message. Tests can be manually run on a local workstation using:
docker compose -f build.yml up
Wait for containers to start then:
gradlew integrationTest
- Bump the version number and release date in build.gradle and commit and push to GitHub (using Semantic Versioning).
- Create a new release on the GitHub Releases page corresponding to same version in build.gradle (Enumerate changes and link issues). Attach war file for users to download.
- Build and publish a new Docker image from the GitHub tag. GitHub is configured to do this automatically on git push of semver tag (typically part of GitHub release) or the Publish to DockerHub action can be manually triggered after selecting a tag.
- Bump and commit quick start image version
At JLab this app is found at epicsweb.jlab.org/myquery and internally at epicswebtest.acc.jlab.org/myquery. However, those servers are proxies for tomcat1.acc.jlab.org
and tomcattest1.acc.jlab.org
respectively. Use wget or the like to grab the release war file. Don't download directly into webapps dir as file scanner may attempt to deploy before fully downloaded. Be careful of previous war file as by default wget won't overrwite. The war file should be attached to each release, so right click it and copy location (or just update version in path provided in the example below). Example:
cd /tmp
rm myquery.war
wget https://github.com/JeffersonLab/myquery/releases/download/v1.2.3/myquery.war
mv myquery.war /opt/tomcat/webapps
JLab Internal Docs: InstallGuideTomcatRHEL9