forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create JDBC connection from glassfish-resources.xml
This commit is a first test to apply database configuration and credentials to the application server without using a config on domain level but on application level. Most certainly, this is only compatible with Payara 5.x as Glassfish 5.x is unknown to support system properties in config files and it certainly does not support password aliases. The JNDI names have been changed to be conform with Java EE 7. See https://github.com/javaee-samples/javaee7-samples/tree/master/jpa/datasourcedefinition-applicationxml-pu and others for working examples. (Staying with the old name was not successfull.)
- Loading branch information
1 parent
df2b8cc
commit e1b3f42
Showing
5 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env sh | ||
|
||
# TEST FOR POSTBOOT: THIS WILL NEED TO BE ENHANCED WITH A) ENV VARS | ||
# AND B) SECRETS FILE... | ||
|
||
echo "AS_ADMIN_ALIASPASSWORD=test1234" > ${PAYARA_DIR}/dbpass | ||
|
||
cat > ${POSTBOOT_COMMANDS}.tmp << 'EOF' | ||
create-system-properties "postgres.host=postgres" | ||
create-system-properties "postgres.port=5432" | ||
create-system-properties "postgres.database=dataverse | ||
create-system-properties "postgres.user=dataverse" | ||
create-password-alias "postgres-pass" --passwordfile ${PAYARA_DIR}/dbpass | ||
EOF | ||
|
||
echo "$(cat ${POSTBOOT_COMMANDS}.tmp | cat - ${POSTBOOT_COMMANDS} )" > ${POSTBOOT_COMMANDS} | ||
cat ${POSTBOOT_COMMANDS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd"> | ||
<resources> | ||
<!-- Java DataBase Connection Configuration --> | ||
<jdbc-connection-pool | ||
res-type="javax.sql.DataSource" | ||
datasource-classname="org.postgresql.ds.PGPoolingDataSource" | ||
name="dvnDbPool"> | ||
<property name="serverName" value="${postgres.host}"/> | ||
<property name="portNumber" value="${postgres.port}"/> | ||
<property name="databaseName" value="${postgres.database}"/> | ||
<property name="User" value="${postgres.user}"/> | ||
<property name="Password" value="${ALIAS=postgres-pass}"/> | ||
<property name="create" value="true" /> | ||
</jdbc-connection-pool> | ||
<jdbc-resource jndi-name="java:app/DV/VDCNetDS" pool-name="dvnDbPool"/> | ||
</resources> |