views:

503

answers:

2

How would one configure PostgreSQL instead of MySQL to run artifactory?

+1  A: 

On Artifactory 2 you can configure the datasource as per the instructions you reference, just do the equivalent for PostgreSQL (substituting for the equivalent values).

So modify $ARTIFACTORY_HOME/etc/artifactory.system.properties to uncomment (and modify )the line:

artifactory.jcr.configPath=repo/postgresql

Create the file

$ARTIFACTORY_HOME/etc/repo/postgresql/repo.xml

The repo.xml to use as a base is referenced in the article, or you can find it here

You then need to set repo.xml's contents to match your database settings (extracted the relevant sections from the referenced file and modified what I can):

<!-- MySQL Filesystem -->
<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
    <param name="driver" value="org.postgresql.Driver"/>
    <param name="url" value="jdbc:postgresql:[your database URL]"/>
    <param name="user" value="artifactory_user"/>
    <param name="password" value="password"/>
    <!-- Leave this on "mysql", don't know how these apply for PostgreSQL -->
    <param name="schema" value="[postgresql??]"/>
    <param name="schemaObjectPrefix" value="rep_"/>
</FileSystem>

<!-- http://wiki.apache.org/jackrabbit/DataStore -->

<!-- MySQL Datastore -->
<DataStore class="org.artifactory.jcr.jackrabbit.ArtifactoryDbDataStoreImpl">
    <param name="url" value="jdbc:postgresql:[your database URL]"/>
    <param name="tablePrefix" value=""/>
    <param name="user" value="artifactory_user"/>
    <param name="password" value="password"/>
    <param name="databaseType" value="postgresql"/>
    <param name="driver" value="org.postgresql.Driver"/>
    <param name="minRecordLength" value="512"/>
    <param name="maxConnections" value="15"/>
    <param name="copyWhenReading" value="true"/>
</DataStore>



    <!-- PostGreSQL Persistance Manager -->
    <PersistenceManager
            class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
        <param name="url"
               value="jdbc:mysql://localhost:3306/artifactory?useUnicode=true&amp;characterEncoding=UTF-8"/>
        <param name="user" value="artifactory_user"/>
        <param name="password" value="password"/>
        <param name="schemaObjectPrefix" value="${wsp.name}_"/>
    </PersistenceManager>

Remember to drop the PostgreSQL jar into the WEB-INF/lib directory, and as the instructions say, probably best to run this against a clean install.

Good luck

Rich Seller
A: 

A more detailed explanation is available here.

Vinod Singh