Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Convert Plesk installations to ISPconfig
Perl
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/P2I Added database support
.gitignore
README
config_default.yml Updated default config and docs
plesk2ispconfig.pl

README

NAME
        plesk2ispconfig - convert Plesk installations to ISPconfig


SYNOPSIS
        plesk2ispconfig [--config=file.yml]


DESCRIPTION

This script helps you migrate most of your Plesk installation to ISPconfig,
namely client accounts, mail addresses (mailboxes, aliases and forwards), web
sites and some databases. You configure it through a simple config file, mainly
for the credentials to access your installations and your server addresses, and
the rest should be fully automatic.

OPTIONS
    --config FILE
        A YAML config file, see below.
    --modules MODULE[,MODULE ...]
        Modules to run. Default is to run all available.
    --listmodules
        List available modules and exit.
    --domains DOMAIN[,DOMAIN ...]
        Process only these domains.
    --robust
        Print an error message and continue on database or SOAP communication
        errors instead of aborting.
    --debug
        Print fairly detailed information to help trace where things go wrong.

CONFIGURATION

Configuration is through a file written in YAML (http://yaml.org). The default
looks like this---just replace the values in there but don't change the format.
The script validates the contents though to make sure everything it needs is
there.

---
defaults:
  mail:
    gid: 5000
    homedir: /var/vmail
    maildir: /var/vmail/%d/%a
    uid: 5000
  web:
    allow_override: All
    ip_map:
      1.2.3.4: 5.6.7.8
    ruby: y
    suexec: y
    traffic_quota_lock: n
    stats_type: webalizer
server:
  mail: 1.2.3.4
  web: 1.2.3.4
  db: 1.2.3.4
plesk:
  db: psa
  host: 127.0.0.1
  port: 3306
  user: pleskuser
  pass: pleskpass
  sync:
    host: 127.0.0.1
    user: root
    port: 22
ispconfig:
  uri: http://localhost:8079/remote/
  proxy: http://localhost:8079/remote/index.php
  user: apiuser
  pass: 123456
postscript: execute_me_later.sh
mailsync:
  writerc: migration_offlineimap.rc
  fromserver: mail.%d
  use_ssl: 1

The "plesk" and "ispconfig" sections should be self-explanatory: they specify
how to access your respective installations. While ISPconfig has a reasonably
easy SOAP interface (in as far as that can be said about *any* SOAP interface),
Plesk's homegrown "XML RPC" is a complete train wreck so I speak SQL directly to
its database. This has only been tested with Plesk 9.5 though!

The "server" section simply specifies your ISPconfig server IPs. If you have
only one server for several functions (web/mail/db), just specify the same
address repeatedly.

The "defaults" contain settings that are found in ISPconfig but not directly
equivalent in Plesk. The following might need explanation:

ip_map: map old Plesk web server IPs to new ISPconfig ones. If you had several
        IPs and your sites distributed across them, this will recreate the
        same distribution in ISPconfig.
allow_override: Apache-style directive for .htaccess override permissions
                for every site.
maildir: A printf-style string that has "%d" replaced by the mail domain and
        "%a" by the account name. Some people prefer the full mail address in
        the final part, like "/var/vmail/%d/%a@%d", or for very small sites
        "/var/vmail/%a@%d"
stats_type: The kind of webstats program the site wants. I have no idea whether
            anything besides "webalizer" really works.
postscript: The name of a script that plesk2ispconfig will write and that must
            be executed on the ISPconfig system later to complete the migration.
            As ISPconfig sensibly hands off more complicated actions such as
            website creation to a cron job, we can't assume all of that has been
            done when an API call returns so we have to defer rsyncing of
            websites and dumping/restoring of databases as well. After the
            script finishes, copy the file to the target server, wait ~10min and
            execute it. It uses the user, host and port entries under
            plesk->sync to log in to the Plesk system using SSH. Every step
            opens a new connection so you'd better set up public-key
            authentication to this account if you want to avoid typing the same
            password over and over again.
mailsync: plesk2ispconfig writes an offlineimaprc file named as specified under
          "writerc". Using this to run the "offlineimap" tool, you can
          synchronize IMAP accounts from source to target even if they use
          different server software. "fromserver" is the server name to connect
          to, in case it's not the one Plesk runs on; this field can use the
          "%d" placeholder for the client account's domain name. The default
          would read IMAP data for user@example.com from mail.example.com.

databases: These settings control the migration of databases.
           Currently the only setting is a boolean value under "rewrite_names"
           that controls whether or not to rewrite database names to ISPconfig's
           scheme. Both have their drawbacks:
           - If you do rewrite the names, database and user names will get a
           prefix of c_$CLIENTID and cu_$CLIENTID respectively. Changing the
           database settings in ISPconfig will work but you'll have to change
           the credentials in all installed web applications, CMSs and whatever
           uses these databases. Theoretically we could guess the system and add
           an edit script after webspace rsyncing but this will probably only
           ever happen for the most common ones like Joomla, Wordpress and
           Drupal.
           - If you do not rewrite the names, you save the hassle of changing
           each site's DB credentials but changing anything about the DB later
           in ISPconfig will fail. Then the only solution is to create a new
           database in ISPconfig, dump the old one and restore it into the new
           one before DROPping it.
           
BUGS AND LIMITATONS

We're getting there. The script has done its first complete migration with only
little manual cleanup afterwards, but one should still take care and give the
resulting shell scripts at least a quick looking over before running them.
Particularly the following things should be kept in mind if they apply to your
system:

- The database format may have changed in Plesk 10 and cause things to break.
  If you have a Plesk10 installation that you'd like to convert, send me a dump
  (edit out your passwords though, they are stored in clear text) and I'll have
  a look.
- Custom name servers are not supported yet.
- The only database server supported is mysql. I haven't had a need
  for anything else, but support shouldn't be hard to add.
- Web stats should be preserved if using the same system (webalizer, awstats
  etc.) on both installations, but are not.
- Error handling is rather crude.

If you should run into an error that says "SOAP error for method
`domains_domain_add': You do not have the permissions to access this function.",
this is likely an ISPconfig bug though. You have two possibilities to work
around it:
a) Find the function "domains_domain_add" in
/usr/local/ispconfig/interface/lib/classes/remoting.inc.php and delete the whole
checkPerm() call (i.e. all but the function's last line)
b) Disable the Domains module (it's not essential for the migration to work) by
calling the converter with "--modules Clients,Databases,Mail,Websites"


REQUIREMENTS
        Perl and the following modules:
	local::lib
        Modern::Perl
        Moose
        MooseX::Declare
        MooseX::Types
        MooseX::Types::DateTime::ButMaintained
	MooseX::Getopt
        List::MoreUtils
        Method::Signatures::Modifiers
        DateTime::Format::MySQL
        Data::Dumper
        DBIx::Simple
        Digest::MD5
        Scalar::Util
        SOAP::Lite
        YAML
        Regexp::Common
        Regexp::IPv6

AUTHOR
	Matthias Bethke <matthias@towiski.de>
Something went wrong with that request. Please try again.