Duplicate a Dolibarr instance into another one: Difference between revisions

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
mNo edit summary
Tag: 2017 source edit
m (Eldy moved page Use your data to test last version to Duplicate a Dolibarr instance into another one: Duplicate a Dolibarr instance into another one)
 
(7 intermediate revisions by one other user not shown)
Line 2: Line 2:
<!-- You can edit this section but do NOT remove these comments
<!-- You can edit this section but do NOT remove these comments
     Links below will be automatically replicated on translated pages by PolyglotBot -->
     Links below will be automatically replicated on translated pages by PolyglotBot -->
[[fr:Dupliquer_une_instance_de_prod_en_instance_de_test]]
[[fr:Dupliquer_une_instance_de_production_en_instance_de_test]]
[[es:Utilice_sus_datos_para_probar_la_última_versión]]
[[es:Utilice_sus_datos_para_probar_la_última_versión]]
<!-- END interlang links -->
<!-- END interlang links -->


[[Category:Admin_en]]
[[Category:Admin_en]]
{{ToTranslate}}


Les testeurs parmi vous voudront certainement, à un moment ou l'autre, tester les dernières mises-à-jour disponibles afin de vérifier l'état de certains bugs ou valider une nouvelle version.
The testers among you will certainly want to test the latest updates at some point in order to check the status of certain bugs or commit to a new version.


Afin d'utiliser vos données en toute quiétude, voici une procédure à suivre pour éviter les pertes...
= Duplication of a Dolibarr instance =


'''Attention!''' Cette documentation a pour base des exemples pris d'une installation Dolibarr avec la configuration suivante
In order to use your data with peace of mind, here is a procedure to follow to avoid losses ...
 
'''Warning!''' This documentation is based on examples taken from a Dolibarr installation with the following configuration
* Linux Debian Etch
* Linux Debian Etch
* MySQL 4.1
* MySQL 4.1
* Apache2
* Apache2
Dans le cas où vous utiliseriez un autre type de machine, merci de procéder aux modifications d'usage.
If you use another type of machine, please make the usual modifications.


= Copie =
= Copy =
Comme vos données ont une valeur importante, il serait dommage de les perdre. Afin de tester une mise-à-jour, pourquoi ne pas copier vos données ailleurs?
As your data is of great value, it would be a shame to lose it. In order to test an update, why not copy your data elsewhere?


== Répertoire ==
== Directory ==
Étant donné que, fort probablement, toute votre installation de Dolibarr réside dans un unique répertoire, une copie sera facile.
Since, most likely, your entire Dolibarr installation resides in a single directory, copying will be easy.
<source lang="bash">
<source lang="bash">
cp -ra /var/www/dolibarr /var/www/dolibarrtest
cp -ra /var/www/dolibarr /var/www/dolibarrtest
</source>
</source>
Cette commande copiera votre répertoire Dolibarr (supposé être dans /var/www/dolibarr ici) dans un second répertoire dolibarrtest sur lequel vous mènerez vos tests.
This command will copy your Dolibarr directory (supposed to be in /var/www/dolibarr here) in a second dolibarrtest directory on which you will run your tests.
Le ''-ra'' veut dire ''récursif'' et ''conserve les droits sur les fichiers''. Cette dernière option vous permettra de ne pas vous soucier des questions de droits sur les fichiers après copie.
The ''-ra'' means ''recursive'' and ''retains files permission''. This last option will allow you not to worry about file rights issues after copying.


== Base de données ==
== Database ==
* Faites une sauvegarde de votre base de données:
* Backup your database:
<source lang="bash">
<source lang="bash">
mysqldump -u utilisateur -p --result-file=dolibarr.date.sql base_de_donnees
mysqldump -u utilisateur -p --result-file=dolibarr.date.sql database
</source>
</source>
* Éditez le fichier résultant et modifiez la ligne ''USE base_de_donnees;'' en début de fichier pour la remplacer par un nouveau nom de base de données, celui de la base de données de tests, par exemple ''USER base_de_donnees_test;'' dans ce cas-ci.
* Edit the resulting file and modify the line ''USE database;'' at the start of the file to replace it with a new database name, that of the test database, for example ''USER test_database;'' in this case.
* Créez la nouvelle base de données si ce n'est pas déjà fait. Si la base de données existe, droppez-la et recréez-la, afin de n'obtenir au final que les données réellement extraites de votre base de données courante.
* Create the new database if you haven't already. If the database exists, drop it and recreate it, in order to get in the end only the data actually extracted from your current database.
<source lang="bash">
<source lang="bash">
mysqladmin -u utilisateur -p drop base_de_donnees_test
mysqladmin -u user -p drop test_database
mysqladmin -u utilisateur -p create base_de_donnees_test
mysqladmin -u user -p create test_database
</source>
</source>
Il se peut que vos permissions ne vous autorisent pas à dropper/créer une base de données. Dans ce cas, reportez-vous à votre documentation de MySQL concernant les permissions.
Your permissions may not allow you to drop/create a database. In this case, see your MySQL documentation regarding permissions.
* Importez les données de votre base de départ dans votre nouvelle base
* Importez les données de votre base de départ dans votre nouvelle base
<source lang="bash">
<source lang="bash">
mysql -u utilisateur -p base_de_donnees_test < dolibarr.date.sql
mysql -u user -p test_database < dolibarr.date.sql
</source>
</source>


== Hôtes virtuels d'Apache ==
== Apache Virtual Hosts ==


Si vous utilisez des hôtes virtuels dans Apache, il faudra en créer un nouveau pour votre installation de test. Par exemple, si vous aviez quelque chose comme ceci dans un fichier nommé ''/etc/apache2/sites-available/dolibarr'':
If you are using virtual hosts in Apache, you will need to create a new one for your test installation. For example, if you had something like this in a file named ''/etc/apache2/sites-available/dolibarr'':
<code>
<source lang="bash">
  <VirtualHost *:80>
  <VirtualHost *:80>
   ServerName dolibarr.mondomaine.net
   ServerName dolibarr.mydomain.net
   ServerAdmin webmaster@mondomaine.net
   ServerAdmin webmaster@mydomain.net
   DocumentRoot /var/www/dolibarr/htdocs
   DocumentRoot /var/www/dolibarr/htdocs
   DirectoryIndex index.php
   DirectoryIndex index.php
Line 59: Line 60:
   CustomLog /var/log/apache2/dolibarr-access.log combined
   CustomLog /var/log/apache2/dolibarr-access.log combined
  </VirtualHost>
  </VirtualHost>
</code>
</source>
... il faudra à présent en faire une copie dans, par exemple, ''/etc/apache2/sites-available/dolibarrtest'':
... it will now be necessary to make a copy in, for example, ''/etc/apache2/sites-available/dolibarrtest'':
<code>
<source lang="bash">
  <VirtualHost *:80>
  <VirtualHost *:80>
   ServerName dolibarrtest.mondomaine.net
   ServerName dolibarrtest.mydomain.net
   ServerAdmin webmaster@mondomaine.net
   ServerAdmin webmaster@mydomain.net
   DocumentRoot /var/www/dolibarrtest/htdocs
   DocumentRoot /var/www/dolibarrtest/htdocs
   DirectoryIndex index.php
   DirectoryIndex index.php
Line 70: Line 71:
   CustomLog /var/log/apache2/dolibarrtest-access.log combined
   CustomLog /var/log/apache2/dolibarrtest-access.log combined
  </VirtualHost>
  </VirtualHost>
</code>
</source>


Attention, ceci ne suffit pas à rendre cet hôte disponible, il faudra également:
Be careful, this is not enough to make this host available, it will also be necessary:
* mettre en place le sous-domaine spécifié, avec notamment des règles de redirection sur la machine qui sert de DNS à votre domaine
* set up the specified subdomain, including redirection rules on the machine that serves as DNS for your domain
* faire un lien symbolique depuis ''/etc/apache2/sites-enabled/dolibarrtest'' vers ''/etc/apache2/sites-available/dolibarrtest''
* create a symbolic link from ''/etc/apache2/sites-enabled/dolibarrtest'' vers ''/etc/apache2/sites-available/dolibarrtest''
<code>
<code>
ln -s /etc/apache2/sites-enabled/dolibarrtest /etc/apache2/sites-available/dolibarrtest
ln -s /etc/apache2/sites-enabled/dolibarrtest /etc/apache2/sites-available/dolibarrtest
</code>
</code>
* recharger la config d'Apache2
* reload the Apache2 config
<code>
<code>
/etc/init.d/apache2 reload
/etc/init.d/apache2 reload
</code>
</code>


== Fichier de configuration ==
== Configuration file ==
Enfin, le fichier de configuration ''/var/www/dolibarrtest/htdocs/conf/conf.php'' '''doit absolument''' être modifié. Tant qu'il n'est pas modifié, votre installation dolibarrtest se connectera en effet toujours à votr vraie base de données, pas celle de test!
Finally, the configuration file ''/var/www/dolibarrtest/htdocs/conf/conf.php'' '''must absolutely''' be modified. As long as it is not modified, your dolibarrtest installation will indeed always connect to your real database, not the test one!
Éditez le fichier de configuration et modifiez le nom de la base de données à laquelle se connecter. Dans la lignée des exemples ci-dessus, renommez ''base_de_donnees'' en ''base_de_donnees_test''.
Edit the configuration file and change the name of the database to connect to. Like in the examples above, rename ''database'' in ''test_database''.
Renommez également les répertoires auxquels votre configuration fait référence. Les ''/var/www/dolibarr'' deviennent ''/var/www/dolibarrtest''.
Also rename the directories your configuration refers to. The ''/var/www/dolibarr'' become ''/var/www/dolibarrtest''.


== Vérifications ==
== Checks ==
Si vous avez bien réalisé les étapes préparatoires, vous devriez à présent pouvoir charger votre nouveau portail dans votre navigateur et vérifier qu'il s'agit bien d'un portail distinct. Comment faire?
If you have completed the preparatory steps, you should now be able to load your new portal in your browser and verify that it is indeed a separate portal. How shall we do it?
=== Modification DB ===
=== DB modification ===
* Modifiez une petite information (par exemple modifiez vos détails persos) sur votre portail de test
* Modify a small information (for example modify your personal details) on your test portal.
* Déloggez-vous
* Log out.
* Loggez-vous sur votre portail de production
* Log into your production portal.
* Vérifiez si l'information a changé. Si elle a changé, reparcourez les étapes ci-dessus pour voir ce que vous avez manqué. Aucune modification n'aurait dû être apportée!
* Check if the information has changed. If it has changed, go through the above steps again to see what you missed. No changes should have been made!
* Si aucune modification n'a été apportée, c'est bien! Retournez sur votre portail de test et vérifiez que la modification que vous y aviez apportée y est toujours... bien.
* If no changes have been made, good! Go back to your test portal and check that the change you made is still there ... well.


=== Modification documents ===
=== Modification of documents ===
* Ajoutez un document à l'une de vos fiches sur votre portail de test
* Add a document to one of your files on your test portal.
* Déloggez-vous
* Log out.
* Loggez-vous sur votre portail de production.
* Log into your production portal.
* Vérifiez si le nouveau document s'y trouve. S'il s'y trouve, reparcourez les étapes ci-dessus pour voir ce que vous avez manqué. Aucune modification n'aurait dû être apportée!
* Check if the new document is there. If it is there, go through the above steps again to see what you missed. No changes should have been made!
* Si aucune modification n'a été apportée, c'est bien! Retournez sur votre portail de test et vérifiez que la modification que vous y aviez apportée y est toujours... bien.
* If no changes have been made, good! Go back to your test portal and check that the change you made is still there ... well.




= Mise-à-jour =
= Update =


Vous avez tout copié, et votre configuration vous met à l'abri de modifications indésirées dans votre répertoire de production? Vous avez vérifié que vous pouviez accéder à votre portail de test depuis votre navigateur? Bien!
You copied everything, and your configuration protects you from unwanted changes in your production directory? Have you verified that you can access your test portal from your browser? Good!
Maintenant, récupérez la dernière version de Dolibarr et copiez-là aussi sec par-dessus l'autre, qui est dans ''/var/www/dolibarrtest'' (si on vous le demande, choisissez "écraser"). Ensuite, pointez votre navigateur sur le portail de test, et ajoutez "install/" dans l'URL. Le processus d'installation/mise-à-jour de Dolibarr devrait vous proposer une mise-à-jour. Acceptez et suivez les étapes.
Now get the latest version of Dolibarr and copy that too dry over the other one, which is in ''/var/www/dolibarrtest'' (if asked, choose "overwrite"). Then point your browser to the test portal, and add "install/" in the URL. The Dolibarr installation/update process should offer you an update. Accept and follow the steps.


Votre portail de test est maintenant mis-à-jour à la dernière version. Bravo!
Your test portal is now updated to the latest version. Well done!

Latest revision as of 21:29, 4 May 2024


The testers among you will certainly want to test the latest updates at some point in order to check the status of certain bugs or commit to a new version.

Duplication of a Dolibarr instance

In order to use your data with peace of mind, here is a procedure to follow to avoid losses ...

Warning! This documentation is based on examples taken from a Dolibarr installation with the following configuration

  • Linux Debian Etch
  • MySQL 4.1
  • Apache2

If you use another type of machine, please make the usual modifications.

Copy

As your data is of great value, it would be a shame to lose it. In order to test an update, why not copy your data elsewhere?

Directory

Since, most likely, your entire Dolibarr installation resides in a single directory, copying will be easy.

cp -ra /var/www/dolibarr /var/www/dolibarrtest

This command will copy your Dolibarr directory (supposed to be in /var/www/dolibarr here) in a second dolibarrtest directory on which you will run your tests. The -ra means recursive and retains files permission. This last option will allow you not to worry about file rights issues after copying.

Database

  • Backup your database:
mysqldump -u utilisateur -p --result-file=dolibarr.date.sql database
  • Edit the resulting file and modify the line USE database; at the start of the file to replace it with a new database name, that of the test database, for example USER test_database; in this case.
  • Create the new database if you haven't already. If the database exists, drop it and recreate it, in order to get in the end only the data actually extracted from your current database.
mysqladmin -u user -p drop test_database
mysqladmin -u user -p create test_database

Your permissions may not allow you to drop/create a database. In this case, see your MySQL documentation regarding permissions.

  • Importez les données de votre base de départ dans votre nouvelle base
mysql -u user -p test_database < dolibarr.date.sql

Apache Virtual Hosts

If you are using virtual hosts in Apache, you will need to create a new one for your test installation. For example, if you had something like this in a file named /etc/apache2/sites-available/dolibarr:

 <VirtualHost *:80>
  ServerName dolibarr.mydomain.net
  ServerAdmin webmaster@mydomain.net
  DocumentRoot /var/www/dolibarr/htdocs
  DirectoryIndex index.php
  ErrorLog  /var/log/apache2/dolibarr-error.log
  CustomLog /var/log/apache2/dolibarr-access.log combined
 </VirtualHost>

... it will now be necessary to make a copy in, for example, /etc/apache2/sites-available/dolibarrtest:

 <VirtualHost *:80>
  ServerName dolibarrtest.mydomain.net
  ServerAdmin webmaster@mydomain.net
  DocumentRoot /var/www/dolibarrtest/htdocs
  DirectoryIndex index.php
  ErrorLog  /var/log/apache2/dolibarrtest-error.log
  CustomLog /var/log/apache2/dolibarrtest-access.log combined
 </VirtualHost>

Be careful, this is not enough to make this host available, it will also be necessary:

  • set up the specified subdomain, including redirection rules on the machine that serves as DNS for your domain
  • create a symbolic link from /etc/apache2/sites-enabled/dolibarrtest vers /etc/apache2/sites-available/dolibarrtest

ln -s /etc/apache2/sites-enabled/dolibarrtest /etc/apache2/sites-available/dolibarrtest

  • reload the Apache2 config

/etc/init.d/apache2 reload

Configuration file

Finally, the configuration file /var/www/dolibarrtest/htdocs/conf/conf.php must absolutely be modified. As long as it is not modified, your dolibarrtest installation will indeed always connect to your real database, not the test one! Edit the configuration file and change the name of the database to connect to. Like in the examples above, rename database in test_database. Also rename the directories your configuration refers to. The /var/www/dolibarr become /var/www/dolibarrtest.

Checks

If you have completed the preparatory steps, you should now be able to load your new portal in your browser and verify that it is indeed a separate portal. How shall we do it?

DB modification

  • Modify a small information (for example modify your personal details) on your test portal.
  • Log out.
  • Log into your production portal.
  • Check if the information has changed. If it has changed, go through the above steps again to see what you missed. No changes should have been made!
  • If no changes have been made, good! Go back to your test portal and check that the change you made is still there ... well.

Modification of documents

  • Add a document to one of your files on your test portal.
  • Log out.
  • Log into your production portal.
  • Check if the new document is there. If it is there, go through the above steps again to see what you missed. No changes should have been made!
  • If no changes have been made, good! Go back to your test portal and check that the change you made is still there ... well.


Update

You copied everything, and your configuration protects you from unwanted changes in your production directory? Have you verified that you can access your test portal from your browser? Good! Now get the latest version of Dolibarr and copy that too dry over the other one, which is in /var/www/dolibarrtest (if asked, choose "overwrite"). Then point your browser to the test portal, and add "install/" in the URL. The Dolibarr installation/update process should offer you an update. Accept and follow the steps.

Your test portal is now updated to the latest version. Well done!