Use the database on another host

At times, it’s necessary to relocate the database to another host, separate from the StaffCop service and admin interface. The steps are as follows:

  1. Create a database and a user staffcop with all the required permissions on the remote host.

  2. Update the PostgreSQL configuration file on the host:

  • Open /etc/postgresql/11/main/postgresql.conf.

  • Locate the line beginning with listen_addresses and uncomment it by removing the # symbol.

  • Add allowed IP addresses:

listen_addresses = ','

Here, is the Staffcop server address, while is the admin workstation, such as for pgAdmin.

  • Once you’ve made these adjustments, restart the server:

service postgresql restart
  1. Transfer the database to another host. Use for reference following guides in this article. On the StaffCop Server, update the lines in /etc/staffcop/config with the remote server’s information:

   'default': {
       'ENGINE': 'django.db.backends.postgresql_psycopg2',
       'NAME': 'staffcop',
       'USER': 'staffcop',
       'PASSWORD': '1d6e8d9f8789400fed557937',
       'HOST': '',
       'PORT': '5432',

Make sure to edit the fields Host and Password.

  1. In file /etc/postgresql/11/main/pg_hba.conf, add an entry for the StaffCop Server in a similar format:

host    staffcop        staffcop  trust


The database path can vary depending on the PostgreSQL version you’re using.

  1. After moving the database to another host, make sure that the server is operational.

To simplify database configuration on the remote host, install StaffCop first. It will set up the database automatically. After restoring the backup from the main host, it’ll be ready to receive data.

You can then disactivate the StaffCop service on the local host.

To disable:

systemctl disable taffcop

To stop:

systemctl stop staffcop