Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ specs/
docs
.claude
*.bak
**/test-results/
logs

### Developer's personal properties ###
Expand Down
29 changes: 19 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM maven:3.9-eclipse-temurin-21 AS builder

WORKDIR /code

ARG MAVEN_PROFILE=trexsql
ARG MAVEN_PARAMS="" # can use maven options, e.g. -DskipTests=true -DskipUnitTests=true

ARG OPENTELEMETRY_JAVA_AGENT_VERSION=1.17.0
Expand All @@ -17,8 +16,7 @@ COPY src /code/src
RUN mvn package ${MAVEN_PARAMS} \
-Dpackaging.type=jar \
-Dgit.branch=${GIT_BRANCH} \
-Dgit.commit.id.abbrev=${GIT_COMMIT_ID_ABBREV} \
-P${MAVEN_PROFILE}
-Dgit.commit.id.abbrev=${GIT_COMMIT_ID_ABBREV}

# OHDSI WebAPI running as a Spring Boot executable JAR with Java 21
FROM index.docker.io/library/eclipse-temurin:21-jre
Expand All @@ -40,11 +38,23 @@ RUN apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
COPY --from=builder /code/opentelemetry-javaagent.jar .
COPY --from=builder /code/target/WebAPI.jar .

RUN mkdir -p /tmp/trexsql && \
(unzip -j WebAPI.jar 'BOOT-INF/lib/trexsql-ext-*.jar' -d /tmp 2>/dev/null && \
unzip -j /tmp/trexsql-ext-*.jar 'libtrexsql_java.so_linux_amd64' -d /tmp/trexsql 2>/dev/null && \
mv /tmp/trexsql/libtrexsql_java.so_linux_amd64 /tmp/trexsql/libtrexsql_java.so 2>/dev/null && \
rm -f /tmp/trexsql-ext-*.jar || true)
# Plugin setup: download trexsql plugin JAR
ARG TREXSQL_VERSION=0.2.0
RUN mkdir -p /opt/webapi/plugins && \
if curl -fL -o /opt/webapi/plugins/trexsql.jar \
"https://github.com/OHDSI/trex/releases/download/v${TREXSQL_VERSION}/trexsql-${TREXSQL_VERSION}.jar"; then \
echo "Downloaded trexsql plugin v${TREXSQL_VERSION}"; \
else \
echo "WARNING: Failed to download trexsql plugin v${TREXSQL_VERSION}, trexsql will be unavailable"; \
fi

# Download native libtrexsql.so (JNA resolves it from linux-x86-64/ on the plugin classpath)
ARG LIBTREXSQL_VERSION=v1.4.4-trex
RUN mkdir -p /opt/webapi/plugins/linux-x86-64 && \
curl -fL -o /tmp/libtrexsql.zip \
"https://github.com/p-hoffmann/trexsql-rs/releases/download/${LIBTREXSQL_VERSION}/libtrexsql-linux-amd64.zip" && \
unzip -j /tmp/libtrexsql.zip 'libtrexsql.so' -d /opt/webapi/plugins/linux-x86-64/ && \
rm /tmp/libtrexsql.zip

# Create logs directory for logback before switching to non-root user
RUN mkdir -p logs && chown 101:101 logs
Expand All @@ -53,5 +63,4 @@ EXPOSE 8080

USER 101

# Run the executable JAR with TrexSQL native library path
CMD ["sh", "-c", "exec java ${DEFAULT_JAVA_OPTS} ${JAVA_OPTS} -Dorg.duckdb.lib_path=/tmp/trexsql/libtrexsql_java.so --add-opens java.naming/com.sun.jndi.ldap=ALL-UNNAMED -jar WebAPI.jar"]
CMD ["sh", "-c", "exec java ${DEFAULT_JAVA_OPTS} ${JAVA_OPTS} -Dloader.path=/opt/webapi/plugins --add-opens java.naming/com.sun.jndi.ldap=ALL-UNNAMED -jar WebAPI.jar"]
2 changes: 1 addition & 1 deletion docker/auth-test/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fi
if [ "$BUILD_WEBAPI" = true ]; then
log_info "Building WebAPI..."
cd ../..
mvn clean package -DskipTests -Dpackaging.type=jar -P webapi-postgresql,trexsql -B
mvn clean package -DskipTests -Dpackaging.type=jar -P webapi-postgresql -B
cd "$SCRIPT_DIR"
fi

Expand Down
2 changes: 1 addition & 1 deletion docker/integration-test/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fi
if [ "$BUILD_WEBAPI" = true ]; then
log_info "Building WebAPI..."
cd ../..
mvn clean package -DskipTests -Dpackaging.type=jar -P webapi-postgresql,trexsql -B
mvn clean package -DskipTests -Dpackaging.type=jar -P webapi-postgresql -B
cd "$SCRIPT_DIR"
fi

Expand Down
37 changes: 1 addition & 36 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<layout>ZIP</layout>
<addResources>false</addResources>
<includeSystemScope>false</includeSystemScope>
<mainClass>org.ohdsi.webapi.WebApi</mainClass>
Expand Down Expand Up @@ -180,10 +181,6 @@
<!-- Preserve parameter names for reflection (required for AspectJ parameter resolution) -->
<arg>-parameters</arg>
</compilerArgs>
<!-- Exclude TrexSQL sources by default (included when -Ptcache is active) -->
<excludes>
<exclude>**/trexsql/**</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -775,38 +772,6 @@
</dependencies>

<profiles>
<profile>
<id>trexsql</id>
<properties>
<trexsql.enabled>true</trexsql.enabled>
</properties>
<dependencies>
<dependency>
<groupId>com.github.p-hoffmann</groupId>
<artifactId>trexsql-ext</artifactId>
<version>v0.1.23</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- Include TrexSQL sources when tcache profile is active -->
<excludes combine.self="override"/>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>webapi-oracle</id>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import org.springframework.beans.factory.annotation.Autowired;

import java.util.Collections;
import java.util.List;

@Component
public class PluginsConfigurationInfo extends ConfigurationInfo {
private static final String KEY = "plugins";

public PluginsConfigurationInfo(@Value("${atlasgis.enabled}") Boolean atlasgisEnabled) {
public PluginsConfigurationInfo(
@Autowired(required = false) List<WebApiPlugin> plugins,
@Value("${atlasgis.enabled}") Boolean atlasgisEnabled) {
if (plugins == null) {
plugins = Collections.emptyList();
}
for (WebApiPlugin plugin : plugins) {
properties.put(plugin.getId() + "Enabled", plugin.isActive());
}
properties.put("atlasgisEnabled", atlasgisEnabled);
}

Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/ohdsi/webapi/plugins/WebApiPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.ohdsi.webapi.plugins;

public interface WebApiPlugin {
String getId();
String getName();
String getVersion();
boolean isActive();
}
38 changes: 0 additions & 38 deletions src/main/java/org/ohdsi/webapi/trexsql/TrexSQLConfig.java

This file was deleted.

117 changes: 0 additions & 117 deletions src/main/java/org/ohdsi/webapi/trexsql/TrexSQLInstanceManager.java

This file was deleted.

Loading
Loading