Skip to main content
Version: Latest

PostgreSQL

Using PostgreSQL is entirely optional and is geared towards more advanced users (the 0.1%). The reason you might want to use PostgreSQL is that it handles huge databases much better than SQLite, which comes bundled with the main autobrr application.

Nevertheless, if you want to use PostgreSQL with autobrr, then add this to your autobrr configuration file and restart your autobrr instance (see the next chapter if you want to convert an existing SQLite database):

config.toml
# Database config
#
databaseType = "postgres"
postgresHost = "localhost"
postgresPort = 5432
postgresDatabase = "autobrr"
postgresUser = "autobrr"
postgresPass = "s0meth!ng-l0ng-4nd-s3cure"
postgresSSLMode = "disable"
postgresExtraParams = ""

# Optional: connect via unix socket instead of host/port
#postgresSocket = "/run/postgresql"

Alternatively, the whole connection can be given as a single DSN, which takes precedence over the individual fields:

config.toml
databaseDSN = "postgresql://autobrr:s0meth!ng-l0ng-4nd-s3cure@localhost:5432/autobrr?sslmode=disable"
Warning

It's up to you to make sure your PostgreSQL instance is secured and not exposed to the internet.

Advanced

autobrr runs its database schema migrations automatically on startup. Set databaseAutoMigrate = false to skip them.

Convert from SQLite to PostgreSQL

autobrrctl has built-in support for converting your SQLite database to PostgreSQL. To do so, shut down autobrr and issue the following command:

autobrrctl db:convert --sqlite-db /path/to/autobrr.db --postgres-url postgres://username:password@127.0.0.1:5432/autobrr

Two optional flags are available:

  • --dry-run: test the conversion without writing anything to PostgreSQL.
  • --exclude-tables: comma separated list of tables to skip during conversion.

Your SQLite database will not be removed in this process, so it is safe to roll back if you like.

Remember to update the autobrr configuration file before starting autobrr again.