Skip to content

Commit

Permalink
Merge pull request #110 from at88mph/datalink-fix-spw
Browse files Browse the repository at this point in the history
Make TAP database connections more configurable.
  • Loading branch information
at88mph authored Nov 21, 2023
2 parents 5f82682 + c34d050 commit dbc4ee9
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ build_data:
paths:
- data/build
script:
# This will install cadc-data-ops-fits 0.2.3 to include WCS cutouts.
# This will install WCSLib include WCS cutouts.
- export CURR_DIR
- apt-get update && apt-get install -y curl gcc git make
- curl -Lv -o /tmp/wcslib.tar.bz2 https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/wcslib/5.15-1/wcslib_5.15.orig.tar.bz2
Expand Down
21 changes: 7 additions & 14 deletions alma-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,21 @@ repositories {
mavenLocal()
}

apply from: '../properties.gradle'

// Minimal publishing required to run publishToMavenLocal
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
maven(MavenPublication) {
groupId = 'org.opencadc'
version = version
sourceCompatibility = sourceCompatibility

versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
from components.java
}
}
}

group = 'org.opencadc'

apply from: '../properties.gradle'

dependencies {
implementation 'org.opencadc:cadc-registry:[1.7.2,2.0)'
implementation 'org.opencadc:cadc-rest:[1.3.10,2.0)'
Expand Down
2 changes: 1 addition & 1 deletion data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ war {
apply from: '../int_test.gradle'

dependencies {
implementation 'gov.nasa.gsfc.heasarc:nom-tam-fits:1.18.1'
implementation 'org.opencadc:alma-lib:' + version
implementation 'org.opencadc:cadc-access-control:[1.1.23,1.2.0)'
implementation 'org.opencadc:cadc-dali:[1.2.10,2.0)'
Expand All @@ -44,7 +45,6 @@ dependencies {
implementation 'org.opencadc:cadc-rest:[1.2.19,)'
implementation 'org.opencadc:cadc-soda-server:[1.2.0,2.0.0)'
implementation 'org.opencadc:cadc-vosi:[1.4.3,1.5.0)'
implementation 'gov.nasa.gsfc.heasarc:nom-tam-fits:1.18.1'

testImplementation 'junit:junit:[4.12,5.0)'
testImplementation 'org.mockito:mockito-core:[3.6.0,4)'
Expand Down
2 changes: 1 addition & 1 deletion properties.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sourceCompatibility = 17

// Applies to all web applications and the alma-lib library.
version = '2.2.2'
version = '2.3.0'

task printVersion {
doLast {
Expand Down
30 changes: 19 additions & 11 deletions tap/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ALMA TAP (2.1.0)
# ALMA TAP (2.3.0)

[IVOA TAP](http://ivoa.net/Documents/TAP/) service for the [ALMA Science Archive](https://almascience.org).

Expand All @@ -18,7 +18,7 @@ Building the service creates a WAR artifact. From the root fo the
$ gradle --info clean build test
```

to create the `build/libs/tap.war`.
to create the `build/libs/tap.war` file.

## Configuration

Expand All @@ -31,12 +31,20 @@ the service. It will expect System Properties to be set to find the database.
$ ... -Dalma.tapuser.username=searchuser -Dalma.tapuser.password=searchuserpwd -Dalma.tapuser.driverClassName=oracle.jdbc.OracleDriver -Dalma.tapuser.url=jdbc:oracle:thin:@oracle-host/ALMADB
```

| Property name | Purpose | Example |
| ------------------------------ | ------------------------------- | ---------------------------------------- |
| `alma.tapuser.driverClassName` | The JDBC Driver Java class name | oracle.jdbc.OracleDriver |
| `alma.tapuser.username` | The database username for login | almauser |
| `alma.tapuser.password` | The database password for login | almapasswd |
| `alma.tapuser.url` | The JDBC URL for connecting | jdbc:oracle:thin:@host:1521/DATABASE_SID |
| Property name | Purpose | Example |
|-------------------------------------|----------------------------------------------------------------------------------|------------------------------------------|
| `alma.tapuser.driverClassName` | The JDBC Driver Java class name for TAP queries | oracle.jdbc.OracleDriver |
| `alma.tapuser.username` | The database username for login for TAP queries | almauser |
| `alma.tapuser.password` | The database password for login for TAP queries | almapasswd |
| `alma.tapuser.url` | The JDBC URL for connecting for TAP queries | jdbc:oracle:thin:@host:1521/DATABASE_SID |
| `alma.tapuser.maxConnections` | The maximum number of connections for TAP queries | 4 |
| `alma.tapuser.maxWaitMilliseconds` | The maximum number of milliseconds to wait for a new connection for TAP queries | 20000 |
| `alma.tapuploadadm.driverClassName` | The JDBC Driver Java class name for TAP uploads | oracle.jdbc.OracleDriver |
| `alma.tapuploadadm.username` | The database username for login for TAP uploads | almauser |
| `alma.tapuploadadm.password` | The database password for login for TAP uploads | almapasswd |
| `alma.tapuploadadm.url` | The JDBC URL for connecting for TAP uploads | jdbc:oracle:thin:@host:1521/DATABASE_SID |
| `alma.tapuploadadm.maxConnections` | The maximum number of connections for TAP uploads | 4 |
| `alma.tapuploadadm.maxWaitMilliseconds` | The maximum number of milliseconds to wait for a new connection for TAP uploads | 20000 |

### Asynchronous Queries

Expand All @@ -55,19 +63,19 @@ temporarily on disk using the [`cadc-tap-tmp`](https://github.com/opencadc/tap/t
See [Configuration](#configuration) for database options.

```sh
docker pull opencadc/alma-tap:2.1.0
docker pull opencadc/alma-tap:2.3.0
```

### Building for Docker

After the [Build](#build) step above, we can create a Docker deployment like so:

```sh
$ docker build -t opencadc/alma-tap:2.1.0 .
$ docker build -t opencadc/alma-tap:2.3.0 .
```

```sh
docker run --name tap -p 8080:8080 -e CATALINA_OPTS="-Dalma.tapuser.driverClassName=org.postgres.jdbc.Driver -D..." opencadc/alma-tap:2.1.0
docker run --name tap -p 8080:8080 -e CATALINA_OPTS="-Dalma.tapuser.driverClassName=org.postgres.jdbc.Driver -D..." opencadc/alma-tap:2.3.0
```

The necessary Docker images will be downloaded, including the large
Expand Down
6 changes: 3 additions & 3 deletions tap/src/main/webapp/META-INF/context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
minEvictableIdleTimeMillis="30000"
maxActive="4" maxIdle="4" maxWait="20000"
maxActive="${alma.tapuser.maxConnections}" maxIdle="${alma.tapuser.maxConnections}" maxWait="${alma.tapuser.maxWaitMilliseconds}"
username="${alma.tapuser.username}" password="${alma.tapuser.password}"
driverClassName="${alma.tapuser.driverClassName}"
url="${alma.tapuser.url}"
Expand All @@ -31,7 +31,7 @@
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
minEvictableIdleTimeMillis="30000"
maxActive="2" maxIdle="2" maxWait="20000"
maxActive="${alma.tapuser.maxConnections}" maxIdle="${alma.tapuser.maxConnections}" maxWait="${alma.tapuser.maxWaitMilliseconds}"
username="${alma.tapuser.username}" password="${alma.tapuser.password}"
driverClassName="${alma.tapuser.driverClassName}"
url="${alma.tapuser.url}"
Expand All @@ -48,7 +48,7 @@
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
minEvictableIdleTimeMillis="30000"
maxActive="4" maxIdle="4" maxWait="20000"
maxActive="${alma.tapuploadadm.maxConnections}" maxIdle="${alma.tapuploadadm.maxConnections}" maxWait="${alma.tapuploadadm.maxWaitMilliseconds}"
username="${alma.tapuploadadm.username}" password="${alma.tapuploadadm.password}"
driverClassName="${alma.tapuploadadm.driverClassName}"
url="${alma.tapuploadadm.url}"
Expand Down

0 comments on commit dbc4ee9

Please sign in to comment.