import / Export hosting plans
if you would manage multiple Plesk servers that function very appropriate
The requested functionality was delivered in the Hosting Plan Exporter extension. Check it out in the Extension Catalog for Plesk.
Link to download: https://ext.plesk.com/packages/7f733002-c923-4f9f-aba4-17eb3c19c84a-hp-exporter/download?1.0.0-32
—
AA
-
Alexander Neck commented
How to use it over cli? it should be supported, but i can't find the documentation..
as from releasenotes:
1.1.0 (3 May 2023)
[*] Added support for the export and import commands to the CLI. -
Marc Edgley commented
would love to see the ability to import export plans via the gui, atm I am doing this by the cli with the "plesk bin service_plan" utility which is a pain and other admins/admins without root/limited access are unable to make changes unless they manually input the changes on all servers which leads to mistakes, I would be happy with an extension that does the basics at the least import/export service plans/addons
-
Carl Swart commented
A few pointers after having to do it for the umpteenth time. :)
All needs to be done via SSH on the command line interface.
# /usr/local/psa/bin/service_plan --xml-info 'SERVICE_PLAN_NAME' >> service_plans.xml
Dump all your service plans into a service_plans.xml file using the --xml-info command of the service_plan tool supplied by Plesk.
Then use my code below on the new server to import the service plans from the service_plans.xml file.
There are differences in the service_plan tool parameters in the different versions of Plesk so, study the 3 arrays, $convert, $deprecated, $sizes and adjust as needed.
# cat make_service_plans.php
<?php// Enable for debug output
define('DEBUG', 1);$file = 'service_plans.xml';
$xml = new DOMDocument();
$xml->loadXML('<service_plans>'.file_get_contents($file).'</service_plans>');$convert = array('wu_script' => 'wuscripts', 'nonexist_mail' => 'no_usr', 'errdocs' => 'err_docs', 'pdir_plesk_stat' => 'webstat_protdir', 'stat_ttl' => 'keep_traf_stat');
$deprecated = array('fp', 'fp_ssl', 'fp_auth', 'php_handler_type', 'php_safe_mode', 'dns_type', 'same_ssl', 'allow_license_stubs');
$sizes = ['disk_space', 'quota', 'mbox_quota'];$service_plans = $xml->getElementsByTagName('domain-service-plan');
foreach($service_plans as $service_plan) {
$command = '/usr/local/psa/bin/service_plan ';
$service_plan_name = $service_plan->getAttribute('name');
$service_plan_owner = $service_plan->getAttribute('owner-login');
// echo "$service_plan_name - Owned by: $service_plan_owner\n";
$command .= "--create '$service_plan_name' ";
if ($service_plan_owner != "admin") {
$command .= "-owner $service_plan_owner ";
}foreach($service_plan->getElementsByTagName('service-plan-item') as $service_plan_item) {
$name = $service_plan_item->getAttribute('name');
$value = $service_plan_item->nodeValue;
if (($name == 'vh_type') && ($value == 'physical')) {
$name = 'hosting';
$value = 'true';
}
// Remove deprecated settings
if (in_array($name, $deprecated)) {
continue;
}
// Convert old settings
if (in_array($name, array_keys($convert))) {
$name = $convert[$name];
}
// Convert bytes to MB
if (in_array($name, $sizes)) {
$value = $value / 1024 / 1024;
$value .= 'M';
}
$command .= "-$name $value ";
}$final_command = trim($command);
$command_result = `$final_command`;
if (!preg_match("/(SUCCESS: | successfully )/", $command_result)) {
print("ERROR: $command_result - $final_command\n");
}
}?>
Run the script: #php make_service_plans.php
Hope it helps somebody.
-
Claudio commented
This has already been requested with over 100 votes..
import / Export hosting plans
-
Luis Zubeldia commented
+1
-
Tom iTrena commented
And again...
Meanwhile we have 11 servers with Plesk. All the time we are leasing another one, we have to set up all the 20 Hosting-Plans again.
And if the plans change, we have to do the same work on every server, again, and again...
This takes many hours of work!
So what´s going on? It is very easy to add this feature to Plesk,- we are waiting for... -
[Deleted User] commented
Now it has more 100 votes and Plesk is still ignoring it. Fail.
-
Chris Danks commented
HI
Any news on this? its had plenty of votes??
-
Ghaith J. commented
bump bump
-
Anonymous commented
there is a way to export the plan into XML, but there is no way to import this yet:
/usr/local/psa/bin/service_plan -x "Plan Name"
i wont post any solutions to this as it is untested, but a crafty admin could make a create statement for service_plan using sed on this xml output.
-
Anonymous commented
Any News about this?
-
Greg Conway commented
@Sergey L (Director of Program Management, Plesk)
Where are these examples to which you refer? Could you please provide an example of how to import/export hosting plans here (where many people are looking for such functionality), or provide a link?
Thanks -
Ender commented
We are waiting for this feature for a long time.
It is really difficult to sync all plans between servers.
At least make something like YAML file.
So we can export and import it as new or update current packages in different servers. -
[Deleted User] commented
Would it be possible to add an import/export feature to the subscription plans settings (customer-service-plan/list), so we can have exactly same features enabled on all new created Plesk panels
-
COVI commented
Allow to export or migrate Service Packages and Add-Ons as single option and also hold them on Abbonements while migrating
-
Jasper van Veen commented
@Mike switch to cPanel or DirectAdmin. They do actually have an option to transfer your setup plans in a breeze, unlike Plesk. We tested cPanel for 4 months and we are now transfering, or better said migrating, all our 60+ servers over to cPanel.
We will keep about 4 or 5 servers with Plesk, for the customers who want to stay on Plesk, but most are very content with cPanel as well. We also have several servers with DirectAdmin (which is really cheap). So if you want an easy way to duplicate / transfer service plans, than I would recommend you to make the switch. Plesk isn't what it used to be.
-
@Mike
There is already a reliable way to transfer or copy service plans with quite easy CLI and you can find some examples below. Delivering this request will add some convenience, surely, but it doesn't seem to be in the top - perhaps because quite many hosters already utilize CLI and thus are not disturbed too much with this problem. On the other end, they might want one of 30+ higher voted functions first and we are taking those votes quite seriously. i hope it explains why this request isn't delivered yetIf that is critical for you, wouldn't it be more productive to start using CLI now?
-
[Deleted User] commented
-
[Deleted User] commented
WHEN IS ODING ADDING THIS?!
I am getting tired of waiting. We are only getting BS options with Plesk nowadays. Not even a decent websitebuilder, but who cares, there are plenty alternatives for this.
So ****; add the ability to also transfer full service plans from one Plesk to another including all settings without issues. Please....
THANK YOU!!
-
Andy Bird commented
bump bump bump.. real drag reinventing these for every server.