Skip to main content

External Database Configuration

The server is configured by default with an inbuilt H2 database which is not recommended for enterprise deployment. Enterprise self-hosted deployments of Lifecycle or Firewall need to use an external PostgreSQL database. Sonatype Cloud uses PostgreSQL in all instances.

  • PostgreSQL 10.7 or newer

  • PostgreSQL-compatible service (such as Amazon Aurora PostgreSQL).

Note

Having a low-latency network connection between the server and the database is crucial or the performance will notably degrade.

The external database configuration is set in the Config YAML. The connection parameters should be passed using environment variables.

export DATABASE_TYPE=postgresql
export DATABASE_HOSTNAME=<your_db_hostname>
export DATABASE_PORT=<your_db_port>
export DATABASE_NAME=<your_db_name>
export DATABASE_USER=<your_db_user>
export DATABASE_PASSWORD=<your_db_password>

Add the following to the config YAML

database:
  type: ${DATABASE_TYPE}
  hostname: ${DATABASE_HOSTNAME}
  port: ${DATABASE_PORT}
  name: ${DATABASE_NAME}
  username: ${DATABASE_USERNAME}
  password: ${DATABASE_PASSWORD}
  ## optional key-value pairs to be appended to the database connection URL
  #parameters: 
    #example-param-key-name: example-param-value

Troubleshoot external database connections

When the server fails to start:

  1. Review the system logs to verify database connection values are passed correctly

  2. Verify the database user has write permission

  3. Check for network or service disruptions with the database

  4. Use the healthcheck endpoint to monitor the health of the server and the database

GET http://localhost:8071/healthcheck

see Operational Menu