Project

General

Profile

Actions

CdmDataportalSiteMigration » History » Revision 21

« Previous | Revision 21/55 (diff) | Next »
Andreas Kohlbecker, 02/01/2022 03:43 PM


On migrating Data Portal sites between servers (clone site folder, settings and data base)

This guide is split in three chapters:

  1. Preparation and Requirements
  2. Cloning a site folder and settings
  3. Restoring database dumps

Preparation and Requirements

If you are about to host multiple data portals on the same machine it is recommended to install of them in a Drupal multi site setup.

If the site sub folders are named after a specific pattern you should be able to use the dataportal-admin helper scripts which allow you to perform important management tasks automatically on each of the DataPortals installed:

Install the dataportal-admin helper scripts

  1. Install Drush http://docs.drush.org/en/8.x/install/
  2. Download the dataportal-admin helper scripts from http://dev.e-taxonomy.eu/trac/browser/trunk/server-scripts/dataportal-admin

and make them available via your $PATH environment variable.

  1. Edit the config.template and save it as config.

Cloning a site folder and settings

ssh into the source server and go into the drupal root:

ssh me@remote-server
cd  /var/www/drupal-7-cdm-dataportal/web

Create a tar archive and exclude temp files.

export SITE='algaterra-new'; tar -c --exclude='*/files/css/*' --exclude='*/files/js/*'  -f ~/site-$SITE.tar sites/$SITE

Copy this archive to the target machine

scp me@remote-server:~/site-algaterra-new.tar /var/www/drupal-7-cdm-dataportal/web

Make sure the site to be cloned does not yet exists on the target machine!

Extract the archive:

tar -xf site-algaterra-new.tar

Now we need to fix the permission:

cd ..

now you should be in the drupal-7-cdm-dataportal root folder, which usually is /var/www/drupal-7-cdm-dataportal/web

run the fix-permissions.sh script. NOTE: you will need to replace me by the user appropriate for your setup

sudo scripts/admin/fix-permissions.sh --web-user www-data --admin-user me

Restoring database dumps

NOTE: It is recommended to follow these instructions without opening the modules or themes admin pages in Drupal before you completed the steps below.

  1. Restore the database dump to your database server
  2. Edit the database connect url (the database prefix should end with an underscore character '_') in the according the Drupal site settings.php
  3. Make sure the http server is configured to map the site uri like http://edit.test/d7/new_site/ (see DataPortalDeveloperEnvironmentSetupLinux for details on setting up the virtual host edit.test in apache)
  4. Open the web/sites/sites.php and check if the site is configured correctly in there.

Check if the site is configured correctly. In the drupal root execute:

drush -l http://edit.test/d7/new_site/ st

and check the output for the correct database, settings.php file etc.

Drupal may complain Install missing modules like wysiwyg, imce, imce_wysiwyg, develop, matomo etc. You may want to install some of these modules now.
For example, to install wysiwyg imce imce_wysiwyg develop execute:

drush -l http://edit.test/d7/new_site/ en wysiwyg imce imce_wysiwyg develop

Other modules can be removed as explained in the next step

  1. run drupal-fix-missing-modules.sh which is available at https://dev.e-taxonomy.eu/old/trac/browser/trunk/server-scripts/drupal/drupal-fix-missing-modules.sh ( To install checkout the server-scripts in /opt/)
/opt/server-scripts/drupal/drupal-fix-missing-modules.sh http://edit.test/d7/new_site/

alternatively you can also use the registry-rebuild command in case the module are all available:

installation:

drush @none dl registry_rebuild-7.x

Should drush complain about
https://www.drupal.org/project/registry_rebuild

drush -l http://edit.test/d7/new_site/ rr

or in newer versions:

drush -l http://edit.test/d7/new_site/ rr --fire-bazooka

Troubleshooting

In case of Problems assuming you are in the root folder of the drupal-7-cdm-dataportal project

cd web/
ln -s ../debug/drupal_site_debug.php ./ 

and run the drupal_site_debug.php for the site:

drush -l ${site-ulr} scr drupal_site_debug.php

Debug sites.php

To list all sites configured in the site/sites.php file:

php sites/sites-debug.php   

Configure other cdm server

 drush -l http://edit.test/d7/<site-name> vset cdm_webservice_url <cdm-instance-url>

Updated by Andreas Kohlbecker over 2 years ago · 21 revisions