Hello,
We are currently trailing JetBackup. The product seems to do everything we want except one thing. We would like to be able to assign mysql databases to users via an API.
We currently use a shared hosting management platform called ServerPilot. This is how databases are associated with users. We can query ServerPilot to find out the names of any mysql databases associated with a given user.
Manually assigning databases using the 'Manage Databases' plugin isn't really suitable, and using the automatic mode and then manually renaming all the database to username_<db> isn't really suitable either. We have a number of shared hosting machines running Ubuntu and it would be quite time consuming and error prone to do this by hand.
Using a hook script to mysqldump each users databases into their home directories before the backup task would work but it would also consume a lot of disk space, so we'd rather not do that.
We have a capable PHP programmer here, so we could also write our own plugin, unfortunately we can't seem to find any useful documentation on doing that, and the Manage Databases plugin is DRMed with Ioncube.
Another idea we had was could we provide the database information to JetBackup in a format that mimics cpanel somehow? Do your engineers have any idea about doing this?
The bottom line is the product is great and suits our needs but we need to integrate it with our existing multi user management system for it to be useful.
Kind regards,
Assigning Databases by API
-
- Staff Member
- Posts: 74
- Joined: August 5th, 2022, 11:01 pm
Re: Assigning Databases by API
Hello Jotham,
Here is a demonstration of what a typical call to assign a MySQL database/user to an account might look like:
type=1:
In this section of the command, type refers to what type of database you are trying to assign. 1 is MySQL, 2 is MongoDB, and 3 is PostgreSQL.
list[databases][assigned][0]=database1&list[databases][assigned][1]=database2&list[databases][unassigned][0]=database3&list[users][assigned][0]=&list[users][unassigned][0]=user1&list[users][unassigned][1]=user2:
In order for the list section of this call to work, you must list all databases/users that are currently assigned to this account, or all those that you are trying to assign to this account, as assigned. If you wish to leave a database/user available to assign to a different account, or you would like to unassign a database/user from this account, you will need to list these as `unassigned`.
account=assignee:
This section of the command is how you determine which account these databases/users will be assigned to.
plugin=ManageDatabases&call=DatabaseAssign:
Finally, this section selects which plugin to use, as well as which specific call this plugin will use.
Here is a demonstration of what a typical call to assign a MySQL database/user to an account might look like:
Code: Select all
jetbackup5api -F pluginAPI -D "type=1&list[databases][assigned][0]=database1&list[databases][assigned][1]=database2&list[databases][unassigned][0]=database3&list[users][assigned][0]=&list[users][unassigned][0]=user1&list[users][unassigned][1]=user2&account=assignee&plugin=ManageDatabases&call=DatabaseAssign"
In this section of the command, type refers to what type of database you are trying to assign. 1 is MySQL, 2 is MongoDB, and 3 is PostgreSQL.
list[databases][assigned][0]=database1&list[databases][assigned][1]=database2&list[databases][unassigned][0]=database3&list[users][assigned][0]=&list[users][unassigned][0]=user1&list[users][unassigned][1]=user2:
In order for the list section of this call to work, you must list all databases/users that are currently assigned to this account, or all those that you are trying to assign to this account, as assigned. If you wish to leave a database/user available to assign to a different account, or you would like to unassign a database/user from this account, you will need to list these as `unassigned`.
account=assignee:
This section of the command is how you determine which account these databases/users will be assigned to.
plugin=ManageDatabases&call=DatabaseAssign:
Finally, this section selects which plugin to use, as well as which specific call this plugin will use.
Thank you,
Adam G
JetApps, LLC.
JetApps.com | JetBackup.com
Adam G
JetApps, LLC.
JetApps.com | JetBackup.com