-
Notifications
You must be signed in to change notification settings - Fork 124
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
Add the doc on how to configure Postgres as the backend database #296
Conversation
@flyrain, @MonkeyCanCode and @loicalleyne, can you help take a look? |
Thanks for adding this doc. I will review it later tonight. |
@@ -111,7 +111,6 @@ dependencies { | |||
testRuntimeOnly("org.junit.platform:junit-platform-launcher") | |||
|
|||
testRuntimeOnly(project(":polaris-eclipselink")) | |||
testRuntimeOnly(libs.h2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one is needed for test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the one in extension/persistence/eclipselink/build.gradle.kts is needed to test out PolarisEclipseLinkMetaStoreManagerTest. This one is needed if we want to run integration test against eclipselink in polaris-service.
For now, we are not running the integration tests against eclipseLink. We can manually run with -PeclipseLink=true -PeclipseLinkDeps=com.h2database:h2:2.3.232
. So we can remove this.
docs/metastores.md
Outdated
``` | ||
Build with Postgres dependency and run Polaris service: | ||
> polaris> ./gradlew --no-daemon --info -PeclipseLink=true -PeclipseLinkDeps=org.postgresql:postgresql:42.7.4 clean shadowJar | ||
> polaris> java -jar polaris-service/build/libs/polaris-service-*.jar server ./polaris-server.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: add one more block quotes (">") here so they will show in two lines instead of one line
docs/metastores.md
Outdated
``` | ||
|
||
Build with H2 dependency and run Polaris service: | ||
> polaris> ./gradlew --no-daemon --info -PeclipseLink=true -PeclipseLinkDeps=com.h2database:h2:2.3.232 clean shadowJar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: add one more block quotes (">") here so they will show in two lines instead of one line
docs/metastores.md
Outdated
The following shows a sample configuration for Postgres database. | ||
|
||
```angular2html | ||
<persistence-unit name="polaris" transaction-type="RESOURCE_LOCAL"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: remove 2 empty leading spaces on line 75
<shared-cache-mode>NONE</shared-cache-mode> | ||
<properties> | ||
<property name="jakarta.persistence.jdbc.url" | ||
value="jdbc:postgresql://localhost:5432/{realm}"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So from my local testing, I noticed I can set this to any database name and it will still work (using a simple realm in this case which is the default realm). Do we want to add example on how to use multi-realms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are using one realm, it doesn't conflict. This is the example to configure for multi-realms, in which case, each realm is mapped to different database. Are you saying to show examples on how to use multi-realms for Polaris in general? Let me add that in a follow up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was looking for that earlier but didn't find much. Haven't tried out the multi realms setup as of now.
docs/metastores.md
Outdated
<property name="jakarta.persistence.jdbc.password" value=""/> | ||
<property name="jakarta.persistence.schema-generation.database.action" value="create"/> | ||
</properties> | ||
</persistence-unit> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: remove 2 empty leading spaces on line 63
717160d
to
4e7a42c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor suggestions. Thanks @aihuaxu!
To use [EclipseLink](https://eclipse.dev/eclipselink/) for metastore management, specify the configuration `metaStoreManager.conf-file` to point to an [EclipseLink `persistence.xml` file](https://eclipse.dev/eclipselink/documentation/2.5/solutions/testingjpa002.htm). This file, local to the Polaris service, will contain information on what database to use for metastore management and how to connect to it. | ||
To use [EclipseLink](https://eclipse.dev/eclipselink/) for metastore management, specify the configuration `metaStoreManager.conf-file` to point to an [EclipseLink `persistence.xml` file](https://eclipse.dev/eclipselink/documentation/4.0/solutions/solutions.html#TESTINGJPA002). This file, local to the Polaris service, will contain information on what database to use for metastore management and how to connect to it. Check out [metastore doc](./metastores.md) for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove the paragraph completely, and only keep a link to metastores.md, or move everything from metastores.md to here. I'd prefer the later to avoid jumping between two pages for readers. I admit this will make the page a bit longer, but I think it's fine comparing to jump between two pages while following instructions. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it makes the page too long since we may add more sample configuration like mysql. I would prefer to simplify this paragraph to have a summary here and add a link. How do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's important to complete the setting by just looking at one page if we really care about how easy developer can setup a production ready Polaris. We can remove unnecessary stuff to make it compact, like putting the MySQL and H2 to separated doc, and only keep Postgres here. With that, it isn't a blocker for this PR. We can always improve on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I will keep them separate for now. Feel it would be strange to have Postgres in the main doc and have the others separately. But it's not critical and we can merge later if needed.
docs/metastores.md
Outdated
``` | ||
`conf-file` points to the EclipseLink configuration file and `persistence-unit` tells which unit from the configuration file to use for database connection. | ||
|
||
E.g., `polaris-dev` and `polaris` persistence units are configured in the same configuration file to connect to development database and production database respectively. Updating `persistence-unit` from `polaris-dev` to `polaris` switch from the development to the production. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would say persistence.xml
instead of the same configuration file
, at least that's how I got confused in the beginning; is it polaris-server.yml
or persistence.xml
when we are talking about the the same configuration file
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me update that to make it clear.
docs/metastores.md
Outdated
2) Use `conf-file: /tmp/conf.jar!/persistence.xml`. | ||
|
||
## EclipseLink Configuration - persistence.xml | ||
Configuration file `persistence.xml` is to configure the database connection properties, and the properties vary based on different databases and database setup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this?
The persistence.xml
file configures database connection properties, which vary based on the database and its setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rephrase to "The configuration file persistence.xml
is used to set up the database connection properties, which can differ depending on the type of database and its configuration.". How do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with that. BTW, is it allowed to have a different config file name other than persistence.xml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Different file names are allowed but EclipseLink doc always uses persistence.xml (https://eclipse.dev/eclipselink/documentation/2.5/solutions/testingjpa002.htm).
cb1b505
to
44d0626
Compare
@@ -56,7 +56,7 @@ Be sure to secure your metastore backend since it will be storing credentials an | |||
|
|||
### Configuring EclipseLink | |||
|
|||
To use [EclipseLink](https://eclipse.dev/eclipselink/) for metastore management, specify the configuration `metaStoreManager.conf-file` to point to an [EclipseLink `persistence.xml` file](https://eclipse.dev/eclipselink/documentation/2.5/solutions/testingjpa002.htm). This file, local to the Polaris service, will contain information on what database to use for metastore management and how to connect to it. | |||
To use [EclipseLink](https://eclipse.dev/eclipselink/) for metastore management, specify the configuration `metaStoreManager.conf-file` to point to an [EclipseLink `persistence.xml` file](https://eclipse.dev/eclipselink/documentation/4.0/solutions/solutions.html#TESTINGJPA002). This file, local to the Polaris service, contains details of the database used for metastore management and the connection settings. For more information, refer to [metastore documentation](./metastores.md) for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think people will understand the summary, especially for the first-time reader. I feel It even causes more confusion. How about just this?
Check [metastore documentation](./metastores.md) for instructions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to provide some summary here to give some high level information to align with the rest as I read this doc and then they can look at the separate page if needed to understand more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is that developer will always have to click into the detailed page for instructions. There is a rare chance that they can do anything by just looking at the summary. Moreover, we provided 3 links in the summary here, there is a good chance that reader will click first two links, but still lost. What they really need is the third link(./metastores.md).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I will remove the first two links so the users can check out the separate page metastores.md if that causes confusion.
Thanks @aihuaxu for the PR. Thanks @MonkeyCanCode for the review. |
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
This is to document how to configure metastore through EclipseLink for H2 database and Postgres.
Fixes #230
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist:
Please delete options that are not relevant.