Database Configuration
Table of Contents
Database Configuration
The database configuration lives in config/database.yml
. Inferno uses the Sequel gem to communicate with the database, which offers the following configuration options.
PostgreSQL
Inferno defaults to using SQLite, which is not suitable for use in a multi-user deployment. Multi-user deployments should use PostgreSQL instead.
PostgreSQL with Docker
Rather than setting up a separate PostgreSQL service, you can run it via docker compose
along 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 with 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