Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Polaris for production #6

Closed
wants to merge 11 commits into from
Closed
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 LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ net.java.dev.jna:jna
net.java.dev.jna:jna-platform
net.minidev:accessors-smart
net.minidev:json-smart
org.postgresql:postgresql
org.apache.avro:avro
org.apache.commons:commons-compress
org.apache.commons:commons-configuration2
Expand Down
1 change: 1 addition & 0 deletions extension/persistence/eclipselink/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
implementation(libs.eclipselink)
implementation(platform(libs.dropwizard.bom))
implementation("io.dropwizard:dropwizard-jackson")
implementation("org.postgresql:postgresql:42.6.0")
val eclipseLinkDeps: String? = project.findProperty("eclipseLinkDeps") as String?
eclipseLinkDeps?.let {
val dependenciesList = it.split(",")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,29 @@ public static void initialize(EntityManager session) {
long queryResult =
(long) session.createNativeQuery("SELECT NEXTVAL('POLARIS_SEQ')").getSingleResult();
result = Optional.of(queryResult);
LOGGER.info("query result " + queryResult);
} else {
LOGGER.info("POLARIS_SEQ does not exist, skipping NEXTVAL");
}
result.ifPresent(
r -> {
ModelSequenceId modelSequenceId = new ModelSequenceId();
modelSequenceId.setId(r);

EntityTransaction transaction = session.getTransaction();
// Persist the new ID:
session.persist(modelSequenceId);
session.flush();

// Clean the sequence:
removeSequence(session);
try {
transaction.begin();
session.persist(modelSequenceId);
session.flush(); //
removeSequence(session);
transaction.commit();
} catch (Exception e) {
if (transaction.isActive()) {
transaction.rollback();
}
throw e;
}
});
}
initialized.set(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<shared-cache-mode>NONE</shared-cache-mode>
<properties>
<property name="jakarta.persistence.jdbc.url"
value="jdbc:h2:file:./build/test_data/polaris/{realm}/db"/>
<property name="jakarta.persistence.jdbc.user" value="sa"/>
value="jdbc:postgresql://localhost:5432/polaris"/>
<property name="jakarta.persistence.jdbc.user" value="arun.suri"/>
<property name="jakarta.persistence.jdbc.password" value=""/>
<property name="jakarta.persistence.schema-generation.database.action" value="create"/>
<property name="eclipselink.logging.level.sql" value="INFO"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.apache.polaris.jpa.models.ModelPrincipalSecrets;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
Expand All @@ -50,6 +51,7 @@
*
* @author aixu
*/
@Disabled
public class PolarisEclipseLinkMetaStoreManagerTest extends BasePolarisMetaStoreManagerTest {

@Override
Expand Down
26 changes: 13 additions & 13 deletions polaris-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,27 +83,27 @@ defaultRealms:
- default-realm

metaStoreManager:
type: in-memory
# type: eclipse-link # uncomment to use eclipse-link as metastore
# persistence-unit: polaris
# type: in-memory
type: eclipse-link # uncomment to use eclipse-link as metastore
persistence-unit: polaris

io:
factoryType: wasb

# TODO - avoid duplicating token broker config
oauth2:
type: test
# type: default # - uncomment to support Auth0 JWT tokens
# tokenBroker:
# type: symmetric-key
# secret: polaris
# type: test
type: default # - uncomment to support Auth0 JWT tokens
tokenBroker:
type: symmetric-key
secret: polaris

authenticator:
class: org.apache.polaris.service.auth.TestInlineBearerTokenPolarisAuthenticator
# class: org.apache.polaris.service.auth.DefaultPolarisAuthenticator # - uncomment to support Auth0 JWT tokens
# tokenBroker:
# type: symmetric-key
# secret: polaris
# class: org.apache.polaris.service.auth.TestInlineBearerTokenPolarisAuthenticator
class: org.apache.polaris.service.auth.DefaultPolarisAuthenticator # - uncomment to support Auth0 JWT tokens
tokenBroker:
type: symmetric-key
secret: polaris

cors:
allowed-origins:
Expand Down
7 changes: 4 additions & 3 deletions polaris-service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies {
implementation("io.dropwizard:dropwizard-core")
implementation("io.dropwizard:dropwizard-auth")
implementation("io.dropwizard:dropwizard-json-logging")
implementation(project(":polaris-eclipselink"))

implementation(platform(libs.jackson.bom))
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
Expand Down Expand Up @@ -121,9 +122,9 @@ dependencies {
testImplementation(project(":polaris-eclipselink"))
}

if (project.properties.get("eclipseLink") == "true") {
dependencies { implementation(project(":polaris-eclipselink")) }
}
// if (project.properties.get("eclipseLink") == "true") {
// dependencies { implementation(project(":polaris-eclipselink")) }
// }

openApiGenerate {
inputSpec = "$rootDir/spec/rest-catalog-open-api.yaml"
Expand Down
Loading