Database Configuration
The database configuration file is config/database.yml
. Inferno uses the
Sequel gem to communicate with the database,
which offers a wide range of configuration options.
By default, Inferno uses SQLite. Unfortunately, SQLite is not suitable for use in a multi-user deployment. Multi-user deployments should use PostgreSQL instead. The following sections walk through setting up Inferno with PostgreSQL.
PostgreSQL with Docker
The easiest way to run a PostgreSQL service is by adding it to the
docker-compose.yml
file with the rest of Inferno’s services. To do so:
- Add
gem 'pg'
toGemfile
- Add the following entry to
docker-compose.yml
:inferno_db: image: postgres:14.1-alpine mem_limit: 600m restart: unless-stopped volumes: - ./data/pg:/var/lib/postgresql/data environment: POSTGRES_HOST_AUTH_METHOD: trust POSTGRES_DB: inferno_production
- Add
inferno_db
to thedepends_on
forinferno
andworker
services indocker-compose.yml
. For example:inferno: # ... depends_on: - validator_service - inferno_db worker: # ... depends_on: - redis - inferno_db
- Use the following for the production configuration in
config/database.yml
:production: adapter: postgres database: inferno_production max_connections: 10 user: postgres host: inferno_db
PostgreSQL as a Separate Service
If you have an existing PostgreSQL service that you would like to use, you can use it with the following steps:
- Add
gem 'pg'
toGemfile
- In
config/database.yml
, change theadapter
in theproduction
entry topostgres
, and supply thedatabase
,user
,password
,host
, andport
for the PostgreSQL database
Note: If you are using replication, for example with AWS RDS, you may
encounter the error cannot update table "schema_info" because
it does not have a replica identity
when first setting up Inferno.
If this occurs, run the following command in the database:
ALTER TABLE schema_info REPLICA IDENTITY FULL;
Suggest an improvement
Want to make an change? Contribute an edit for this page on the Inferno Framework GitHub repository.