Use the database on another host

Sometimes it’s necessary to place the database on another host, separate from StaffCop service and admin interface. The steps are the following:

  • Create a database and a user with all the required permissions on the remote host.
  • Then transfer the database to another host. For example following guides in this article.
  • On the StaffCop server - edit the following lines in the file /etc/staffcop/config by stating info of remote server:
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'staffcop',
        'USER': 'staffcop',
        'PASSWORD': '1d6e8d9f8789400fed557937',
        'HOST': '',
        'PORT': '5432',

edit fields IP-address and password.

  • Edit file /etc/postgresql/11/main/pg_hba.conf and add access to StaffCop server
host    staffcop        staffcop  trust


The database path can be different, it depends on Postgresql version which you used!

  • Check the server operability after transferring the database to another host.

To simplify configuring of the database on the remote host you can install StaffCop beforehand, it will automatically configure the database and after restoring backup from the main host it will be ready to receive data from the main server. The StaffCop service on the local host can be disabled (systemctl disable taffcop) or stop (systemctl stop staffcop).