Database
A PostgreSQL database is required for storage of the application data.
If you would like to migrate an existing PostgreSQL database, skip this section and instead follow the guide here.
Supported versions
PostgreSQL version 10.6 and later are supported.
Database creation
Log in as your database administrator, and execute the following statements in an SQL session.
CREATE USER pactflow_user WITH PASSWORD '<password>';
CREATE DATABASE pactflow;
GRANT ALL PRIVILEGES ON DATABASE pactflow TO pactflow_user;
REVOKE ALL ON DATABASE pactflow FROM PUBLIC;
SSL
The application's PostgreSQL SSL mode is set to require
by default, which means it requires the connection to the database to be encrypted, but does not verify the server's certificate. See the documentation for the PACTFLOW_DATABASE_SSLMODE environment variable for more options. It is not recommended to use any option weaker than require
.
Authentication
Username/password authentication
Database access between the PactFlow application and Postgres instance can be secured using a username and password, configured via environment variables.
AWS IAM authentication
When deploying PactFlow on AWS Cloud infrastructure, database access between the PactFlow application and the RDS Postgres instance can be secured using IAM. Please see the AWS RDS IAM documentation for more information.
The following environmet variables must be set for the PactFlow application:
PACTFLOW_DATABASE_ADAPTER="postgresiam"
PACTFLOW_DATABASE_USERNAME
PACTFLOW_DATABASE_HOST
PACTFLOW_DATABASE_PORT
PACTFLOW_DATABASE_NAME
PACTFLOW_DATABASE_SSLMODE="require"
AWS_REGION
Schema migrations
The database schema migrations will be run automatically on start up. See the documentation on Database migrations for more information.
Migrating from OSS Pact Broker to PactFlow
If you have been hosting your own instance of the open source Pact Broker, you can point the new PactFlow On-Premises application at the same database, and the missing migrations will be applied.