Project

General

Profile

Actions

CdmDataportalSiteMigration » History » Revision 53

« Previous | Revision 53/55 (diff) | Next »
Katja Luther, 08/11/2022 09:55 AM


CDM Dataportal Site Migration

This page describes how to clone a dataportal site and install it on another server.

On cloning dataportal sites between servers (clone site folder, settings and data base)

IMPORTANT!!!!
Here we are assuming that you have setup the dataportal installation according to the instructions given at: DataportalDevelopmentRequirements

This guide is split in three chapters:

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

How to create a new site on the BGBM EDIT server is described at https://wiki.bgbm.org/bdinotes/index.php/EDITProductionNewDataPortal

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 https://dev.e-taxonomy.eu/svn/trunk/server-scripts

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

Once the archive is extracted you may delete it

rm 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

Almost done! As last step in this chapter, we need to register the site in the sites/sites.php file

vi web/sites/sites.php

After editing this file it is recommended to check the validity of the configured sites, create a file sites-debug.php with:

<?php

require('sites.php');

print_r($sites);

and test your settings:

php web/sites/sites-debug.php

The output shows which url pattern are mapped to which sub-folder of web/sites/

Array
(
    [dataportal.test.cichorieae] => cichorieae
    [dataportal.test.cyprus] => cyprus
    [dataportal.test.palmae] => palmae
    [dataportal.test.algaterra-new] => algaterra-new
)

in case your new site is to be running at http://dataportal.test/algaterra-new/

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.

drush -l http://dataportal.test/algaterra-new/ st

IMPORTANT: Check the output for the "Database name", "settings.php" file etc to make sure that we are operating on the correct site with the correct settings!!!

Restore the database dump to your database server.

The name of the data base at this point should match the one that has been reported above.

Also make sure that the mysql user and its password are matching your local setup!!!

Otherwise you need to edit the database configuration, like user, password, database name or database prefix ( the prefix should end with an underscore character '_'!!!) in the according the Drupal site settings.php

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

drush -l http://dataportal.test/<site-name>/ st

now clear and disable the caches:

drush -l http://dataportal.test/<site-name> vset -y block_cache 0
drush -l http://dataportal.test/<site-name> vset -y cache 0
drush -l http://dataportal.test/<site-name> vset -y preprocess_css 0
drush -l http://dataportal.test/<site-name> vset -y preprocess_js 0
drush -l http://dataportal.test/<site-name> cc all

Drush may complain about missing modules? See the troubleshooting chapter below: "Fix missing modules"

Apply any pending database updates:

drush -l http://dataportal.test/<site-name>  updatedb  

Now you can visit the cloned site : http://datportal.test/

Navigation in the site seems broken? This might be caused by not working clean-urls, see the troubleshooting chapter below for fixing this.

Configure the cdm server (Optional step!)

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

Troubleshooting

Fix missing modules

Drush may complain 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://dataportal.test/new_site/ en wysiwyg imce imce_wysiwyg develop

Other modules can be removed as explained in the next step

If modules have been moved to other location in the web/sites folder you can try to repair the registry, so that the modules are found again:

Install the registry-rebuild module if it is not yet available:

drush @none dl registry_rebuild

Now you can repair the registry.

drush -l http://dataportal.test/<site-name> rr

or in newer versions:

drush -l http://dataportal.test/<site-name> rr --fire-bazooka
  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://dataportal.test/<site-name>

Fixing broken site navigation caused by clean-url

drush -l http://dataportal.test/<site-name> vset clean_url -y 0 

Fixing broken layout

After activating the cloned site it can happen, that the site looks messy and appears as it the theme is broken or even missing.
Below commands can help in this case to reset the cache disable it. Disabling the cache is anyway a good idea for development environments:

drush -l http://dataportal.test/<site-name> vset -y clean_url -y 0
drush -l http://dataportal.test/<site-name> vset -y preprocess_css 0
drush -l http://dataportal.test/<site-name> vset -y preprocess_js 0
drush -l http://dataportal.test/<site-name> cc all

Using drupal_site_debug

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 create file sites-debug.php:

<?php

require('sites.php');

print_r($sites);
php sites/sites-debug.php   

Updated by Katja Luther over 1 year ago · 53 revisions