Skip to content

Commit

Permalink
Merge pull request #429 from TAMULib/august-sprint-staging
Browse files Browse the repository at this point in the history
August sprint staging
  • Loading branch information
wwelling authored Aug 22, 2024
2 parents 4ca1f6c + cd006cb commit 669eef0
Show file tree
Hide file tree
Showing 30 changed files with 360 additions and 166 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@
triplestore/
assets/
logs/

pgdata/
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARG HOME_DIR=/$USER_NAME
ARG SOURCE_DIR=$HOME_DIR/source

# Maven stage.
FROM maven:3-eclipse-temurin-17-alpine as maven
FROM maven:3-eclipse-temurin-17-alpine AS maven
ARG USER_ID
ARG USER_NAME
ARG HOME_DIR
Expand All @@ -24,6 +24,7 @@ RUN apk -U upgrade
WORKDIR $SOURCE_DIR

# Copy files over.
COPY ./checkstyles.xml ./checkstyles.xml
COPY ./pom.xml ./pom.xml
COPY ./src ./src
COPY ./solr ./solr
Expand Down
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,48 @@ docker run -d -p 9000:9000 -e SPRING_APPLICATION_JSON="{\"spring\":{\"data\":{\"

> The environment variable `SPRING_APPLICATION_JSON` will override properties in application.yml.
## Docker Compose for Development

```bash
docker-compose up
```

This will provide Postgres database at localhost:5432 and Solr at localhost:8983. There should be two volume mounts at relative path `pgdata` and `solr/data`.

To run the `mvn spring-boot:run` command with `SPRING_APPLICATION_JSON` defined, you can use the following approach:

```
SPRING_APPLICATION_JSON='{"spring.datasource.driver-class-name":"org.postgresql.Driver","spring.datasource.url":"jdbc:postgresql://localhost:5432/scholars","spring.jpa.database-platform":"org.hibernate.dialect.PostgreSQLDialect","spring.sql.init.platform":"postgres"}' mvn spring-boot:run
```

Save the following as `config.json`.

```json
{
"spring.datasource.driver-class-name": "org.postgresql.Driver",
"spring.datasource.url": "jdbc:postgresql://localhost:5432/scholars",
"spring.jpa.database-platform": "org.hibernate.dialect.PostgreSQLDialect",
"spring.sql.init.platform": "postgres"
}
```

```
SPRING_APPLICATION_JSON=$(cat config.json) mvn spring-boot:run
```


For Windows Command Prompt, the syntax is slightly different:

```
set SPRING_APPLICATION_JSON={"spring.datasource.driver-class-name":"org.postgresql.Driver","spring.datasource.url":"jdbc:postgresql://localhost:5432/scholars","spring.jpa.database-platform":"org.hibernate.dialect.PostgreSQLDialect","spring.sql.init.platform":"postgres"} && mvn spring-boot:run
```

For Windows PowerShell:

```
$env:SPRING_APPLICATION_JSON='{"spring.datasource.driver-class-name":"org.postgresql.Driver","spring.datasource.url":"jdbc:postgresql://localhost:5432/scholars","spring.jpa.database-platform":"org.hibernate.dialect.PostgreSQLDialect","spring.sql.init.platform":"postgres"}'; mvn spring-boot:run
```

## Verify Installation

With the above installation instructions, the following service endpoints can be verified:
Expand Down
23 changes: 23 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
services:

db:
container_name: scholars-db
image: postgres
environment:
- POSTGRES_DB=scholars
- POSTGRES_USER=scholars
- POSTGRES_PASSWORD=scholars
volumes:
- ./pgdata:/var/lib/postgresql/data
ports:
- 5432:5432

solr:
container_name: scholars-solr
build:
context: ./solr/
dockerfile: Dockerfile
volumes:
- ./solr/data:/var/solr/data
ports:
- 8983:8983
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
<configLocation>checkstyles.xml</configLocation>
<consoleOutput>true</consoleOutput>
<violationSeverity>warning</violationSeverity>
<failOnViolation>true</failOnViolation>
<failOnViolation>false</failOnViolation>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
<skip>false</skip>
Expand Down
1 change: 1 addition & 0 deletions solr/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data*/
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,19 @@

boolean split() default false;

CacheableLookup[] lookup() default {};

// allow to pass field source values into another template
// each result is appended to one set
@Documented
@Target(FIELD)
@Retention(RUNTIME)
public @interface CacheableLookup {

String template();

String predicate();

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.ArrayList;
import java.util.List;

import edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility;

/**
*
*/
Expand Down Expand Up @@ -31,7 +33,7 @@ private DiscoveryAcademicAgeDescriptor(
Integer groupingIntervalInYears) {
super();
this.label = label;
this.dateField = dateField;
this.dateField = DiscoveryUtility.findProperty(dateField);
this.accumulateMultivaluedDate = accumulateMultivaluedDate;
this.averageOverInterval = averageOverInterval;
this.upperLimitInYears = upperLimitInYears;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.common.params.SolrParams;

import edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility;

/**
*
*/
Expand All @@ -28,8 +30,8 @@ public class DiscoveryNetworkDescriptor {
private DiscoveryNetworkDescriptor(String id, String dateField, List<String> dataFields, String typeFilter) {
super();
this.id = id;
this.dateField = dateField;
this.dataFields = dataFields;
this.dateField = DiscoveryUtility.findProperty(dateField);
this.dataFields = DiscoveryUtility.processFields(dataFields);
this.typeFilter = typeFilter;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package edu.tamu.scholars.middleware.discovery.argument;

import edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility;

/**
*
*/
Expand All @@ -13,7 +15,7 @@ public class DiscoveryQuantityDistributionDescriptor {
private DiscoveryQuantityDistributionDescriptor(String label, String field) {
super();
this.label = label;
this.field = field;
this.field = DiscoveryUtility.findProperty(field);
}

public String getLabel() {
Expand Down
Loading

0 comments on commit 669eef0

Please sign in to comment.