🎉 monetr is now live! Read the announcement here. Or Sign Up!

PostgreSQL Configuration

monetr’s primary database is PostgreSQL and is required in order for monetr to run. monetr also uses PostgreSQL as a basic pub-sub system via LISTEN and NOTIFY commands.

Officially monetr supports PostgreSQL version 16 and higher.

config.yaml
postgresql:
  address: "localhost"
  port: 5432
  username: "monetr"
  password: "..."
  database: "monetr"
  insecureSkipVerify: false
  caCertificatePath: "</tls/ca.cert>"
  keyPath: "</tls/tls.key>"
  certificatePath: "</tls/tls.cert>"
NameTypeDefaultDescription
addressStringlocalhostThe IP, or DNS resolvable address of your PostgreSQL database server.
portNumber5432Port that the PostgreSQL server can be reached at.
usernameStringpostgresUsername that monetr should use to authenticate the PostgreSQL server.
passwordStringPassword that monetr should use to authenticate the PostgreSQL server.
databaseStringpostgresDatabase that monetr should use, monetr may attempt to run migrations on startup. The user monetr is using should have permissions to create tables and extensions.
insecureSkipVerifyBooleanfalseIf you are using TLS with PostgreSQL but are not distributing a certificate authority file, then you may need to skip TLS verification.
caCertificatePathStringPath to the certificate authority certificate file. If you are verifying your TLS connection then this is required or the server certificate must be among the hosts certificate authorities already.
keyPathStringPath to the client TLS key that monetr should use to connect to the PostgreSQL server.
certificatePathStringPath to the client TLS certificate that monetr should use to connect to the PostgreSQL server.

monetr does watch for certificate changes on the filesystem to facilitate certificate rotation without needing to restart the server. However this functionality does not always work and should not be relied on at this time.

The following environment variables map to the following configuration file fields. Each field is documented below.

VariableConfig File Field
MONETR_PG_ADDRESSpostgresql.address
MONETR_PG_PORTpostgresql.port
MONETR_PG_USERNAMEpostgresql.username
MONETR_PG_PASSWORDpostgresql.password
MONETR_PG_DATABASEpostgresql.database
MONETR_PG_INSECURE_SKIP_VERIFYpostgresql.insecureSkipVerify
MONETR_PG_CA_PATHpostgresql.caCertificatePath
MONETR_PG_KEY_PATHpostgresql.keyPath
MONETR_PG_CERT_PATHpostgresql.certificatePath

Database Migrations

The provided Docker Compose file will automatically run database migrations on startup as needed. However if you want to run the migrations manually you can remove the --migrate flag from the serve command in the compose file.

To run database migrations manually run the following command:

Run Database Migrations
monetr database migrate

To see the current database schema version run the following command:

Database Schema Version
monetr database version