Database Configuration
Identix IDP Broker is built to be database-agnostic, supporting a variety of relational database management systems (RDBMS) for flexibility in development and production environments.
Supported Databases
- SQLite: Recommended for development and small-scale standalone deployments.
- PostgreSQL: Recommended for production environments, offering high performance and reliability.
- MySQL: Supported for enterprise environments with MySQL-based infrastructure.
Configuration via Environment Variables
The database connection is typically configured using standard Spring Boot environment variables or a .env file.
1. SQLite (Development)
By default, Identix is configured to use an embedded SQLite database (identix.db).
- JDBC URL:
jdbc:sqlite:identix.db - Dialect:
org.hibernate.community.dialect.SQLiteDialect
2. PostgreSQL (Production)
To switch to PostgreSQL, set the following environment variables:
SPRING_DATASOURCE_URL:jdbc:postgresql://<host>:<port>/<database_name>SPRING_DATASOURCE_USERNAME:<username>SPRING_DATASOURCE_PASSWORD:<password>SPRING_JPA_DATABASE_PLATFORM:org.hibernate.dialect.PostgreSQLDialect
3. MySQL
To use MySQL:
SPRING_DATASOURCE_URL:jdbc:mysql://<host>:<port>/<database_name>SPRING_DATASOURCE_USERNAME:<username>SPRING_DATASOURCE_PASSWORD:<password>SPRING_JPA_DATABASE_PLATFORM:org.hibernate.dialect.MySQLDialect
Database Migrations (Flyway)
Identix uses Flyway to manage database schema migrations automatically. When the application starts, Flyway scans for migration scripts in src/main/resources/db/migration and applies any that haven't been run yet.
Key Flyway Settings:
spring.flyway.enabled: Set totrue(default).spring.flyway.baseline-on-migrate: Set totrueto handle existing databases.spring.flyway.locations: Path to migration files.
For Developers: Adding a Migration
- Create a new SQL file in
src/main/resources/db/migration. - Name it using the pattern
V<Number>__<Description>.sql(e.g.,V41__add_new_feature_table.sql). - Ensure the SQL is compatible with all supported databases (use standard SQL where possible).
Persistence & Performance
- Spring Data JPA: Utilized for standard CRUD operations and repository management.
- Connection Pooling: Managed by HikariCP (included by default with Spring Boot).
- Session Management: Can be offloaded to Redis for stateless application scaling in production environments.
- Set
SPRING_SESSION_STORE_TYPE=redisto enable Redis session storage. - Configure Redis connection via
SPRING_REDIS_HOST,SPRING_REDIS_PORT, etc.
- Set