User Tools

Site Tools


Sidebar

tutorials:server:migration:start

This is an old revision of the document!


Installation Migration or Folder/Domain Change

With all of our auction and classified software products you can move the complete installation from one directory on the same domain to another directory rather easily. There are a few things that will need to be updated when you change the directory, which are listed below in each of the steps.

These instructions can be used for the following situations:

  • Server Migration (meaning copying from one server to another) : Follow all steps <
  • Move installation1) : Skip step 2 <
  • Create test installation2) : Follow all steps, skip deleting old location. See the Note for Test Installations below. <
  • Domain change only3) : Use the reduced steps in the tutorial for Changing The Domain Name4) <

<tip c n>Note for Test Installations: This tutorial will also work when creating a duplicate installation for development, staging, or testing purposes. Note though that you are creating two separate and autonomous installations when you do so. This means two separate file locations and two separate databases. Each file set connecting to it's own database. This is irrespective of whether the test installation is on a different server, the same server and/or the same domain than the live installation. Each is a standalone copy of the other installation when finished. Just note NOT to delete the original installation if you are just creating the copy for development/testing/staging purposes.

If you choose to create an exact copy of your live installation in your testing location make sure to disable all notification emails sent by the system to your clients or they could be getting duplicate expiration notifications for anything expiring in the testing installation the same time it is expiring in the live installation. You can disable all of those within the following admin tool:

EMAIL SETUP > NOTIFICATION EMAIL SETTINGS</tip>

Step 0 - Preparation

Make sure you perform the move on a weekday, since Geodesic Solutions will need to update the installation location for your license key. If you try to move over the weekend you will have to wait until Monday before you can use the new location since our offices are only open normal business hours, Monday through Friday.

In your admin panel, go to Site Setup > Cache and turn cache off if it is currently turned on. It will make for less files to have to copy, and will make sure any cached data that contains the old folder location from causing problems, such as template file locations since those locations are cached.

We highly recommend to turn your site "off" during the move, to prevent users from placing listings with images after you have already transfered the files, so that the images don't make it in the move. You can do so using the setting Site Setup > General Settings > Site On/Off Switch.

Step 1 - Move Files

<tip c n>Note: In this step, whenever it says FTP or FTP software, you can alternatively use SFTP if your host supports this, the instructions are exactly the same whether you use FTP or SFTP. If your host supports it, we recommend SFTP as that is more secure.</tip>

This is the main step, moving the files from one directory to another. There are 3 different ways to accomplish this listed below, just choose the option that best fits your situation listed below:

Option 1: Folder Rename, on Same Server

If you are simply changing the folder name, all you have to do is re-name the folder using FTP software. Then delete the contents of templates_c/ folder, as there are times when moving the folder can cause those files to need to be re-generated. Keep the folder, but delete the contents of the folder. Once that is complete, you can proceed to Step 2 - Create Database.

Option 2: Use FTP to move from one folder or server to another

This is if you are moving to a new server, or even on the same server but to a different folder; or if you are creating a copy for testing purposes. You will need to move all root files of the software, classes directory, admin directory, images directory, etc… All files within the installation need to move at once with the relative directory structure of the files to one another kept the same. You can do this by downloading all files at once within your FTP program by selecting all and clicking to download all at once. When you are downloading, make sure you have the transfer mode set to BINARY to ensure that none of the files get corrupted.

Once all files are downloaded double check your FTP software to ensure it did not report any "errors" during download process, you want to make sure all the files downloaded correctly. Once you are sure of that, you can then upload them up to the new location, whether that is on the same server in a different folder, or upload to an entirely different server if you are changing servers. When uploading the files, make sure your FTP software has the transfer mode set to BINARY to avoid file corruption.

In the new folder location, you will need to make sure the sub-folders listed below and all of the folders' contents are "writable", usually this means to CHMOD 777 the folder and contents:

  • user_images/ (or whatever folder you use for uploaded images in classifieds or auctions)<
  • templates_c/<
  • _geocache/<
  • geo_templates/<

And finally, you will need to delete all the files in the templates_c/ folder, as there are times when moving the folder can cause those files to need to be re-generated. Keep the folder, but delete the contents of the folder.

Once that is complete, continue to the next step Step 2 - Create Database

Advance Option: Use SSH / SCP / ZIP to Transfer Files

<tip c w>Warning: This option is only for advanced users that are familiar with SSH and have SSH access on both the "from" and "to" locations, and ability to use SCP to directly transfer a file from one location to the other. This also means that both locations must be on Linux based servers, since SSH is not available for Windows servers. If you are not sure how to use SSH we recommend to use the option Option 2: Use FTP to move from one folder or server to another instead.</tip>

Only use this method if you are comfortable with using SSH and the command line, and you have SSH access for both the "from" location and the "to" location. Otherwise stick to the standard FTP instructions mentioned in Option 2: Use FTP to move from one folder or server to another.

This is accomplishing the same "end result" as the Option 2: Use FTP to move from one folder or server to another option, you will be copying the files from one location to the other, but "how they get there" is much different5). However if you are able to use SSH on the from and to locations, this option is much faster and more reliable since you only transfer a single large zipped file directly from one location to the other, instead of downloading and uploading the files one by one using FTP.

This is the overall steps you will be following: First, SSH into the "from" location, zip up the entire contents of the folder that the software is installed in. Then while in the "from" location still, use SCP to transfer the zipped file to the other location. Then SSH to the "to" location, move the zip file to the folder that the files should be installed in, and unzip.

Here are the individual steps:

  1. SSH to the "from" location, and use CD to change to the base directory that the software is in. This should be the same folder that has the config.php file for the software, which you can check for using ls. For example, if the Geo software was installed in public_html/classifieds/6), you might use:
cd public_html/classifieds/

<

  1. Zip up entire contents and all sub-folders recursively, using the following command:
    tar -zcvf geodesic_files.tar.gz .

    <

  2. Transfer the new geodesic_files.tar.gz file to the new location using SCP:
    scp geodesic_files.tar.gz username@example.com:/home/username/public_html/

Change username to the SSH username for the "to" location, change example.com to the "to" server domain, and change /home/username/public_html/ to the absolute folder that the software needs to be copied to. When you do that, it will prompt for the password, just enter the SSH password for the "to" location that goes along with the username you used. <

  1. SSH to the "to" location, using:
    ssh username@example.com

    Change username to the SSH username for the "to" location, change example.com to the "to" domain name. You will be prompted for the password, same as before enter the password that goes to the "to username" you used. <

  2. Use cd to change to the directory that you will be putting the software in, this should be the same folder as you used 2 steps up when you SCP the zip file over. For example if you are placing it in /home/username/public_html/ on the "to" location, use:
    cd /home/username/public_html/

    <

  3. Make sure the geodesic_files.tar.gz file exists in the folder. If not you may have transferred it to the wrong folder, in which case figure out where you copied it to, and copy it into the correct folder or re-transfer the file using SCP. Then unzip the file using
    tar -zxvf geodesic_files.tar.gz

    <

  4. Delete the contents of templates_c folder, using
    rm -Rf templates_c/*

    <

  5. You may wish to use FTP to download a copy of the geodesic_files.tar.gz file for backup purposes. Once you have downloaded a copy, be sure to delete the file from both locations using FTP (or SSH), as it could be a security risk to keep it somewhere that can be downloaded from the web. <
  6. That's it! Continue on to the next step Step 2 - Create Database <

Step 2 - Create Database

You can skip this step if staying on the same server, and the old location is going away. Do NOT skip if you are making a copy for testing purposes, your test installation will need it's own copy of the database!

In the location you are copying or moving the installation to, basically copy your existing database to the new installation location then update the config.php in the new location to use the new database. Below we go into more detail for those that are not familiar with this process:

First, on the new location, create a new database. Usually this is done through the hosting control panel.

Next, create a backup (sometimes called a DB dump) of the "from" database, that includes both "structure" and "data". Most hosts provide a program called phpMyAdmin for administering your MySQL databases of your hosting account. You will want to use phpMyAdmin to create a backup of the database of the old installation in SQL format. Many times hosts have built in "database backup" features but the output created by these types of backups usually require specific software to restore. You can try the backup created, but if it does not work use the SQL output from phpmyadmin for creating your backup instead of any host specific or proprietary backup systems.

<tip c n>Note: Be sure to use the Drop Table option as it makes recreating the database a bit easier.</tip>

Once you have created the DB backup or dump of the "from" database, import that into the "to" database. You can use PHPMyAdmin for this on the "to" location, there is a tool that allows you to import SQL files. Use that tool to import the SQL file created from the "from" database.

Moving the database over from the old installation to the new installation "moves" all the changes, configurations and settings you made through the old installations admin tool into the new installation. Consult your host's support documentation as they should provide help documents regarding using phpmyadmin.

And last, in the "new" location, edit the config.php file, and change the section regarding the database settings. They must be set to use the "new" database information.

Step 3 - Update License Key

<tip c n>Note: If you created a new database in the last step, you updated your config.php file on the new location, right? If not, do that now, the config.php on the new location needs to have the DB information for the new location in it.</tip>

Log into your admin panel in the new installation location and it will show the license key page, usually with an error message saying that the installation folder does not match. On the page it will list the detected installation folder and the installation domain, copy and paste this data exactly as it appears in the admin panel, and send it to [email protected] with the title of License Update Request so that it gets routed to the correct personnel as fast as possible. They will let you know if any further information is needed.

Note for test installations: If you have the newer GeoCore license, your license comes with 2 slots, one for the normal installation and one for a test installation. If you have not already used both slots, when you log into the admin panel you will have the option to continue using your existing license without having to contact us. After the 2nd installation location though, you must contact us to add new locations to your license or update existing locations.

Step 4 - Software Settings

Within the default design all HTML links are relative to the base directory of the installation, so they will dynamically be correct when the move is complete. However, if you have gone into any page templates or sub-templates and edited them placing absolute links within the software then these will need to be modified to reflect the new location. You can follow the instructions in this step to update any such links. If you are absolutely sure that you have not added any absolute links or image locations you can skip this step, however we still recommend at least double checking to make sure there are not any places found.

Go to Design > Text Search and search for the old installation folder, as it would be used in a link or image tag. For example if your old installation folder was in www.example.com/old_folder/ you would do a search for "old_folder" without the quotes. Start with the first search results tab, Pages/Modules Text, and click the button to edit text for each of the places that the old folder location is found. Make sure the WYSIWYG editor is turned off, and update any places in the text that use the old installation, to use the new one instead.

Keep doing this for each of the found results for Pages/Modules Text, then move on to Addon Text and repeat the process if any are found. Once you are through with addon text, repeat the process for Template Contents search results, when editing templates make sure to use the <..> Source Code Editor tab in the template editor.

<tip c n>Note: If you have multiple template sets, or sometimes if you have design mode set to advanced, when you attempt to edit a template it may give the error similar to:

File is from (my_templates) which is not within the current template sets being edited.

If this happens, on the page in the top left next to Template Set: ___ click the change button, and select the template set that the template is in that you are trying to edit. Once the page re-loads, you will be able to edit the template just fine.</tip>

Step 6 - Uploaded Images Location

One thing that cannot be updated by changing the setting in the admin panel, is the "full image folder" stored in the database for existing images. That folder path must be updated "by hand" in the database, otherwise it will remove images from the original location which is a very bad thing if you are making a test installation!

If the installation you are moving or copying does not have any images in the "user_images" folder, you can skip this step. Everyone else, you need to follow this step, especially those that are creating a test installation on the same server.

First, make sure you back up your database prior to running this query, in case anything goes wrong. If something does go wrong, restore the backup. Support will not be able to do anything if you have not created a backup and something goes wrong7)

Using PHPMyAdmin, manually run the following SQL query on the new installation's database (adjustments required, as noted below):

UPDATE `geodesic_classifieds_images_urls` SET `file_path`='/new/absolute/server/path/to/user_images/' WHERE `file_path`='/old/absolute/server/path/to/user_images/';

In the query above, you would replace the /new/absolute/server/path/to/user_images/ with the new value for the Server Path to Root of Photos Directory setting, and replace /old/absolute/server/path/to/user_images/ with the previous value set in the same setting for the "old" installation.

If it says 0 rows affected, check to make sure you have set both values correctly.

Step 7 - SEO Addon

If you use the SEO addon to rewrite your URLs to more Search Engine friendly ones you may need to recreate the "rewrite rules" within your .htaccess file to reflect the new location. If you do not use SEO addon you can skip this step.

In your admin, go to Addons > SEO > General Settings and click on Apply All Settings, then Yes. Then copy/paste the generated .htaccess file contents, and paste into your .htaccess file in the new installation location.

Last Step - Cleanup

After you are sure that everything is working in the new location you can remove the files in the old installation location if you are moving installations. If this is a test installation, obviously you keep your old installation files since that goes to your live website.

If you wish to use cache, you can turn the cache on at Site Setup > Cache since it should have been turned it off prior to the move (in step "0" above).

If you elected to turn your site off during the move, don't forget to turn your site back "on"! You can do so at Site Setup > General Settings#Site On/Off Switch.

1)
As in, the installation stays on the same server, but the folder changes.
2)
Installation for development/testing/staging purposes only.
3)
Files do not move to a new location, and database is not moving.
4)
Note that the linked tutorial is actually this tutorial, with only step 3, step 4, step 5, and step 7.
5)
And if you enjoy this sort of thing, much more fun as well!
6)
Just an example! Your files may be somewhere different!
7)
For instance, if you somehow delete a table by accident, support would have no way at all to restore that table with all the data it had. So make sure you backup the database first!
tutorials/server/migration/start.1350083699.txt.gz · Last modified: 2014/09/25 16:55 (external edit)