API Manager Database Configuration
The API Manager is a CDI application and uses JPA/Hibernate to persist its data (SQL). A JDBC data source is required to connect to a supported database.
Apiman’s Manager JDBC datasource JNDI name is: java:/apiman/datasources/apiman-manager
As of Apiman 3, we use Liquibase to initialise the database and apply migrations.
If you prefer to run migrations manually, set the system property liquibase.should.run=false
.
To add or remove datasources, you can:
-
Open
standalone-apiman.xml
and edit thedatasources
subsystem. -
Use the WildFly CLI.
-
Use the WildFly Administration console.
Out of the box, the API Manager data source is usually a simple H2 configuration, but you can change it to support whatever database you desire.
To make getting started easy, we ship Apiman with H2, Postgres, and MySQL JDBC drivers.
System properties and environment properties are available that synchronise settings across Apiman to make database configuration as seamless as possible.
Refer to Parameters for more detail.
You can edit standalone-apiman.xml
and apiman.properties
if you have an advanced setup that is not catered for by Apiman’s default configuration.
Parameters
|
Name | Type | Description |
---|---|---|
|
String |
WildFly database driver name, as defined in
|
|
String |
Apiman database JDBC URL
|
|
String |
Apiman database username
|
|
String |
Apiman database password
|
|
Boolean |
Whether Liquibase, our SQL change management engine, should run at startup to initialise your database and/or apply the latest SQL migrations.
|
Examples
- Postgres — system properties
./bin/standalone.sh -c standalone-apiman.xml \
-Dapiman.db.url="jdbc:postgresql://localhost:5432/apiman" \
-Dapiman.db.username=postgres \
-Dapiman.db.password="admin123\!" \
-Dapiman.db.driver=postgresql11
- Postgres — env vars
export APIMAN_DB_URL="jdbc:postgresql://localhost:5432/apiman"
export APIMAN_DB_USERNAME="postgres"
export APIMAN_DB_PASSWORD="admin123\!"
export APIMAN_DB_DRIVER="postgresql11"
./bin/standalone.sh -c standalone-apiman.xml
- MySQL/MariaDB — system properties
./bin/standalone.sh -c standalone-apiman.xml \
-Dapiman.db.url="jdbc:mysql://localhost:3306/apiman" \
-Dapiman.db.username=root \
-Dapiman.db.password="admin123\!" \
-Dapiman.db.driver=mysql8
- MySQL/MariaDB — env vars
export APIMAN_DB_URL="jdbc:mysql://localhost:3306/apiman"
export APIMAN_DB_USERNAME="root"
export APIMAN_DB_PASSWORD="admin123\!"
export APIMAN_DB_DRIVER="mysql8"
./bin/standalone.sh -c standalone-apiman.xml
Advanced configuration
You can set the Hibernate dialect manually yourself, including via a fully qualified class name (FQCN):
apiman.hibernate.dialect=io.apiman.manager.api.jpa.ApimanMySQL8Dialect
The following dialects are available:
-
h2
/ApimanH2Dialect
-
mysql8
/ApimanMySQL8Dialect
-
oracle19
/ApimanOracle19Dialect
-
postgresql11
/ApimanPostgreSQLDialect
Additional DDLs for various databases can be found in apiman/ddls/
.