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/9.5/static/index.html

Changing Canopy database 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. Update the password in DATABASE_URL in /etc/canopy/canopy.ini to the same password.

  4. Test access via:

    canopy-manage testdb
    
  5. 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:

  1. Open /etc/postgresql/9.5/main/pg_hba.conf

  2. Add a line similar to the following but with the appropriate IP address:

    host canopy canopy 192.168.0.5/32 md5
    
  3. Restart PostgreSQL:

    service postgresql restart
    
  4. Test access:

    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 database’s listening interfaces

By default PostgreSQL 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