Overview
By using PostgreSQL you can benefit from features in PostgreSQL infrastructure such as backup, restore and high availability.
For Artifactory to run with PostgreSQL you must create a dedicated PostgreSQL database instance and then configure Artifactory to use it as described in the following sections.
Before You Continue
Before proceeding with the steps below, please make sure you have read and followed the steps described in Changing the Default Storage.
Page Contents
Creating the Artifactory PostgreSQL Database
Supported PostgreSQL Versions
Artifactory supports PostgreSQL 9.2 and above using driver version 9.2-1002.jdbc4 and above.
The commands below create artifactory user and database with appropriate permissions.
Use the commands below to create an Artifactory user and database with appropriate permissions. Modify the relevant values to match your specific environment:
CREATE USER artifactory WITH PASSWORD 'password'; CREATE DATABASE artifactory WITH OWNER=artifactory ENCODING='UTF8'; GRANT ALL PRIVILEGES ON DATABASE artifactory TO artifactory;
Artifactory privileges
We recommend providing Artifactory with full privileges on the database.
Configuring Artifactory to use PostgreSQL
- Copy
$ARTIFACTORY_HOME/misc/db/postgresql.properties
to$ARTIFACTORY_HOME/etc/storage.properties
(If you do not have this file you can take it from the standalone zip distribution or directly from the JFrog domain). For a full explanation on the contents of this file please refer to The Bundled Storage Configurations. - Adjust the connection definitions in the
$ARTIFACTORY_HOME/etc/storage.properties
file to match the attributes of the Artifactory database you created.
You must configure the database URL and username/password to use. The schema and tables are created first time Artifactory is run using the new database. Download the JDBC driver corresponding to your PostgreSQL version from the PostgreSQL JDBC Driver Download site and copy the
postgresql-9.x-xxx.jdbc4.jar
file into the server's shared lib directory.
For example$TOMCAT_HOME/lib
when installed as a service or$ARTIFACTORY_HOME/tomcat/lib
in the standalone version.Permissions
Make sure your driver has the same permissions as the rest of the files in the shared lib directory.
- Start Artifactory.
Storing BLOBs inside PostgreSQL is not recommended
The above recommended configuration keeps all artifact information in PostgreSQL while storing the artifact binary data on the file system (under $ARTIFACTORY_HOME/data/filestore
).
While it is possible, to store BLOBs inside PostgreSQL we do not recommended it. This is important because the PostgreSQL driver doesn't support streaming BLOBs with unknown length to the database. Therefore, Artifactory will temporarily save deployed files to the filesystem and only then save the BLOB to the database.