How to configure a Dockerized PostgresSQL Database for usage with Artifactory?

JFrog Support
2017-02-06 13:24

After installing PostgresSQL Database on your OS, you will have to follow these steps to create a privileged Artifactory user and a Database in the PostgresSQL instance:


1. Login into Postgres using the default credentials:


$ psql -d postgres -U postgres


2. After being logged into the shell, use this SQL query to create an Artifactory user to connect to the database:


CREATE USER artifactory WITH PASSWORD 'password'


And validate the user has been created: the '/du' command will give you the list of users that exist on the PosgresSQL cluster:


 List of roles

   Role name   |                   Attributes                   | Member of 


 artifactory   | Superuser, Create role, Create DB              | {}


3. Create the 'artifactory' user using this SQL command and grant permissions for it by issuing:




GRANT ALL PRIVILEGES ON DATABASE artifactory TO artifactory;


4.   Check the available permissions using 'l':


 List of databases

    Name     |  Owner   | Encoding |   Collate   |    Ctype    |    Access privileges     


 artifactory | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres            +

                  |          |          |             |                                     | postgres=CTc/postgres   +

                  |          |          |             |                                     | artifactory=CTc/postgres

 postgres   | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 


5. Copy the $ARTIFACTORY_HOME/misc/db/ to $ARTIFACTORY_HOME/etc/ 

    Add the PostgresSQL JDBC driver to the $TOMCAT/lib/ and start Artifactory

    Start Artifactory and this will create the scheme in Artifactory.


6. You may access PostgresSQL later on using


* Recommendations for tuning PostgresSQL:


– Adjust shared_buffers to 16G

– change work_mem to 100MB

– change max_connections to ~100 

– Note on clustering Postgres and avoiding failed builds due to consistency issues on PG slaves (not updated) when using load balancing with pgpool2. You should configure pgpool2 with your DBA to ensure that PG slaves are consistent with the master if you use PostgresSQL for load balancing.