Migrate a site

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
hewiep's picture

Can anyone give me the steps needed to do the following?

I have a current Drupal 7 website located at a hosting service that an organization uses for about 40 websites on Windows, but the Drupal site is on a Linux server. The site in question is the Drupal 7 site on Linux.

I have picked up a GoDaddy account that I can have several subdomains and have used 1 domain name to set up that account. Please do not advise on the pros & cons of using GoDaddy. That is not my issue.

The current Drupal site is “not quite live” but is almost ready to make live. I wish to duplicate the entire site on 1 or 2 subdomains to do some serious testing and changing themes, as well as testing for issues that might arise using GoDaddy as a host, etc.

I have the “Backup & Migrate” module installed and available on the current site. I only have about a dozen people registered on the site during my test period on the current site, but have an enormous amount of data already uploaded and in place.

In order to duplicate that current site on GoDaddy as 1 or more sub-domains, what steps do I need to take. I also need some direction. Do I create an empty database first?, Do I create a database prior to migrating or does the module create a database? Do I create a Drupal core site (empty) first, then copy over all of the files, then create or “migrate’ the database? Etc.

I have done a lot of searching and most of the articles leave out major steps and make it more confusing that I think that it should be. I know that I will have to change the settings file for each duplication, but where else will I need to make changes?

Any help would be appreciated.

Hewie Poplock

Comments

Hope this helps

densolis's picture

I don't know about the sub-domain issues. I will assume they are setup correctly.

There are five steps to transferring a site.
1. Install backup and migrate on you old site and activate it.
2. Transfer the code
3. Install the D7 site on the new location
4. Transfer the data files in sites/default/all
5. Transfer the MySQL database.

You may also need three computers:
1. Old server
2. Local development computer
3. New server

I have never done a site to site transfer. Theoretically, you should be able to do a directory transfer of the code using git. I don't know about the a direct transfer of the data. Using ftp, you are probably going to need a "transfer" or local dev computer to act as the local host.

Transfer the code
1. Setup git on your old server and go daddy.
2. Setup a remote repository for the code
3. Commit the existing d7 code on the old server.
4. Push the code to the remote repository
5. Clone the code on the godaddy site from the remote repository.

Transfer the data in sites/default/files
If you have drush and rsync, you can then rsync the data files in the sites/default/files. If not, just ftp the files from the old site to a local machine. Then ftp them from you local machine to the godaddy d7 site.

Install the D7 site.
Go to godaddy and install the d7 site just like you would anywhere else. You will go through the standard install. At the end you will have a base d7 with all of your modules, and you data in sites/defaul/files.

Transfer the data in my sql
1. Using the backup and migrate module on the old system, backup the MySql database to a file on a local machine.

  1. Upload the MySql backup to the go data machine.

  2. No supposedly, you can use the backup and migrate module to restore the data on your destination machine. But that usually does not work for me. I just use phpMyAdmin to manually import the data from the backup and migrate download / upload file.

Here are two links for downloading a site from webenabled (a competitor to godaddy) and how to upload a site to webenabled. I provide these because while the godaddy details will be different, the over all theory and process will be the same.

These videos are courtesy of Micheal Anello and Drupal Easy.
Using Git to push a local site to WebEnabled.com: https://www.youtube.com/watch?v=-5FCVZdm2Q4 - 30:45
Using Git to clone from WebEnabled to a local machine: https://www.youtube.com/watch?v=Lo50e-Q01ZE - 20:01

Those are the highlight to the process. I'm going to guess you might have a few questions, so please post them.

Good luck.

Installing git on godaddy

densolis's picture

There are some issues with installing git on godaddy, but I know someone who has done it and she will try to post her notes on this article.

It can be done

C13L0's picture

Sadly enough, I work with godaddy and drupal sites on a regular basis. I feel your pain. It is not our choice but the clients of where they want to be hosted. Here is how I manage things.

Hopefully you already use git, drush, and have a repo account. If you don't have a repo, then I would recommend bitbucket as it's free and works great with godaddy.

Here are the steps for command line access to godaddy to make your life easier. Once you have all of this in place, you can clone locally. You will create a new db and virtual host for your cloned site and deploy as if it were a new drupal site. Drush en backup_migrate then go to the local site and restore the database from the live site.

There are a few issues pulling sites locally from godaddy such as clean urls. Usually, I just replace the root .htaccess with a clean one. If you run across any other issues please drop by irc #drupal-florida.

Access to ssh on godaddy server:

Step 1. Find your ssh login. In the control panel under settings, click on FTP Users Icon

Step 2. Look for your (Primary) user name. You will use this to ssh in. When you ssh in, it will look like this: ssh primaryname@yourwebsite.com

Step 3. If you don't remember your password, go ahead and change it under settings. You will need this!

Log into godaddy via terminal

Step 1.
ssh ftpname@yoururl.com
pw: (enter your pw)

Step 2.
Add your public key. You have to use vi with godaddy.

Verify you are in root directory and look for .ssh folder.
ls -a

Proceed to step 3 if there is.

  1. mkdir .ssh
  2. touch .ssh/authorized_keys
  3. cd .ssh
  4. vi authorized_keys
  5. type in i (to insert)
  6. paste in your public key
  7. esc (key)
  8. ctrl: wq

Install Git - you will need to have a repo setup

Grab the binaries from EPEL- This is important because godaddy uses CentOS

  1. cd ~
  2. mkdir git
  3. cd git

Download the rpm from EPEL ( http://fedoraproject.org/wiki/EPEL )
wget http://dl.fedoraproject.org/pub/epel/5/i386/git-1.7.4.1-1.el5.i386.rpm

Extract binaries from the rpm
rpm2cpio git-1.7.4.1-1.el5.i386.rpm  | cpio -imdv
Clean up and remove the unneeded file
rm git-1.7.4.1-1.el5.i386.rpm

In the root -configure your $path variable - you can just copy/paste the entire code at once

echo "
export GIT_BIN=${HOME}/git
export PATH=${GIT_BIN}/usr/bin:${PATH}
export GIT_EXEC_PATH=${GIT_BIN}/usr/bin
export GIT_TEMPLATE_DIR=${GIT_BIN}/usr/share/git-core/templates
export GIT_SSL_NO_VERIFY=true" >> ~/.bashrc

close connection and ssh back in

Go to root of drupal site and add your repo info. I am using bitbucket as an example. ---important note: Since you will only have ssh access TO godaddy, you must use https:// instead of ssh:// in the remote address

  1. git init
  2. git remote add origin https://youraccount@bitbucket.org/accountname/reponame.git

Install Drush

Go to https://drupal.org/project/drush and copy the .gz link to the most recent recommended version. Replace the link and version below with the most current one

  1. wget http://ftp.drupal.org/files/projects/drush-7.x-5.8.tar.gz
  2. tar -pzxf drush-7.x-5.8.tar.gz

View hidden files to see if .bash_profile has already been created. This file will be there if you have already installed git.
ls -a

edit the .bash_profile with vi or vim
vi .bash_profile

Add the following data by pressing i and pasting the following information using the insert mode.

export COLUMNS
alias drush='/usr/local/php5/bin/php ~/drush/drush.php'
alias php='/usr/local/php5/bin/php'

After the lines have been pasted, press Esc to exit insert mode and type :wq and press enter.

After the file closes, you may repeat the process to ensure the lines were properly written. Of course this time, you can the first step where you pasted the lines (If they have been indeed written).

Once you have confirmed that the lines were written to .bash_profile you will need to update your session by using the following command.

source .bash_profile
Confirm that drush installed properly and the proper aliases have been set, by
drush

check drush version/status
drush status

Good Luck!

wow

redrider's picture

way to go Cielo

WOW!

dhercjr's picture

You deserve some cake!

-doug

I left off...you must turn on SSH

C13L0's picture

Sorry, I left off the very first step! You must turn on SSH. In the control panel under "settings" click the SSH icon and enable. It might take a few minutes for it to become effective then you can proceed to the rest of the steps.

    • the cake is a lie ;)

Thanks for helping out C13L0

densolis's picture

Thanks. Wow - now I see what you meant by it was not a simple process. Great job!!!

@hewiep, let us know know what else you need.

I think someone needs to copy

mherchel's picture

I think someone needs to copy and paste that into a new Drupal documentation page. :)

Some additional Comments & Questions

hewiep's picture

I am re-creating a message that I thought I sent earlier today. It has disappeared.

Thanks for all of your help. Here are some notes to the responses.

I have not learned Git or Drush yet. They are on my to-do list. Are they required to accomplish what I am trying to do? Once I get a one of the test sites done, I will work on Git & Drush. (I promise!) I looked at C13L0’s instructions for them and know that I have some work to do to understand it all.

I back up all of the folders and files from my current working Drupal site on a regular basis by copying the files using FileZila. I also run Backup&Migrate and save the database each time. These files are copied to my desktop computer.

I will be using the 3 computer method. The current server, my desktop Computer (Windows 7), and the GoDaddy Server.

I have correctly configured a subdomain through GoDaddy and the Domain Name company and verified that it works & available, along with an FTP account for that sub-domain.

As I understand it, here is a summary of what I need to do:

  1. Backup all of my folders & files to my Desktop Computer
  2. Backup all of my images to my Desktop Computer
  3. Backup my database using Backup&Migrate (which is already installed)
  4. Install Drupal Core on the GoDaddy server (Using the current version that I am using, not the latest – see below)
  5. Create a new database on GoDaddy
  6. Copy all of the folders & files from my desktop computer to GoDaddy in the proper locations
  7. Restore the database from the backup on the desktop computer. Preferably, I should use phpMyAdmin instead of restoring using the Backup&Migrate module
  8. Make any needed changes in the sites/default/settings.php file
  9. Run update.php (I would guess that this is necessary)

Note on #4 above: My current hosting company is using Apache1. I was on Drupal 7.21 and all was working fine. When I tried to update to Drupal 7.22, the site completely bombed. 7.22 requires Apache2, which my hosting company does not yet have available. I had to go back to 7.21 and all works fine. Once I get the GoDaddy site up and running, I will then update the version.

I have looked at the videos from Mike on Git. I need to do some research to fully understand what it does. I also want to learn Drush. I think that the links to Mike’s Git videos should be added to our final docs on this and perhaps some links to help with Drush.

What are the advantages of using Git to accomplish my goals. I know many of you (probably all of you) use it. Why?

Even though I am quite advanced in some parts of Drupal, I am still a novice in others. I appreciate all of the input here to help me and others who are novices or are novices in some areas.

Thanks again,
Hewie

From experience with godaddy

C13L0's picture

From experience with godaddy on #7, I would recommend to use the backup_migrate module first. If that doesn't work then try alternative methods.

Just a short answer to why I use drush and git. I will let the experts give you a detailed answer. Instead of using FTP you can use git which is secure. Git also tracks changes and you can always rollback to a previous version if something goes wrong (and it will). git is super fast compared to ftp and can take seconds to update files compared to what could perhaps be hours by ftp.

As far drush you can simply download a module with the command: drush dl modulename. This is much faster than having to use the drupal UI. You can also use drush to update core, enable modules, disable modules, clear site cache, and so much more.

TL;DR: Drush and git will save you time (time is money)

Database Backups

redrider's picture

In the past I have had issues with the DB backup and restore from backup and migrate.

I always get a DB backup from the SQL server also which will always import back up to an SQL server.

Florida

Group organizers

Group categories

Florida Topics

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: