Database settings¶
Canopy stores it’s database configuration in /etc/canopy/canopy.ini
under the DATABASE_URL
setting.
The settings takes the format of an URI like
postgres://username:password@hostname/databasename
.
It can be tested (since Canopy 3.0.3) with:
canopy-manage testdb
Note
Canopy’s services should be restarted if any settings in that file are changed or if the database is restarted.
Canopy can be restarted with the following command:
systemctl restart canopy canopy-celery
File locations are for Ubuntu and might be slightly different for RHEL based distributions.
PostgreSQL¶
Please consider the steps provided as only a guideline and refer to the official documentation for authoritative information: https://www.postgresql.org/docs/current/index.html
Changing Canopy database user’s password¶
As root, execute:
sudo -u postgres psql
In the psql client execute:
ALTER ROLE canopy WITH PASSWORD 'the new password';
Update the password in
DATABASE_URL
in/etc/canopy/canopy.ini
to the same password.Test access via:
canopy-manage testdb
Restart Canopy
If the database will be exposed to the network then a strong password should be assigned.
Changing host-based access control¶
By default only local processes can connect to PostgreSQL via a file socket or over the loopback interface. If you intend to expose the database to the network then additional access needs to be granted.
To add an additional host/network to PostgreSQL’s host-based access control:
Open
/etc/postgresql/16/main/pg_hba.conf
(Adjust path to match system)Add a line similar to the following but with the appropriate IP address:
host canopy canopy 192.168.0.5/32 scram-sha-256
Restart PostgreSQL:
service postgresql restart
Test access:
canopy-manage testdb
Restart Canopy
Please see the comments in that file and the official documentation: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html
Changing database’s listening interfaces¶
By default PostgreSQL only listens on localhost and a file socket. To change the addresses it listens on:
As root, edit the
listen_addresses
variable in/etc/postgresql/16/main/postgresql.conf
(Adjust path to match system)Restart PostgreSQL:
service postgresql restart
Test access via:
canopy-manage testdb
Restart Canopy
For more information see the official documentation: https://www.postgresql.org/docs/current/runtime-config-connection.html