From 68174723248632875875863661d412ecc7382097 Mon Sep 17 00:00:00 2001 From: Patrick Schmitz Date: Tue, 7 Jun 2011 16:27:51 +0000 Subject: [PATCH] CSPACE-3546, CSPACE-2903, CSPACE-2421, CSPACE-2170, CSPACE-2000, CSPACE-1894. Reworking lots of repository and hibernate configuration and build process to be less DB specific, and to support injection of passwords from environment variables. NOTE: this also enforces ownership of each of the three databases/datasources by three respective users (jboss, nuxeo, and cspace), with associated passwords. You MUST set the environment variables: DB_PASSWORD_JBOSS, DB_PASSWORD_NUXEO, DB_PASSWORD_CSPACE in addition to DB_PASSWORD. The current default values are (still) embedded in src/main/resources/db/mysql/init_db.sql, but this will get changed to use the environment variables as well. Also added the jboss-ds.xml datasource configuration to our source tree to simplify managing the default jboss datasource. --- .../nuxeo/nuxeo-database-templates/build.xml | 2 + .../config/default-repository-config.xml | 371 ++++++++++++++++++ .../config/default-repository-config.xml.orig | 32 ++ .../config/sql.properties | 3 + .../datasources/default-repository-ds.xml | 20 + .../default-repository-ds.xml.orig | 20 + .../datasources/unified-nuxeo-ds.xml | 14 + .../datasources/unified-nuxeo-ds.xml.orig | 14 + .../collectionspace_postgresql/nuxeo.defaults | 8 + build.properties | 36 +- build.xml | 66 +++- installer/build.xml | 12 +- services/account/client/build.xml | 6 +- services/account/pstore/build.xml | 33 +- services/authentication/client/build.xml | 6 +- services/authentication/pstore/build.xml | 42 +- services/authorization-mgt/import/build.xml | 10 +- .../applicationContext-authorization-test.xml | 8 +- services/authorization/pstore/build.xml | 46 ++- services/id/service/build.xml | 22 +- services/security/client/build.xml | 17 +- src/main/resources/config/cspace-ds.xml | 24 +- src/main/resources/config/jboss-ds.xml | 27 ++ src/main/resources/db/mysql/init_db.sql | 6 +- src/main/resources/db/postgresql/init_db.sql | 28 ++ 25 files changed, 738 insertions(+), 135 deletions(-) create mode 100644 3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/default-repository-config.xml create mode 100644 3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/default-repository-config.xml.orig create mode 100644 3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/sql.properties create mode 100644 3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/default-repository-ds.xml create mode 100644 3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/default-repository-ds.xml.orig create mode 100644 3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/unified-nuxeo-ds.xml create mode 100644 3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/unified-nuxeo-ds.xml.orig create mode 100644 3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/nuxeo.defaults create mode 100644 src/main/resources/config/jboss-ds.xml create mode 100644 src/main/resources/db/postgresql/init_db.sql diff --git a/3rdparty/nuxeo/nuxeo-database-templates/build.xml b/3rdparty/nuxeo/nuxeo-database-templates/build.xml index e015286f8..f2a1e73b4 100644 --- a/3rdparty/nuxeo/nuxeo-database-templates/build.xml +++ b/3rdparty/nuxeo/nuxeo-database-templates/build.xml @@ -45,6 +45,8 @@ + + diff --git a/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/default-repository-config.xml b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/default-repository-config.xml new file mode 100644 index 000000000..bde5bdb80 --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/default-repository-config.xml @@ -0,0 +1,371 @@ + + + + + + + imd:user_comment + note + webp:content + webc:welcomeText + comment:comment + post + mail:mail + + + + + + + + + + acquisitionFundingSourceProvisos + acquisitions_common:acquisitionNote + acquisitions_common:acquisitionProvisos + acquisitions_common:acquisitionReason + acquisitions_common:creditLine + + + + + + + + + + + + + + + + + + + collectionobjects_common:otherNumber + + + numberValue + + + collectionobjects_common:briefDescriptions + + + collectionobjects_common:comments + + collectionobjects_common:distinguishingFeatures + + objectNameNote + + title + titleTranslation + + + + + collectionobjects_common:ageQualifier + collectionobjects_common:color + collectionobjects_common:contentDescription + collectionobjects_common:contentNote + collectionobjects_common:contentObject + collectionobjects_common:copyNumber + collectionobjects_common:editionNumber + + + + collectionobjects_common:inscriptionContent + collectionobjects_common:inscriptionContentInterpretation + collectionobjects_common:inscriptionContentTranslation + collectionobjects_common:inscriptionContentTransliteration + + + + collectionobjects_common:inscriptionDescriptionInterpretation + + materialComponentNote + materialName + + + collectionobjects_common:physicalDescription + + objectComponentInformation + + + + + collectionobjects_common:objectProductionNote + + + collectionobjects_common:objectProductionReason + + + + + assocActivityNote + assocConceptNote + assocCulturalContextNote + assocDateNote + + + + collectionobjects_common:assocEventName + collectionobjects_common:assocEventNote + collectionobjects_common:assocEventType + + assocObject + assocOrganizationNote + assocPeopleNote + assocPersonNote + assocPlaceNote + + collectionobjects_common:objectHistoryNote + collectionobjects_common:ownershipExchangeNote + usageNote + + + + + collectionobjects_common:ownersPersonalExperience + collectionobjects_common:ownersPersonalResponse + + + collectionobjects_common:ownersReference + + collectionobjects_common:ownersContributionNote + + + + + collectionobjects_common:viewersRole + collectionobjects_common:viewersPersonalExperience + collectionobjects_common:viewersPersonalResponse + + + collectionobjects_common:viewersReference + + collectionobjects_common:viewersContributionNote + + + + + collectionobjects_common:catalogNumber + + + + + collectionobjects_common:fieldCollectionNote + collectionobjects_common:fieldCollectionNumber + + + + collectionobjects_common:objectNumber + collectionobjects_common:otherNumber + collectionobjects_common:otherNumberType + collectionobjects_common:numberOfObjects + collectionobjects_common:collection + collectionobjects_common:recordStatus + collectionobjects_common:age + collectionobjects_common:ageQualifier + collectionobjects_common:ageUnit + + collectionobjects_common:contentDate + collectionobjects_common:contentLanguages + collectionobjects_common:contentOrganizations + + collectionobjects_common:dimensionSummary + + + + + collectionobjects_common:dimension + collectionobjects_common:dimensionMeasuredPart + collectionobjects_common:dimensionMeasurementUnit + collectionobjects_common:dimensionValue + collectionobjects_common:dimensionValueDate + collectionobjects_common:dimensionValueQualifier + + collectionobjects_common:editionNumber + + collectionobjects_common:inscriptionContentInscriber + collectionobjects_common:inscriptionContentDate + collectionobjects_common:inscriptionContentLanguage + collectionobjects_common:inscriptionContentMethod + collectionobjects_common:inscriptionContentPosition + collectionobjects_common:inscriptionContentScript + collectionobjects_common:inscriptionContentType + + collectionobjects_common:inscriptionDescription + collectionobjects_common:inscriptionDescriptionInscriber + collectionobjects_common:inscriptionDescriptionDate + collectionobjects_common:inscriptionDescriptionMethod + collectionobjects_common:inscriptionDescriptionPosition + collectionobjects_common:inscriptionDescriptionType + + collectionobjects_common:objectStatus + collectionobjects_common:phase + collectionobjects_common:sex + collectionobjects_common:ownershipAccess + collectionobjects_common:ownershipCategory + collectionobjects_common:ownershipDates + collectionobjects_common:ownershipExchangeMethod + collectionobjects_common:ownershipExchangePriceCurrency + collectionobjects_common:ownershipExchangePriceValue + collectionobjects_common:ownershipPlace + collectionobjects_common:fieldCollectionNumber + collectionobjects_common:fieldCollectionMethod + collectionobjects_common:fieldCollectionPlace + collectionobjects_common:fieldCollectionDate + + + + + collectionobjects_common:dateAssociation + collectionobjects_common:dateEarliestSingle + collectionobjects_common:dateEarliestSingleCertainty + collectionobjects_common:dateEarliestSingleQualifier + collectionobjects_common:dateLatest + collectionobjects_common:dateLatestCertainty + collectionobjects_common:dateLatestQualifier + collectionobjects_common:datePeriod + collectionobjects_common:dateText + + + + + + contacts_common:addressPlace + + + + + + groups_common:scopeNote + + + + + + + intakes_common:entryNote + intakes_common:packingNote + intakes_common:fieldCollectionNote + intakes_common:insuranceNote + intakes_common:conditionCheckNote + currentLocationNote + + + + + + + loansin_common:loanInConditions + loansin_common:loanInNote + + + + + + + loansout_common:specialConditionsOfLoan + loansout_common:loanOutNote + loansout_common:loanPurpose + loanedObjectStatusNote + + + + + + + movements_common:currentLocationNote + movements_common:movementNote + + + + + + + media_common:copyrightStatement + media_common:description + media_common:title + + + + + + + notes_common:content + + + + + + + objectexit_common:exitNote + objectexit_common:packingNote + + + + + + + shortName + longName + nameAdditions + historyNote + + + + + + persons_common:bioNote + persons_common:nameNote + + + + + + + + + + + + + locations_common:name + + locations_common:conditionNote + locations_common:securityNote + locations_common:accessNote + + + + + + + + + dc:title + + + dc:description + + + + + + + diff --git a/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/default-repository-config.xml.orig b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/default-repository-config.xml.orig new file mode 100644 index 000000000..75bb6f9ed --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/default-repository-config.xml.orig @@ -0,0 +1,32 @@ + + + + + + + note + webp:content + webc:welcomeText + comment:comment + post + mail:mail + + + + + + + + dc:title + + + dc:description + + + + + + + diff --git a/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/sql.properties b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/sql.properties new file mode 100644 index 000000000..289bbf2b1 --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/config/sql.properties @@ -0,0 +1,3 @@ +# Jena database type and transaction mode +org.nuxeo.ecm.sql.jena.databaseType=PostgreSQL +org.nuxeo.ecm.sql.jena.databaseTransactionEnabled=true diff --git a/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/default-repository-ds.xml b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/default-repository-ds.xml new file mode 100644 index 000000000..d4049ce4d --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/default-repository-ds.xml @@ -0,0 +1,20 @@ + + + + NXRepository/default + + + Nuxeo SQL Repository DataSource + nuxeo.ear#nuxeo-core-storage-sql-ra-1.6.2.rar + org.nuxeo.ecm.core.storage.sql.Repository + default + ${nuxeo.vcs.max-pool-size} + + org.postgresql.xa.PGXADataSource + ServerName=${nuxeo.db.host} + PortNumber/Integer=${nuxeo.db.port} + DatabaseName=${nuxeo.db.name} + User=${nuxeo.db.user} + Password=${nuxeo.db.password} + + diff --git a/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/default-repository-ds.xml.orig b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/default-repository-ds.xml.orig new file mode 100644 index 000000000..d4049ce4d --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/default-repository-ds.xml.orig @@ -0,0 +1,20 @@ + + + + NXRepository/default + + + Nuxeo SQL Repository DataSource + nuxeo.ear#nuxeo-core-storage-sql-ra-1.6.2.rar + org.nuxeo.ecm.core.storage.sql.Repository + default + ${nuxeo.vcs.max-pool-size} + + org.postgresql.xa.PGXADataSource + ServerName=${nuxeo.db.host} + PortNumber/Integer=${nuxeo.db.port} + DatabaseName=${nuxeo.db.name} + User=${nuxeo.db.user} + Password=${nuxeo.db.password} + + diff --git a/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/unified-nuxeo-ds.xml b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/unified-nuxeo-ds.xml new file mode 100644 index 000000000..517e34a7c --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/unified-nuxeo-ds.xml @@ -0,0 +1,14 @@ + + + + NuxeoDS + org.postgresql.xa.PGXADataSource + ${nuxeo.db.host} + ${nuxeo.db.port} + ${nuxeo.db.name} + ${nuxeo.db.user} + ${nuxeo.db.password} + ${nuxeo.db.max-pool-size} + + + diff --git a/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/unified-nuxeo-ds.xml.orig b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/unified-nuxeo-ds.xml.orig new file mode 100644 index 000000000..517e34a7c --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/datasources/unified-nuxeo-ds.xml.orig @@ -0,0 +1,14 @@ + + + + NuxeoDS + org.postgresql.xa.PGXADataSource + ${nuxeo.db.host} + ${nuxeo.db.port} + ${nuxeo.db.name} + ${nuxeo.db.user} + ${nuxeo.db.password} + ${nuxeo.db.max-pool-size} + + + diff --git a/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/nuxeo.defaults b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/nuxeo.defaults new file mode 100644 index 000000000..f2df11912 --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-database-templates/postgresql/collectionspace_postgresql/nuxeo.defaults @@ -0,0 +1,8 @@ +## DO NOT EDIT THIS FILE, USE nuxeo.conf ## +nuxeo.template.includes=common + +nuxeo.db.host=localhost +nuxeo.db.port=5432 +nuxeo.db.name=nuxeo +nuxeo.db.user=nuxeo +nuxeo.db.password=password diff --git a/build.properties b/build.properties index 771622016..ddceb388b 100644 --- a/build.properties +++ b/build.properties @@ -65,15 +65,39 @@ nuxeo.templates.dir=${jboss.home}/${nuxeo.templates} #nuxeo main config file nuxeo.main.config.file=${jboss.bin}/nuxeo.conf -#database +#database - select one or the other (not both!), and then uncomment the +# appropriate section below the common settings +#db=mysql|postgresql db=mysql -db.script.dir=${basedir}/src/main/resources/db/${db} -db.user=${env.DB_USER} -db.user.password=${env.DB_PASSWORD} -db.host=localhost +#For mysql, uncomment this, and comment out postgres section db.port=3306 db.driver.jar=${jboss.lib.cspace}/mysql-connector-java-5.1.7-bin.jar -db.jdbc.url=jdbc:${db}://${db.host}:${db.port}/cspace db.jdbc.driver.class=com.mysql.jdbc.Driver db.dialect=org.hibernate.dialect.MySQLDialect +db.typemapping=mySQL +db.exceptionsorter=org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter + +#For postgresql, uncomment this, and comment out mysql section +#db.port=5432 +#db.driver.jar=${jboss.lib.cspace}/postgresql-8.3-604.jdbc3.jar +#db.jdbc.driver.class=org.postgresql.Driver +#db.dialect=org.hibernate.dialect.PostgreSQLDialect +#db.typemapping=PostgreSQL 8.0 +#db.exceptionsorter=org.jboss.resource.adapter.jdbc.vendor.PostgreSQLExceptionSorter + +#database common settings +db.script.dir=${basedir}/src/main/resources/db/${db} +db.user=${env.DB_USER} +db.user.password=${env.DB_PASSWORD} +db.nuxeo.user=nuxeo +db.nuxeo.user.password=${env.DB_PASSWORD_NUXEO} +db.cspace.user=cspace +db.cspace.user.password=${env.DB_PASSWORD_CSPACE} +db.jboss.user=jboss +db.jboss.user.password=${env.DB_PASSWORD_JBOSS} +db.host=localhost +db.jdbc.baseurl=jdbc:${db}://${db.host}:${db.port} +db.jdbc.jboss.url=${db.jdbc.baseurl}/jbossdb +db.jdbc.nuxeo.url=${db.jdbc.baseurl}/nuxeo +db.jdbc.cspace.url=${db.jdbc.baseurl}/cspace diff --git a/build.xml b/build.xml index 849b79fb2..8d149d977 100644 --- a/build.xml +++ b/build.xml @@ -34,7 +34,7 @@ - + @@ -207,10 +207,10 @@ - - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + diff --git a/installer/build.xml b/installer/build.xml index 3b4014dd3..73021a717 100644 --- a/installer/build.xml +++ b/installer/build.xml @@ -8,7 +8,7 @@ - + @@ -59,13 +59,13 @@ - - + diff --git a/services/account/client/build.xml b/services/account/client/build.xml index a51d2431d..633b8e161 100644 --- a/services/account/client/build.xml +++ b/services/account/client/build.xml @@ -114,10 +114,10 @@ - + - - + + diff --git a/services/account/pstore/build.xml b/services/account/pstore/build.xml index c158ba18b..12827d730 100644 --- a/services/account/pstore/build.xml +++ b/services/account/pstore/build.xml @@ -114,10 +114,10 @@ - + - - + + @@ -153,27 +153,26 @@ - + onerror="continue" > - + - + + diff --git a/services/authentication/client/build.xml b/services/authentication/client/build.xml index d379ef979..26abbbff8 100644 --- a/services/authentication/client/build.xml +++ b/services/authentication/client/build.xml @@ -113,10 +113,10 @@ - + - - + + diff --git a/services/authentication/pstore/build.xml b/services/authentication/pstore/build.xml index 5d2473e15..dda450f83 100644 --- a/services/authentication/pstore/build.xml +++ b/services/authentication/pstore/build.xml @@ -113,10 +113,10 @@ - + - - + + @@ -153,36 +153,34 @@ - + - + - + + + - + + - - + + + diff --git a/services/authorization-mgt/import/src/main/resources/applicationContext-authorization-test.xml b/services/authorization-mgt/import/src/main/resources/applicationContext-authorization-test.xml index 2dcbb630b..f394cefdc 100644 --- a/services/authorization-mgt/import/src/main/resources/applicationContext-authorization-test.xml +++ b/services/authorization-mgt/import/src/main/resources/applicationContext-authorization-test.xml @@ -36,10 +36,10 @@ - - - - + + + + diff --git a/services/authorization/pstore/build.xml b/services/authorization/pstore/build.xml index ad2bbcef0..ef4ea09c5 100644 --- a/services/authorization/pstore/build.xml +++ b/services/authorization/pstore/build.xml @@ -113,10 +113,10 @@ - + - - + + @@ -153,47 +153,45 @@ - + onerror="continue" > - + - + + - + - + diff --git a/services/security/client/build.xml b/services/security/client/build.xml index 736790c2f..4c3cb31a4 100644 --- a/services/security/client/build.xml +++ b/services/security/client/build.xml @@ -113,10 +113,10 @@ - + - - + + @@ -127,12 +127,11 @@ - + diff --git a/src/main/resources/config/cspace-ds.xml b/src/main/resources/config/cspace-ds.xml index b8bd83d22..d4831c2e7 100644 --- a/src/main/resources/config/cspace-ds.xml +++ b/src/main/resources/config/cspace-ds.xml @@ -9,11 +9,11 @@ http://www.mysql.com/downloads/api-jdbc-stable.html CspaceDS false - jdbc:mysql://localhost:3306/cspace - com.mysql.jdbc.Driver - test - test - org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter + @DB_CSPACE_URL@ + @DB_DRIVER_CLASS@ + @DB_CSPACE_USER@ + @DB_CSPACE_PASSWORD@ + @DB_EXCEPTION_SORTER@ @@ -26,17 +26,17 @@ http://www.mysql.com/downloads/api-jdbc-stable.html - mySQL + @DB_TYPE_MAPPING@ NuxeoDS false - jdbc:mysql://localhost:3306/nuxeo - com.mysql.jdbc.Driver - test - test - org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter + @DB_NUXEO_URL@ + @DB_DRIVER_CLASS@ + @DB_NUXEO_USER@ + @DB_NUXEO_PASSWORD@ + @DB_EXCEPTION_SORTER@ @@ -49,7 +49,7 @@ http://www.mysql.com/downloads/api-jdbc-stable.html - mySQL + @DB_TYPE_MAPPING@ diff --git a/src/main/resources/config/jboss-ds.xml b/src/main/resources/config/jboss-ds.xml new file mode 100644 index 000000000..e315846d9 --- /dev/null +++ b/src/main/resources/config/jboss-ds.xml @@ -0,0 +1,27 @@ + + + + + + + + DefaultDS + @DB_URL@ + @DB_DRIVER_CLASS@ + @DB_USER@ + @DB_PASSWORD@ + + + @DB_TYPE_MAPPING@ + + + + diff --git a/src/main/resources/db/mysql/init_db.sql b/src/main/resources/db/mysql/init_db.sql index 03e8875e4..18cf584bb 100644 --- a/src/main/resources/db/mysql/init_db.sql +++ b/src/main/resources/db/mysql/init_db.sql @@ -32,11 +32,11 @@ CREATE database nuxeo DEFAULT CHARACTER SET utf8; -- -- grant privileges to test user on nuxeo and jbossdb databases -- -GRANT ALL PRIVILEGES ON jbossdb.* TO 'test'@'localhost' IDENTIFIED BY 'test' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON jbossdb.* TO 'jboss'@'localhost' IDENTIFIED BY 'jbpw' WITH GRANT OPTION; FLUSH PRIVILEGES; -GRANT ALL PRIVILEGES ON cspace.* TO 'test'@'localhost' IDENTIFIED BY 'test' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON cspace.* TO 'cspace'@'localhost' IDENTIFIED BY 'cspw' WITH GRANT OPTION; FLUSH PRIVILEGES; -GRANT ALL PRIVILEGES ON nuxeo.* TO 'test'@'localhost' IDENTIFIED BY 'test' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON nuxeo.* TO 'nuxeo'@'localhost' IDENTIFIED BY 'nuxpw' WITH GRANT OPTION; -- -- Grant privileges to read-only user on Nuxeo, for reporting. -- diff --git a/src/main/resources/db/postgresql/init_db.sql b/src/main/resources/db/postgresql/init_db.sql new file mode 100644 index 000000000..0d44a49f9 --- /dev/null +++ b/src/main/resources/db/postgresql/init_db.sql @@ -0,0 +1,28 @@ +-- drop all the objects before dropping roles +DROP database IF EXISTS jbossdb; +DROP database IF EXISTS cspace; +DROP database IF EXISTS nuxeo; + +DROP USER IF EXISTS nuxeo; +DROP USER IF EXISTS cspace; +DROP USER IF EXISTS jboss; + +CREATE ROLE nuxeo WITH PASSWORD 'nuxpw' LOGIN; +CREATE ROLE cspace WITH PASSWORD 'cspw' LOGIN; +CREATE ROLE jboss WITH PASSWORD 'jbpw' LOGIN; +CREATE ROLE reader WITH PASSWORD 'read' LOGIN; + +-- +-- recreate jbossdb, cspace, and nuxeo databases +-- +CREATE database jbossdb OWNER jboss; +CREATE DATABASE cspace ENCODING 'UTF8' OWNER cspace; +CREATE DATABASE nuxeo ENCODING 'UTF8' OWNER nuxeo; + +-- +-- Grant privileges to read-only user on Nuxeo, for reporting. +-- +-- GRANT SELECT ON ALL TABLES IN DATABASE nuxeo TO reader; +-- Will have to do this with a script after the nuxeo DB has been started, +-- since there is no wildcard syntax for grants (!). If nuxeo used a schema, +-- it would be easy. Check that. -- 2.47.3