Skip to main content

Using an external database [Manual]

in External services
Authors list
Published: Jul 12, 2022|Last updated: Aug 8, 2023
Warning


This procedure will cause your helpdesk to become unavailable until it is complete. We recommend performing this work in a scheduled maintenance window.

After creating your instance, you may want to migrate your database to an external server.

Prerequisites Copy link to Prerequisites to clipboard

Before you start, you will need an external database server running MySQL 8+ or Aurora 3.x+

Warning


Deskpro does NOT support MariaDB at this time.

This server must be accessible from your Deskpro server.

You will also need to create a database on this server for Deskpro to use and a user with GRANT ALL PRIVILEGES for this database.

Note


MySQL users have a 'user'@'host' format, with the 'host' being the server that is making the request, so you will need to specify the IP address of the Deskpro server as the 'host' for this user.

i.e. if the Deskpro server was running on the IP 10.0.0.2 you would create the user with the following command:

CREATE USER 'deskpro'@'10.0.0.2' IDENTIFIED BY 'password';
copy

When configuring your instance, you just need to specify the 'user' portion of the user. MySQL will compare the 'host' against where the request came from automatically.

Backing up your existing helpdesk Copy link to Backing up your existing helpdesk to clipboard

Please follow the Backing up your database - mysqldump section of the Manual Backup guide to create an SQL file containing your existing database.

Configuring your new database server Copy link to Configuring your new database server to clipboard

You will need to create a new custom config file called config.custom.php in /opt/deskpro/data/instances/{instance_ID}/services/deskpro/config/, which should override the default settings in the deskpro-config.php file in that directory.

You can reference the deskpro-config.php file for the correct syntax for any changes you require, but that file is automatically maintained by the OPC, so any changes made in there will be overwritten.

As this is a PHP file, you will need to open it with a <?php tag, so the syntax for the file with an external database configuration will be the following:

<?php $CONFIG['database'] = [ 'host' => '{external mysql server address}', 'user' => '{username}', 'password' => '{password}', 'dbname' => '{database name}', ];
copy

You will need to replace the sections within {} with details for your new database server.

Restoring your database on your new server Copy link to Restoring your database on your new server to clipboard

Once you have configured Deskpro to use the new server, you will need to restore the .sql from earlier to the new server. You can do this with the following command:

mysql -h {host} -u{user} -p {database} < ~/{instance_ID}.sql
copy

In the above command, you will need to replace the following:

  • {host} - the IP or hostname of your new database server

  • {user} - the mysql user with GRANT ALL PRIVILEGES created for Deskpro to use.

  • {database} - the new mysql database which Deskpro will use

  • {instance_ID} - the Instance ID of the helpdesk you are importing. This is the file created from the mysqldump, so if you have moved this to a new location make sure the path is correct.

If all of the above is correct, your database backup should now be restoring onto the new server. Once this has been completed, your instance should now be running from the external database server.

HelpfulUnhelpful
next pageUsing an external ElasticSearch service
previous pageUsing Amazon S3

Please log in or register to submit a comment.