Migrate my Dolibarr To the Cloud
This description explain how to move an existing instance of Dolibarr ERP & CRM into a remote web hosting service in the Cloud. Tutorial should works for every Dolibarr installation using a MySql database. Example is provided with DoliCloud (but works similarly for NovaFirstCloud and you should be able to replace all things specific to DoliCloud with any other SaaS provider of Dolibarr).
You can execute all the migrate process yourself following this tutorial. However, if you need more help, you can ask your questions by email (to email@example.com for DoliCloud or firstname.lastname@example.org for NovaFirstCloud).
- 1 Prerequisites
- 2 Step 1 - Backup your old database
- 3 Step 2 - Backup content of your documents directory
- 4 Step 3 - Create a Cloud instance
- 5 Step 4 - Upload documents into your Cloud instance
- 6 Step 5 - Load your old database into your Cloud instance
- 7 Test
- Check that you Dolibarr version (you will find it onto logon page) is lower or equals to DoliCloud version (In most cases, it should be true because DoliCloud plan offers the last stable version).
If you local version is older, you can first upgrade it locally but this is not necessary. This can be done also later during step 5). If your local version is higher, first ask the provider of the cloud solution to upgrade your new instance to the same version (or to a higher version) than your old instance.
Step 1 - Backup your old database
- First step is to backup your database. For this, go into menu Home - System tools - Backup. Click to generate a backup file (with mysqldump method). This will launch mysqldump command and show you the generated file.
Note: If you experience problem running this command (for example because your old hosting provider does not allow to run command mysqldump), you can launch the command from any other computer where MySql client software is installed. For this, run the following command:
mysqldump -h ip_of_old_mysql_server -P port_of_old_mysql_server -u user_database -ppassword_database > myoldserverdump.YYYYMMDD.sql
- Open the generated dump/backup file (name should looks like mysqldump_A.B.C_YYYYMMDDHHMMSS.sql) to see if file is complete: File should end with such a line:
-- Dump completed on YYYY-MM-DD HH:mm:ss
If yes, record this file in a secured place. It will be required at step 5.
Step 2 - Backup content of your documents directory
All files uploaded or generated using Dolibarr are stored into a directory called documents or dolibarr_documents. To know full path of this directory, go into menu Home - System info - Dolibarr - All parameters. Full path where all you files are stored is visible on line starting with key dolibarr_main_data_root.
Save this directory and all its content (subdirectories and files). Note: sometimes, a file called dolibarr.log may be found into the root of this directory. If you find it you can remote it safely before building your zip file. This will reduce its size.
Step 3 - Create a Cloud instance
If you don't have your own DoliCloud instance, create it using the registration form of the provider:
- For DoliCloud, go onto https://myaccount.dolicloud.com/register.php.
- For NovaFirstCloud, go onto https://myaccount.novafirstcloud.com/register.php?origin=wiki&utm_source=wiki&utm_campaign=none&utm_medium=web.
Note that creating your instance is completely free (for 15 days). But you can ask to increase this period if you need more time to complete your migration or to decide if you will continue or not using the service.
Step 4 - Upload documents into your Cloud instance
If you don't have knowledge in using a FTP software
Just send the file generated during step 2 by Email (to email@example.com for DoliCloud or firstname.lastname@example.org for NovaFirstCloud). If file is to large, provide it on a Google Drive or DropBox platform). Add the following message into your email "To migrate into my new Cloud instance called xxxxx" (replace xxxxx by name/URL of your instance). Our support team will overwrite your documents directory of your new empty Cloud instance with files of your old installation and will answer you once action is done.
If you have technical knowledge in using a FTP software
You can do this step yourself by following this process to replace files into your documents directory of your DoliCloud instance with files of your old installation:
Once DoliCloud instance has been created, you should have received an email with id to log to Dolibarr and to log to your customer dashboard.
- First, log to your new Dolibarr instance on DoliCloud. Go into menu Home - System info - Dolibarr - All parameters. You will find on line for key dolibarr_main_data_root, the value of full path of directory where documents are stored on DoliCloud instance.
- Then log to your cloud customer dashboard (https://myaccount.dolicloud.com). You will find an area with your SFTP credentials identifiers.
- With any SFTP software (WinSCP or FileZilla for Windows, Nautilus for most Linux), login to the server of your instance using SFTP protocol and those credentials, to copy all documents files and sub-directories you saved from previous step into the DoliCloud document directory identified at previous step.
A more complete tutorial to connect with SFTP and transfer files may be found here: https://www.dolicloud.com/en-faq-how-to-setup-my-sftp.php
Step 5 - Load your old database into your Cloud instance
If you do not have technical knowledge in Mysql database management software
Simply send the file generated in step 1 by email to email@example.com indicating in the message "To migrate into my new dolicloud instance called xxxxx.with.dolicloud.com". Our support team will replace your empty new DoliCloud instance with data of your old database and will answer you by email as soon as work is done.
If you have technical knowledge in Mysql database management software
You can use the following procedure to replace the database of your new DoliCloud instance by data of your old installation.
- Log to your new DoliCloud customer dashboard again. You will find an area with your Mysql identifiers.
Go on any computer where MySql and mysqldump command is install. Launch the following command to save the new DoliCloud initialized database (to restore DoliCloud if something is wrong later).
mysqldump -h yourinstance.with.dolicloud.com -P 3306 -u doliclouduser -pdolicloudpassword doliclouddatabase > dolicloud.YYYYMMDD.sql
where all information yourinstance.with.dolicloud.com ,doliclouduser, dolicloudpassword and doliclouddatabase can be found onto your DoliCloud dashboard.
- Run the following command to overwrite database with database of your old server.
mysql -h yourinstance.on.dolicloud.com -P 3306 -D doliclouddatabase -u doliclouduser -pdolicloudpassword < myoldserverdump.YYYYMMDD.sql
Note: If you get an error like "ERROR 1005 (HY000) at line 25: Can't create table `...`.`llx_accounting_account` (errno: 150 "Foreign key constraint is incorrectly formed")", remove/drop manually the 4 following table if they exists: llx_accounting_account, llx_accounting_system, llx_accountingaccount, llx_accountingsystem. Then try again.
Note: If you get an error like "ERROR 1064 (42000) at line 18: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TYPE=InnoDb...' at line ...", replace the strings "TYPE=InnoDB" with "ENGINE=InnoDb" into dump file. Then try again.
Note: If you get an error like "ERROR 1419 (HY000) at line 5616: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log _bin_trust_function_creators variable)", check into your .sql dump file that you don't have lines with ...50003 TRIGGER.... They are lines that try to create triggers and that may be here if a trigger was manually inserted into your old database (Dolibarr common version does not need any trigger).
Now, call your Dolibarr login page of your new instance.
If your old Dolibarr version was older than DoliCloud Dolibarr version, you should receive a page to ask you to launch the upgrade process. Just choose the choice suggested by the upgrade wizard. If you receive a message saying upgrade is "locked" by file install.lock, launch again your SFTP client and remove the file documents/install.lock.
Once upgrade is done, or if your version was same than DoliCloud, you can connect using a user that did exists into old server database, with same password. Your admin user created during the instance init does no more exists as it was overwritten by the database load at previous step.