Difference between revisions of "PostgreSQL - OpenKM 5.0"
m (moved PostgreSQL-OpenKM 5.0 to PostgreSQL - OpenKM 5.0) |
|||
(23 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{TOCright}} __TOC__ | {{TOCright}} __TOC__ | ||
+ | {{Note|These instructions are also valid for OpenKM 5.1.}} | ||
− | In this OpenKM release you can create the databases automatically configuring the '''hibernate.dialect''' and '''hibernate.hbm2ddl''' properties in | + | In this OpenKM release you can create the databases automatically configuring the '''hibernate.dialect''' and '''hibernate.hbm2ddl''' properties in [[OpenKM.cfg]]. |
<source lang="java"> | <source lang="java"> | ||
Line 16: | Line 17: | ||
== Database creation == | == Database creation == | ||
+ | Starting with OpenKM 5.0, only two databases are needed: | ||
+ | |||
+ | <source lang="sql"> | ||
+ | DROP DATABASE IF EXISTS okm_repo; | ||
+ | DROP DATABASE IF EXISTS okm_app; | ||
+ | |||
+ | CREATE USER openkm WITH PASSWORD '*secret*'; | ||
+ | |||
+ | CREATE DATABASE okm_repo WITH OWNER openkm ENCODING 'UTF8'; | ||
+ | CREATE DATABASE okm_app WITH OWNER openkm ENCODING 'UTF8'; | ||
+ | </source> | ||
+ | |||
+ | More info at: | ||
+ | |||
+ | * [http://www.postgresql.org/docs/8.4/static/index.html PostgreSQL 8.4.5 Documentation] | ||
+ | |||
== JBoss datasources == | == JBoss datasources == | ||
+ | |||
+ | <pre>$ vim $JBOSS_HOME/server/default/deploy/openkm-ds.xml</pre> | ||
+ | |||
<source lang="xml"> | <source lang="xml"> | ||
<local-tx-datasource> | <local-tx-datasource> | ||
<jndi-name>OpenKMDS</jndi-name> | <jndi-name>OpenKMDS</jndi-name> | ||
− | <connection-url>jdbc:postgresql://localhost:5432/okm_app | + | <connection-url>jdbc:postgresql://localhost:5432/okm_app</connection-url> |
<driver-class>org.postgresql.Driver</driver-class> | <driver-class>org.postgresql.Driver</driver-class> | ||
<user-name>openkm</user-name> | <user-name>openkm</user-name> | ||
Line 27: | Line 47: | ||
<max-pool-size>20</max-pool-size> | <max-pool-size>20</max-pool-size> | ||
<idle-timeout-minutes>28680</idle-timeout-minutes> | <idle-timeout-minutes>28680</idle-timeout-minutes> | ||
+ | <exception-sorter-class-name>org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter</exception-sorter-class-name> | ||
+ | <valid-connection-checker-class-name>org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker</valid-connection-checker-class-name> | ||
<metadata> | <metadata> | ||
<type-mapping>PostgreSQL</type-mapping> | <type-mapping>PostgreSQL</type-mapping> | ||
Line 34: | Line 56: | ||
</local-tx-datasource> | </local-tx-datasource> | ||
</source> | </source> | ||
+ | |||
+ | The type mapping should match a type-mapping/name element from ''$JBOSS_HOME/server/default/conf/standardjbosscmp-jdbc.xml''. Example configurations for many third-party JDBC drivers are included in the ''$JBOSS_HOME/docs/examples/jca'' directory. | ||
+ | |||
+ | You may be interested in [http://community.jboss.org/wiki/encryptingdatasourcepasswords Encrypting DataSource Passwords]. | ||
== Login configuration == | == Login configuration == | ||
+ | |||
+ | <pre>$ vim $JBOSS_HOME/server/default/conf/login-config.xml</pre> | ||
+ | |||
+ | This is for 5.0 version: | ||
+ | |||
<source lang="xml"> | <source lang="xml"> | ||
<!-- OpenKM --> | <!-- OpenKM --> | ||
Line 50: | Line 81: | ||
</application-policy> | </application-policy> | ||
</source> | </source> | ||
+ | |||
+ | This is for 5.1 version: | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <!-- OpenKM --> | ||
+ | <application-policy name = "OpenKM"> | ||
+ | <authentication> | ||
+ | <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required"> | ||
+ | <module-option name="dsJndiName">java:/OpenKMDS</module-option> | ||
+ | <module-option name="principalsQuery">select usr_password as PASSWD from OKM_USER where usr_id=? and usr_active='T'</module-option> | ||
+ | <module-option name="rolesQuery">select ur_role as ROLEID, 'Roles' from OKM_USER_ROLE where ur_user=?</module-option> | ||
+ | <module-option name="hashAlgorithm">md5</module-option> | ||
+ | <module-option name="hashEncoding">hex</module-option> | ||
+ | </login-module> | ||
+ | </authentication> | ||
+ | </application-policy> | ||
+ | </source> | ||
+ | |||
+ | |||
+ | Read also: [http://community.jboss.org/wiki/DynamicLoginConfig Dynamic login-config.xml]. | ||
== Repository configuration == | == Repository configuration == | ||
+ | |||
+ | <pre>$ vim $JBOSS_HOME/repository.xml</pre> | ||
+ | |||
<source lang="xml"> | <source lang="xml"> | ||
<?xml version="1.0"?> | <?xml version="1.0"?> | ||
Line 89: | Line 143: | ||
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager"> | <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager"> | ||
<param name="driver" value="org.postgresql.Driver"/> | <param name="driver" value="org.postgresql.Driver"/> | ||
− | <param name="url" value="jdbc:postgresql://localhost:5432/okm_repo | + | <param name="url" value="jdbc:postgresql://localhost:5432/okm_repo"/> |
<param name="schema" value="postgresql"/> | <param name="schema" value="postgresql"/> | ||
<param name="user" value="openkm"/> | <param name="user" value="openkm"/> | ||
Line 138: | Line 192: | ||
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager"> | <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager"> | ||
<param name="driver" value="org.postgresql.Driver"/> | <param name="driver" value="org.postgresql.Driver"/> | ||
− | <param name="url" value="jdbc:postgresql://localhost:5432/okm_repo | + | <param name="url" value="jdbc:postgresql://localhost:5432/okm_repo"/> |
<param name="schema" value="postgresql"/> | <param name="schema" value="postgresql"/> | ||
<param name="user" value="openkm"/> | <param name="user" value="openkm"/> | ||
Line 167: | Line 221: | ||
[[Category: Installation Guide]] | [[Category: Installation Guide]] | ||
− |
Latest revision as of 18:40, 1 December 2012
These instructions are also valid for OpenKM 5.1. |
In this OpenKM release you can create the databases automatically configuring the hibernate.dialect and hibernate.hbm2ddl properties in OpenKM.cfg.
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.hbm2ddl=create
Once the tables are created, change the hibernate.hbm2ddl property from create to none.
More info about this at:
Database creation
Starting with OpenKM 5.0, only two databases are needed:
DROP DATABASE IF EXISTS okm_repo;
DROP DATABASE IF EXISTS okm_app;
CREATE USER openkm WITH PASSWORD '*secret*';
CREATE DATABASE okm_repo WITH OWNER openkm ENCODING 'UTF8';
CREATE DATABASE okm_app WITH OWNER openkm ENCODING 'UTF8';
More info at:
JBoss datasources
$ vim $JBOSS_HOME/server/default/deploy/openkm-ds.xml
<local-tx-datasource>
<jndi-name>OpenKMDS</jndi-name>
<connection-url>jdbc:postgresql://localhost:5432/okm_app</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<user-name>openkm</user-name>
<password>*****</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>28680</idle-timeout-minutes>
<exception-sorter-class-name>org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter</exception-sorter-class-name>
<valid-connection-checker-class-name>org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker</valid-connection-checker-class-name>
<metadata>
<type-mapping>PostgreSQL</type-mapping>
<!-- <type-mapping>PostgreSQL 8.0</type-mapping> -->
<!-- <type-mapping>PostgreSQL 7.2</type-mapping> -->
</metadata>
</local-tx-datasource>
The type mapping should match a type-mapping/name element from $JBOSS_HOME/server/default/conf/standardjbosscmp-jdbc.xml. Example configurations for many third-party JDBC drivers are included in the $JBOSS_HOME/docs/examples/jca directory.
You may be interested in Encrypting DataSource Passwords.
Login configuration
$ vim $JBOSS_HOME/server/default/conf/login-config.xml
This is for 5.0 version:
<!-- OpenKM -->
<application-policy name = "OpenKM">
<authentication>
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
<module-option name="dsJndiName">java:/OpenKMDS</module-option>
<module-option name="principalsQuery">select usr_password as PASSWD from OKM_USER where usr_id=? and usr_active=true</module-option>
<module-option name="rolesQuery">select ur_role as ROLEID, 'Roles' from OKM_USER_ROLE where ur_user=?</module-option>
<module-option name="hashAlgorithm">md5</module-option>
<module-option name="hashEncoding">hex</module-option>
</login-module>
</authentication>
</application-policy>
This is for 5.1 version:
<!-- OpenKM -->
<application-policy name = "OpenKM">
<authentication>
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
<module-option name="dsJndiName">java:/OpenKMDS</module-option>
<module-option name="principalsQuery">select usr_password as PASSWD from OKM_USER where usr_id=? and usr_active='T'</module-option>
<module-option name="rolesQuery">select ur_role as ROLEID, 'Roles' from OKM_USER_ROLE where ur_user=?</module-option>
<module-option name="hashAlgorithm">md5</module-option>
<module-option name="hashEncoding">hex</module-option>
</login-module>
</authentication>
</application-policy>
Read also: Dynamic login-config.xml.
Repository configuration
$ vim $JBOSS_HOME/repository.xml
<?xml version="1.0"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.6//EN"
"http://jackrabbit.apache.org/dtd/repository-1.6.dtd">
<Repository>
<!-- virtual file system where the repository stores global state
(e.g. registered namespaces, custom node types, etc.) -->
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${rep.home}/repository"/>
</FileSystem>
<!-- Security configuration -->
<Security appName="OpenKM">
<!-- Access manager: FQN of class implementing the AccessManager interface -->
<AccessManager class="com.openkm.core.OKMAccessManager"/>
<!-- <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager"/> -->
<!-- <AccessManager class="org.apache.jackrabbit.core.security.DefaultAccessManager"> -->
<!-- <param name="config" value="${rep.home}/access.xml"/> -->
<!-- </AccessManager> -->
</Security>
<!-- Location of workspaces root directory and name of default workspace -->
<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
<!-- Workspace configuration template:
used to create the initial workspace if there's no workspace yet -->
<Workspace name="${wsp.name}">
<!-- Virtual file system of the workspace:
class: FQN of class implementing the FileSystem interface -->
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${wsp.home}"/>
</FileSystem>
<!-- Persistence manager of the workspace:
class: FQN of class implementing the PersistenceManager interface -->
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
<param name="driver" value="org.postgresql.Driver"/>
<param name="url" value="jdbc:postgresql://localhost:5432/okm_repo"/>
<param name="schema" value="postgresql"/>
<param name="user" value="openkm"/>
<param name="password" value="*****"/>
<param name="schemaObjectPrefix" value="${wsp.name}_"/>
<param name="externalBLOBs" value="false"/>
</PersistenceManager>
<!-- Search index and the file system it uses.
class: FQN of class implementing the QueryHandler interface -->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index"/>
<param name="textFilterClasses" value="
org.apache.jackrabbit.extractor.PlainTextExtractor,
org.apache.jackrabbit.extractor.MsWordTextExtractor,
org.apache.jackrabbit.extractor.MsExcelTextExtractor,
org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,
org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,
org.apache.jackrabbit.extractor.RTFTextExtractor,
org.apache.jackrabbit.extractor.HTMLTextExtractor,
org.apache.jackrabbit.extractor.XMLTextExtractor,
org.apache.jackrabbit.extractor.PngTextExtractor,
org.apache.jackrabbit.extractor.MsOutlookTextExtractor,
com.openkm.extractor.PdfTextExtractor,
com.openkm.extractor.AudioTextExtractor,
com.openkm.extractor.ExifTextExtractor,
com.openkm.extractor.TiffTextExtractor,
com.openkm.extractor.SourceCodeTextExtractor,
com.openkm.extractor.MsOffice2007TextExtractor"/>
<param name="extractorPoolSize" value="2"/>
<param name="supportHighlighting" value="false"/>
<param name="indexingConfiguration" value="${wsp.home}/../../../indexing_configuration.xml"/>
</SearchIndex>
</Workspace>
<!-- Configures the versioning -->
<Versioning rootPath="${rep.home}/version">
<!-- Configures the filesystem to use for versioning for the respective
persistence manager -->
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${rep.home}/version" />
</FileSystem>
<!-- Configures the persistence manager to be used for persisting version state.
Please note that the current versioning implementation is based on
a 'normal' persistence manager, but this could change in future
implementations. -->
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
<param name="driver" value="org.postgresql.Driver"/>
<param name="url" value="jdbc:postgresql://localhost:5432/okm_repo"/>
<param name="schema" value="postgresql"/>
<param name="user" value="openkm"/>
<param name="password" value="*****"/>
<param name="schemaObjectPrefix" value="version_"/>
<param name="externalBLOBs" value="false"/>
</PersistenceManager>
</Versioning>
<!-- Search index for content that is shared repository wide
(/jcr:system tree, contains mainly versions) -->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/repository/index"/>
<param name="textFilterClasses" value=""/>
<param name="extractorPoolSize" value="2"/>
<param name="supportHighlighting" value="false"/>
</SearchIndex>
<!-- DataStore improve file handling performance -->
<DataStore class="org.apache.jackrabbit.core.data.FileDataStore">
<param name="path" value="${rep.home}/repository/datastore"/>
<param name="minRecordLength" value="100"/>
</DataStore>
</Repository>
More info about this at Jackrabbit Configuration.