Database settings

Canopy stores it's DB configuration in /etc/canopy/canopy.ini under the DATABASE_URL setting.

The settings takes the format of an URI e.g. postgres://username:password@hostname/databasename

It can be tested via: canopy-manage testdb (Only available from Canopy 3.0.3)


Note:

Canopy's processes should be restarted if any settings in that file is changed or if the database is restarted!

Canopy can be restarted via: supervisorctl restart all

File locations are for Ubuntu and might be slightly different for RHEL based distrubutions

Postgresql

Please consider the steps provided as only a guideline and refer to the official documentation for authoritative information: https://www.postgresql.org/docs/9.5/static/index.html

Changing canopy DB user's password:

  1. As root, execute: sudo -u postgres psql
  2. In the psql client execute: ALTER ROLE canopy WITH PASSWORD 'the new password';
  3. Change the DATABASE_URL in /etc/canopy/canopy.ini to be the same
  4. Test access via: canopy-manage testdb
  5. Restart Canopy

If the DB 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 DB to the network then additional access needs to be granted.

To add an additional host/network to Postges's host-based access control:

  1. Open /etc/postgresql/9.5/main/pg_hba.conf
  2. Add a line similar to the follow but with the appropriate IP address: 

    host canopy canopy 192.168.0.5/32 md5

  3. Restart postgresql: service postgresql restart

  4. Test access via: canopy-manage testdb

  5. Restart Canopy

Please see the comments in that file and the official documentation: https://www.postgresql.org/docs/9.5/static/auth-pg-hba-conf.html

Changing DB listening interfaces:

By default postgres only listens on localhost and a file socket. To change the addresses it listens on:

  1. As root, edit the listen_addresses variable in /etc/postgresql/9.5/main/postgresql.conf
  2. Restart postgresql: service postgresql restart

  3. Test access via: canopy-manage testdb

  4. Restart Canopy

For more information see the official documentation: https://www.postgresql.org/docs/9.5/static/runtime-config-connection.html