Use an External Database with Artifactory Helm Installation

JFrog Installation & Setup Documentation

Content Type
Installation & Setup
ft:sourceType
Paligo

For production grade installations, it is recommended to use an external PostgreSQL with a static password.

Configure External PostgreSQL Database with Artifactory Helm Installation

There are cases where you will want to use an external PostgreSQL with a different database name, e.g., my-artifactory-db; in this case, you will need to set a custom PostgreSQL connection URL, where my-artifactory-db is the name of the database.

This can be done with the following parameters.

postgresql:
 enabled: false
database:
 type: postgresql
 driver: org.postgresql.Driver
 url: 'jdbc:postgresql://${DB_HOST}:${DB_PORT}/my-artifactory-db'
 user: <DB_USER>
 password: <DB_PASSWORD>

Note

You must set postgresql.enabled=false for the chart to use the database.* parameters. Without it, they will be ignored.

Configure Artifactory Helm Installation with an External Oracle Database

To use Artifactory with an Oracle database, the required instant client library files, libaio must be copied to the tomcat lib. In addition, you will need to set the LD_LIBRARY_PATH env variable.

  1. Create a value file with the configuration.

    postgresql:
      enabled: false
    database:
      type: oracle
      driver: oracle.jdbc.OracleDriver
      url: <DB_URL>
      user: <DB_USER>
      password: <DB_PASSWORD>
    artifactory:
      preStartCommand: "mkdir -p /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib; cd /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib && curl https://download.oracle.com/otn_software/linux/instantclient/19600/instantclient-basic-linux.x64-19.6.0.0.0dbru.zip -o instantclient-basic-linux.x64-19.6.0.0.0dbru.zip && unzip instantclient-basic-linux.x64-19.6.0.0.0dbru.zip && cp instantclient_19_6/ojdbc8.jar . && rm -rf instantclient-basic-linux.x64-19.6.0.0.0dbru.zip instantclient_19_6" 
      extraEnvironmentVariables:
      - name: LD_LIBRARY_PATH
        value: /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib
  2. Install Artifactory with the values file you created.

    Artifactory

    helm upgrade --install artifactory jfrog/artifactory --namespace artifactory -f values-oracle.yaml

    Artifactory HA

    helm upgrade --install artifactory-ha jfrog/artifactory-ha --namespace artifactory-ha -f values.yaml
  3. If this is an upgrade from 6.x to 7.x, add samepreStartCommandunder theartifactory.migration.preStartCommand.

Configure Other External Databases with Artifactory Helm Installation

There are cases where you will want to use a different database and not the enclosed PostgreSQL. For more information, see configuring the database.

Note

The official Artifactory Docker images include the PostgreSQL database driver. For other database types, you will have to add the relevant database driver to Artifactory's tomcat/lib.

This can be done with the following parameters.

# Make sure your Artifactory Docker image has the MySQL database driver in it
postgresql:
 enabled: false
database:
 type: mysql
 driver: com.mysql.jdbc.Driver
 url: <DB_URL>
 user: <DB_USER>
 password: <DB_PASSWORD>
artifactory:
 preStartCommand: "mkdir -p /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib; cd /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib && curl https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.41/mysql-connector-java-5.1.41.jar -o /opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib/mysql-connector-java-5.1.41.jar"

Note

You must set postgresql.enabled=false for the chart to use the database.* parameters. Without it, they will be ignored.

Configure Database Credentials in Helm with a Pre-existing Kubernetes Secret

If you store your database credentials in a pre-existing Kubernetes Secret, you can specify them via database.secrets instead of database.user and database.password.

# Create a secret containing the database credentials
postgresql:
 enabled: false
database:
 secrets:
  user:
    name: "my-secret"
    key: "user"
  password:
    name: "my-secret"
    key: "password"
  url:
    name: "my-secret"
    key: "url"