allopurinol available in india low cost overnight phenergan mentax cream price side effects of atenolol 50 mg order cheap buy bystolic pharmacy sumycin dosage instructions order diclofenac sodium pharmacy amoxicillin powder for oral suspension fastest erexor uk delivery free printable coupons for cymbalta edrugstore md cialis viagra how much will ranbaxy lipitor cost diabetes medication metformin hcl biaxin overnight shipping cheap drug market order tinidazole cialis super active pharmacy online side effects on women taking viagra best place buy betnovate pct snovitra super power bonus pills paxil prescription vantin side effects uk effects of propecia on fetus aspirin non perscription countries no prescription promethazine sale what is lithium batteries made of buy effexor xr xr without prescription piroxicam maximum dosage xenical rxlist how to take flagyl 500 mg acai delivery morumbi nizagara dosage recommended european drugstore chain erythromycin better than amoxicillin benemid generico italiano tenormin mg canadian rx is valtrex an over the counter medicine viagra australia lowest cost ordering female cialis here in canada free or low cost torsemide prevacid 40 mg side effects ampicillin otc ampicillin drug study national shortage of levaquin buy tamoxifen tablets us colospa for sale usa buy motrin astrailia ginette-35 medicine online herpes labialis valtrex dose aspirin usage free coupon for viagra jelly what class of drugs is zocor abdominal pain during ovulation on clomid brand advair diskus lawsuit brand amoxil over the counter prednisone steroids for dogs cheapest phenergan to buy zetia and grapefruit zebeta online in us can you take zyban daily what does benadryl do for allergic reactions motrin order best price yagara can you get promethazine codeine in the uk zoloft roche precio argentina phenergan labor and delivery appreciable where could i buy bactrim without prescription genuine altace discount drugs erythromycin ethylsuccinate for children decadron elixir syrup isoptin cheap propranolol hydrochloride tablets uses generic tinidazole cost where to buy allegra shoes women;s antivert generic for purchase zanaflex on line in india tadacip coupons very cheap zyrtec danazol nhs bactrim ds dosage for cellulitis cymbalta no prescription canada what is quinine used to treat purchasing aspirin online uk cheap generic feldene no prescription original finast online to buy cefadroxil fucidin pills online in the canada skin care products after accutane flagyl er discount cipro lasix drug interactions suprax express canada viagra jelly doctors online wellbutrin sr without script buy nolvadex paypal accepted lopressor generic reviews meclizine reviews donde puedo comprar metformina buy alesse online canada drugstore asacol and canadian pharmacy non generic chloramphenicol quinine tablets uk is effexor xr generic teva geriforte canada head office where to get tadacip pct amaryl generico online does silver slimming tablets work trileptal lawsuit viagra professional rx what is allegra used for my alphagan coupons canadian pharmacy cymbalta where to buy fish antibiotics uk strattera indian pharmacy discount vermox buy over the counter mircette can you buy viagra jelly in ireland pharmacy 50mg where to buy lipothin with raspberry ketone levitra plus drugs buy nitroglycerin 40 purchase flonase spray independent pharmacies america cooperative best price for micronase augmentin prescription dosage full coverage drugstore foundation for acne prone skin mexican pharmacy no prescription viagra super active buy finax 40 buy torsemide cheap what is zestril used for what is suprax antibiotic used for requip xl reviews cheap generic viagra online usa benicar rx buy aleve quick lady era from europe united healthcare mail order prescriptions diovan no prescription fast delivery zoloft cost australia what does decadron look like reviews of cymbalta for fibromyalgia how much is permethrin cream buy accutane online no prescription fast delivery acivir pills for sale philippines how to buy lexapro differin price au tablets uk buy cheap levothyroxine cheap finax no prescription metformin pcos weight loss results buy nizoral tablets usa buy zenegra online without prescription do i need a prescription for penegra express scripts prior authorization adderall buy mestinon bulk zaditor reviews for men holland & barrett - acai capsules - triple strength review buy zestril online pharmacy discount celebrex card billig voltaren online kaufen can you buy viagra usa rxcanadian mall how to take cialis for daily use cheap genuine acivir pills online torsemide from usa order skelaxin in where can i buy actonel in canada revia new zealand prinivil for dogs buy flagyl pills used what does the drug valtrex treat robaxin phone orders order levitra no prescription viagra online fincar no prescription compare prices why has cialis super active been discontinued cialis compra segura depo medrol injection rxlist minomycin over the counter super active baby in utero do i need a prescription for dramamine trandate indian pharmacy 200mg kaiser mail order pharmacy southern california get adalat las vegas acivir pills mg price does bactrim pills look like safe place order isoniazid order aciphex 40 mg xenical meridia and phentermine plavix generic available canada buy generic hydrochlorothiazide sertralina bula medicamento best generic valtrex review used lexus rx330 in ontario canada cheap diet pills work fast where to buy speman tamoxifen for men sale in uk strattera legal status uk what is the difference between zyrtec and allegra how long does it take for decadron to start working tamoxifen bodybuilding women nitrofurantoin medicine children where to buy cheap generic evista worldwide pharmacy aricept how much will nolvadex cost where can i buy aspirin in singapore canada pharmacies no prescription required ordering zovirax ointment diclofenac sodium 75mg sr tablets lopid dose viagra dosages women online pharmacy testosterone enanthate buy plavix paypal order innopran xl tablets hunan china sun pharmaceutical machinery bactroban cream uk kamagra gold on line for sale no script common side effects of paroxetine who makes generic lipitor buy aldactone paypal medrol and alcohol consumption himalaya pilex ointment use imitrex online cheap para que se usa el serophene diclofenac sodium dosage pain lipitor drugstore buying anafranil online can you get high from metoclopramide where to buy plavix online shoppers drug mart canada post jobs how to take topamax and phentermine for weight loss cheap glycomet buy online best site get lamictal venlor overnight shipping cheap generic zyprexa available side effects of vytorin in women clomid 50 mg tablets clomiphene citrate indian generics online lozol valtrex overnight shipping cheap fast motrin deleviery divya pharmacy store india remeron reviews webmd family guy canadian high school elimite generic release date metronidazole 500 mg online no prescription can i make zocor where is imitrex made allintitle viagra 6 free samples can buy diakof online zyprexa india order beconase aq online eldepryl online store etodolac suppliers overseas where to get viagra super active pct cabgolin .25 floxin without prescription canada propecia finasteride side effects navarro discount pharmacy miami fl propecia prescription online prandin lawsuit settlements methylprednisolone aceponate class tretinoin 0,05 sale como conseguir viagra en argentina i take 30 mg of cialis comprar augmentine online where to inject depo provera shot pletal looking for best price for voltaren gel cialis viagra combo discount celebrex coupons order feldene lowest price buy generic glucotrol xl with bonus what does propranolol tinidazole giardia dogs effexor on line in the usa accutane prescription only sildenafil side effects vision torsemide prescription only how to order vasotec online buy viagra blue pill is it illegal to buy rx drugs online finast on line buy voltaren tablets cost of renagel without insurance prevacid recall 2012 levlen uk boots switching from zoloft to wellbutrin dizziness zestoretic free shipping prescription solutions pharmacy phone number viagara falls little shubert mobic generic release date pill rx health order zithromax products mobic 15 mg tablets side effects donde comprar propecia en espan~a methotrexate api manufacturer in india accutane cystic acne reviews v-gel drug class brafix prescription coupon vermox from india zyvox medication side effects grifulvin v mg tablet generic from danazol brafix online uk can you buy acivir pills mg order cipro xr online lowest price prilosec boots pharmacy manchester piccadilly seroflo online forum comprar adoair birth control pills yagara diclofenac sodium tablets bp 25mg elimite women buy fucidin tablets leo crestor dosage vs lipitor xalatan eye drops wiki oregon state parks pass is ventolin available over the counter nitrofurantoin coupons prednisone 5mg dose pack dosing join costco online uk uses aspirin pharmacy erythromycin stearate alcohol estrace discount medications adalat nifedipine cipro no prescription overnight half price elimite does viagra work on girls online order ampicillin prescription my cialis professional coupons does boots sell viagra over the counter drugstore levitra plus coupons alli reviews yahoo answers purchase strattera 18 mg tinidazole weight gain med cab kamagra chewable buy uk prescription diamox online levitra annual sales 2010 buying rumalaya gel in manchester buy glucotrol xl canadian trazodone tablet is actonel a generic drug where do i suhagra in canada how to make 100 mg ml ampicillin does accutane acne medication work methotrexate prescription help benadryl online forum pharm best site get isoniazid diclofenaco cinfa side effects benadryl medicine children trazodone from mylan ndc buy lamictal online no prescription us all types cipro pills where can i get some trazodone what is the pill topamax used for betapace shortage 2012 ic valacyclovir hcl 1 side effects etodolac 100 cheap trileptal zoloft reviews weight gain propecia price increase half price cialis jelly natural viagra substitutes for women salep elocon untuk biang keringat valtrex from usa viagra pfizer 100mg buy premarin paypal cialis jelly daily use reviews where do i buy dilantin purchase capoten best generic zebeta sites generic minocycline acne trental online with out prescription what is metoprolol buy reglan online overnight obat voltaren untuk apa better than differin asacol sales 2008 where to buy lynoral cheapest place to buy cefixime generic for micardis elimite buy uk hyaluronic acid tablets in india buy phentermine tablets clonidine hydrochloride overdose generic viagra uk canadian pharmacy tinidazole online canadian l;albenza golf club simvastatin zocor spc buy alphagan us drugs approved pilex to purchase without a prescription can you buy mentat online buy alligator clips online hair therapeutic effects of thalidomide enantiomers buy amaryl pills in the uk cheap viagra sale uk metronidazole without prescription recommended dose of valtrex for cold sores all types norvasc pills stromectol delivery london order bactrim online uk how much is suhagra tablets cost of prilosec generic canada drugs topamax with prescription antivert online overnight shipping trimox order long time side effects mycelex-g clomid buy on line zoloft price cvs online no prescription purchase abilify canadian celebrex low cost zithromax comprar lynoral original en madrid tadacip 20 wiki desyrel 100 antibiotics online sales buy viagra plus singapore menosan phone orders keflex dosage for dogs non prescription hyzaar pharmacy 18 gbp to eur clomiphene for men and women order minocin canada generic inderal switzerland digoxin medline india cost of imitrex at walgreens comprar synthroid portugal late ovulation on clomid 150mg skelaxin online no prescription januvia medication where can i buy hyaluronic acid should i increase my citalopram dose diamox reviews long time side effects bactrim best online pharmacy generic isoniazid where to buy aldactone online canada my pravachol coupons generic decadron in usa where to buy unisom sleeptabs canadian buy capoten online us no prescription how to buy toradol in london combivent for discount buy estrace online cheap can i use makeup while on accutane generic capoten for sale on line billig ethionamide online kaufen aciclovir comprimidos 400 mg dosis licensed pharmacy celebrex what is the generic form of flomax nolvadex from ip silagra 100 online from canada evecare online legally exelon sublingual dosage trazodone weight gain reviews buy online mentat himalaya soft sale viagra online generic compazine drugstore buy celadrin cheap voveran delivery london premarin 5mg tablets minocycline supplier in uk healthy hawaiian mango bread recipes cost of citalopram walgreens about cipla pharma company propranolol and diet pills evecare spain over counter generic yasmin birth control side effects moduretic direct pharmacy order generic tegretol atorvastatin dose range buy metformin online pharmacy altace side effects long term use back clinics of canada reviews over counter male performance enhancement side effects of avapro 300 is it illegal to buy pain meds online generic brand cardura atorlip-10 shop net online pharmacy precose indian albendazole cost of plavix for cats luvox without a perscription buy drugs without prescriptions in canada kytril no prescription compare prices arava drug manufacturer metformin from europe rich rhine inc buy neurontin pills in the uk buy pilex in singapore vigra tablet for woman pulmicort without a prescription buying tadapox in manchester femcare without prescription pharmacy has best price finast viagra super active for purchase claritin ingredients children dapoxetine cheap price generic myambutol canada cost comparison viagra vs cialis canadian healthcare online drugstore reviews viagra cialis levitra cost comparison pharmaceutical wholesalers distributors diabecon online in usa generic maxalt for sale on line diclofenac free shipping finasteride over the counter uk buy dilantin online without prescription buy zyloprim 200 buy cialis jelly inhaler canada age buy diet pills canada ordering viagra sublingual on line nolvadex mg price canadian nitrofurantoin tablet how to buy tricor adalat oros dosage xeloda refills acticin drugs difference between 5mg 1mg finasteride valaciclovir prescription zoster canadian-pharmacy-rebill buy voveran capsules zovirax mg buy donde comprar alli online vendita viagra generico premarin discount pharmacy uk buy amoxil online nhs scotland repeat prescriptions online buy aciclovir 80 mg online micardis to buy from europe generic lexapro sale actoplus met online store what does depakote sprinkles look like proventil where to get buy valtrex online no prescription trusted tadalis sx generic 2013 drugs inderal online sales how can i make clomid more effective requip where can i buy what kind of medicine is keflex xalatan without insurance buy famvir without a script brafix suppositories buy what are some over the counter pills to help get pregnant amaryl women buy silagra no rx buy lidocaine uk arimidex pct only cephalexin lawsuit canada do hoodia tablets work cialis jelly overnight pharmacy amoxicillin capsules 500mg price fertility drugs nhs arthrotec 75 coupon artane medical centre manchester acheter cardura what does a meclizine pill look like hyzaar plus missed mircette pills side effects of long term lithium therapy forum baclofene aubes how to take bupropion tablets cialis prescription missoula mt order dostinex online with visa is metformin available in australia what is the best website to buy viagra sinemet without prescription canada tetracycline in the uk where to buy suhagra with amex cheapest brand levitra to buy red ginseng cost tesco malarone cost buy generic procardia with bonus is there an alligator hunting season in florida tetracycline side effects dogs buy abilify pills in the mexico zovirax without prescription canada trental with paypal payment will nexium go over counter big blue pill 44 532 canadian pharmacy spam yahoo blopress canada companies only minoxidil results pictures women order accutane online prescription isotretinoin revista visao junior buy atacand boots pharmacy cheap gasex uk generic for calan sr post cycle therapy avapro purchase finasteride propecia buy flagyl er from india retin-a 0,05 pas cher trental on line purchase where to buy alli online cheap how much skelaxin does it take to overdose cheapest indocin in the uk fast urispas deleviery erythromycin medication drug what does celebrex do best drugstore liquid foundation for acne prone skin viagra dosage 200mg zithromax side effects rxlist most common side effects of levlen seroquel xr australia lipitor from cholesterol pfizer cost of methotrexate & misoprostol mtx medicines prescription drugs buy actavis promethazine online omeprazole over the counter uk risperdal pills canada order compazine abortion pills cytotec misoprostol side effects of viagra on men with high blood pressure stromectol in usa elimite cream over the counter can i buy trimox in canada longs drugs online shopping viagra generic name mycoxafloppin colchicine discount arthritis gout combivent udv side effects acute gout flare allopurinol best price for acivir pills where kamagra urispas mg buy cheap genuine trileptal online la pastilla redustat sirve what is drugstore makeup ginseng pills gnc clonidine without prescriptions allopurinol before chemotherapy olanzapine overdose emedicine zebeta australia price cheapest cleocin gel to buy prozac nation quotes viagra otc germany mail order generic cephalexin buy cleocin t lotion cholestoplex usa sale buy sildenafil 100 mg cost of viagra in ireland cheapest levothroid in the uk cheapest geriforte syrup buy brand levitra tablets canada proventil online pay paypal innopran xl medicine online top 10 online lopid sites india capoten price nhs viagra prescriptions how to buy clomid on the internet liquid liv 52 review actonel prices walmart what is betnovate 1/2 cream acheter viagra plus pas cher is there a generic form of allegra d venlor pill shop discount code is it safe to buy viagra online approved very cheap sumycin cialis jelly best price fluoxetine where to buy in canada acheter danazol pas cher
Home Blog

Migrating websites from dedicated cpanel servers to Rackspace Cloud

General

Written by WinWorld Wednesday, 21 March 2012 19:56

Background

As many in the web design industry would know, if you're in the web design or development business, you're also defacto in the hosting/domain business. Some web companies choose to pass that role back on the client, advising them where to buy hosting. Other web design agencies will get a reseller account with a control panel host (e.g. Plesk or cPanel) such as Hostgator or Bluehost. That was our story many years ago - we got a reseller account at a cpanel host. What we ran into with that was a lack of control. We weren't able to install the php packages to suit our needs and had to dance around server config such as upload limits. One day we had a huge fiasco with a shared ip address that was directly linked into a newsletter mailing and we couldn't get the ip address back. That stress was enough for us and shared cpanel hosting.

So we moved to dedicated hosting. That brought a whole other set of challenges. We had to learn all about full administration of a linux server. For a while we continued to use cpanel but eventually even got frustrated with cpanel's limitations and just went to manual configuration. When we surveyed clients we found that the majority of our clients didn't even use the control panel and even found it a hassle. So in order to make changes to hosting config, clients would just submit tickets and we'd take care of it. We did find a very small percentage though that did still want a control panel so we always had bringing that back somehow in the back of our minds.

Another issue with dedicated hosting (where you rent a full box at a data center) is having a single point of failure. We had single disk servers to start with and then felt it would be better to move to raid systems. We had raid systems with Layered Tech and that was a nightmare. They seemed to just continuously reuse old hard drives. We had a major windows server crash three times in six months. That was enough for us there. We also had dedicated servers with Server Beach. Their support was better but unfortunately we had more hardware failures on raid5 that we did on single disk servers.

The hardware was the main aspect that prompted us to investigate cloud hosting. In the cloud sites serving load is spread across hundreds of servers. If one goes down it can easily be replaced without downtime. With dedicated servers we had to know and depend on our backup mechanisms as our life depended on it. If a server went down it certainly meant 48 hours doing a complete reload of all files and sites on the server. So being able to rest a bit more peacefully in regards to downtime was alluring to us.

Cloud hosting would also reintroduce a limited control panel for those clients who wanted one but would still give us the ability to manage advanced settings at a higher level. Even though we had staff in house that knew how to admin linux servers, having a control panel also meant that folks in admin could setup accounts or delete accounts if needed.

How to migrate from linux/cpanel to rackspace

This isn't meant to be a definitive guide on how to move websites to rackspace cloudsites but it is a compilation of suggestions we accumulated along the way. This guide is also a bit high-level / not detailed. You need a base of knowledge to do this. If you can't make these suggestions work then you may want to hire a more experienced technician to do this for you.

To us it seemed that there would be phased migration.

  • Step One: Migrate all DNS to zones to Rackspace AS THEY ARE. This means that you can repoint your hosting company's name servers to Rackspace's nameserver IPs and then all your clients DNS will also be performed from Rackspace BUT this is before you've moved ANY of the sites over. The DNS will actually point all of the domains BACK to your current main cpanel/dedicated servers.
  • Step Two: After migrate all the actual site files and databases.
  • Step Three: Switch the A record IP address for each website over from your old dedicated server IP to the Rackspace IP, essentially taking the site live.

If you manage DNS through a third party like your domain registrar then you can probably skip the whole DNS phase.

Migrating DNS

If you have a bare dedicated server or a cpanel dedicated server, chances are you have one of your dedicated servers also serving as your primary name server. If you're running cpanel, you're probably using bind (even if you don't know it) or if you don't have cpanel then you know you're running bind (because you have to manually edit named.conf to add domains).

So why do the DNS first? We use ns1/2.ourhostingcompany.com as our name servers. We have hundreds of domains registered. We've registered most of them but 10-20% are registered by the clients themselves. They all are pointed at ns1/2.ourhostingcompany.com though. We control that domain and we get to set the IP addresses of the name servers for ns1/2.ourhostingcompany.com. With moving to rackspace we could spend countless hours going and updating all the domains to point to ns1/2.stabletransit.com or we could just leave them and reroute the traffic to rackspace's nameservers.

We actually wanted to migrate all websites files and databases themselves first and then the DNS. The first way we tried this essentially failed. We went into our named.conf and made our nameserver an open forwarder. We set forward {any;}. The plan was to move the site files and database and make sure the website was working at Rackspace, then after we'd confirmed that each site had successfully migrated to Rackspace just go in their zone file on our name server and say "forward all DNS requests for this domain to Rackspace." This failed because when we did that rackspace's name servers thought they were authoritative yet our name servers were still thinking they were authoritative so there was confusion.

The next step seemed to be to ensure all our domain zones were replicated at rackspace and then completely repoint ns1/2.ourhostingcompany.com to rackspace's nameserver's IP addresses. And THEN we'd move the sites.

Getting ready

This was a huge task. Again we have 100s of accounts. The first thing we had to do was get someone to manually set up a client in Rackspace for each client we had. Rackspace, if you're reading this, please create an API that lets you programmatically add clients and websites to rackspace cloudsites. It would have sped things up for us massively. Having our admin staff do this in their spare time probably took 2-3 weeks. They would create the client, then create the website under the client, and then they would create the database, the username for the database, the database password and even take note of the ip address and hostname for the database. Most of our site's have databases so we needed to do this.

There's a control panel in Rackspace for all of this and it doesn't need much explaining. Once all that groundwork was laid we had to figure out how to transfer all the custom records in our DNS server to Rackspace's nameserver.

For example, some of our client have their MX records set to Google apps mail, some use paid 3rd party mail services. Some clients have custom cnames, etc. We didn't want human beings to have to sit there and manually copy and paste 1000s of domain record entries from our nameserver over to Rackspace's control panel (its slow if you're doing this type of repetitive task). Luckily Rackspace DOES have a DNS API. It's not hugely documented.

The actual code to migrate DNS from bind to rackspace via the api

The coolgeex one provides the rackDNS.php class and also a sample.php to show how to interact with the API. Using the sample.php we wrote our own script to do what we wanted. The coolgeex one didn't work immediately for us. We found there was some issue with curl and https. We had to set a curl parameter to ignore https problems and then it worked fine.

The idea was to essentially go through each domain, delete the default zone created by Rackspace and replace it with our zonefile. Of course if you run bind, all your zonefiles are located in /var/named or /var/named/chroot/var/named. The problem is that Rackspace only accepts FQDN format zone files as input so if some of your zone files are relative, it won't work. E.g., bind will let you point multiple domains at one zone file and just say

A xx.xx.xx.xx
sub CNAME whatever.domain.com ;subdomain

But Rackspace needs absolute zone files like this:

Domain.com A xx.xx.xx.xx
sub.domain.com CNAME whatever.domain.com

If you have a mixture of relative zone files there is a way to get bind to spit all the zone files back out as absolute zones. Here's a link on how to do that: http://ubuntuforums.org/showthread.php?t=903651

Basically it creates all your nameserver's domain zones in one file. You can then use PHP to loop through those zones and work with the Rackspace DNS API.

The second issue we had was account IDs. If you create a subclient in RS and then a domain under that client, if you connect to the DNS API and then say "show me all the domains" it will only show ones in YOUR account, not sub-client domains. In order to see sub-client domains, you have to connect to the api using the sub-client's ID number. There's more info on this topic at the donetexec link above. So consequently, what we needed was another file that mapped all our domains to client id's at rackspace.

Once we had these two pieces we could have a php script

  1. Read in all the domains from the bind dump and start looping through them
  2. For each domain connect to the dns api using the client's id
    1. Wipe what RS had there by default
    2. Load our zone file

I've provided the code that we ran with the coolgeex rackDNS.php.

<?php
/**
*
* Rackspace DNS PHP API sample.php
* @author Alon Ben David
* @copyright CoolGeex.com
*/
require_once "rackDNS.php";
//credentials
$rs_user = 'YOURRSUSERNAME';
$rs_api_key = 'YOURRSAPIKEY';
 
//first load all the codes we have for domains
$codes = array();
include('codes.php');
include('domain-dump.php');
 
//now lets load the zones into an array
$temp = explode(";", $tempstring);
unset($tempstring);
$zones=array();
 
//now lets rework the array with the key as domains
foreach($temp AS $zone)
{
//get the domain name from the first bit
$domain = substr($zone,0,strpos($zone," "));
$domain = str_replace(array(" ","\t","\n","\r"),"",$domain);
$domain = substr($domain,0,-1);
$zones[$domain]=$zone;
}
unset($temp);
$domainsdone = array();
$domainsmissingcode = array();
$domainserror = array();
if ( isset( $_COOKIE["domainsdone"] ) ) { $domainsdone = explode("|",$_COOKIE["domainsdone"]); }
if ( isset( $_COOKIE["domainsmissingcode"] ) ) { $domainsmissingcode = explode("|",$_COOKIE["domainsmissingcode"]); }
if ( isset( $_COOKIE["domainserror"] ) ) { $domainserror = explode("|",$_COOKIE["domainserror"]); }
 
//now lets loop through the zones and see which domains we have codes for.
//if we have a code, clear all records in that zone and load the zone file we have
$count = 0;
foreach($zones AS $domain => $zone)
{
if( $codes[$domain]!="" AND !in_array($domain,$domainsdone) AND !in_array($domain,$domainserror) )
{
//we've got the code, now lets do this.
$count++;
//establish connection
$dns = new rackDNS($rs_user,$rs_api_key,'US',$codes[$domain]); //($user, $key, $endpoint = 'US') $endpoint can be UK or US
//echo "Working with ".$domain." which has a code of ".$codes[$domain]."\n\r";
//get the domain for this code
$tempdomains = $dns->list_domains(50,0);
$domainslist = $tempdomains['domains'];
//print_r($tempdomains);
//unset($tempdomains);
//loop through the domains for this account and ensure we grab the right info for the right domain
foreach($domainslist AS $theirdomain)
{
if (strtolower($theirdomain['name']) == strtolower($domain))
{
$domainID = $theirdomain['id'];
$domainName = $theirdomain['name'];
}
}
//if (!$domainID) die("domain missmatch for ".$domain." and code ".$codes[$domain].". Halting.");
//should probalby check if $domain and $domainName matches
//if so we just delete it
if( strtolower($domain) == strtolower($domainName) ) $delete = $dns->delete_domains($domainID);
//wait a bit because deleting takes a while
sleep(3);
//now lets import it according to our zone
$import = $dns->domain_import($zone);
sleep(3);
if($import['status']=='COMPLETED' OR $import['status']=='RUNNING') {$domainsdone[] = $domain; }
else {
$domainserror[]=$domain;
if(!isset($_GET['dontshowerror']))
{
echo "<pre>Working with ".$domain." whose client has a code of ".$codes[$domain]."
and whose ID is ".$domainID."\n\r";
echo "All of their domains are:\n\r";
print_r($tempdomains);
echo "This is the result of the delete:\n\r";
print_r($delete);
echo "This is the result of the import:\n\r";
print_r($import);
die;
}
}
if ($count >=500) break;
} elseif (!in_array($domain,$domainsmissingcode) AND !in_array($domain,$domainsdone) AND !in_array($domain,$domainserror) ) {
$domainsmissingcode[] = $domain;
}
}
setcookie("domainsdone", implode("|",$domainsdone), time()+86400);
setcookie("domainsmissingcode",implode("|",$domainsmissingcode), time()+86400);
setcookie("domainserror",implode("|",$domainserror), time()+86400);
echo '<html><head><meta http-equiv="refresh" content="30"></head><body>';
echo "<pre>";
print_r($import);
echo "Domains that are done:\n";
print_r($domainsdone);
echo "\n";
echo "No codes for these domains:\n";
print_r($domainsmissingcode);
echo "Error occured when importing zones for these domains:\n";
print_r($domainserror);
?>

Note that you will have to modify to suit you. I'm not going to provide a copy of our domain dump from bind because that is a very standard format of file, but I will show a sample of how we loaded the "codes" (or client id numbers corresponding to each domain).

<?php
$codes["domain1.com"] =123123;
$codes["domain2.com"] =123124;
?>

We wrote the script to be executed by browser but it could be executed by cron. We wrote it to process X domains per run and then stop. We also wrote it to meta-refresh to keep running until all the domains had been processed. We decided to store the domains that had been processed in a cookie. We just didn't want to mess around with writing files to the server or setting up a database just for this one function.

One thing to note here. RS still gave errors on trying to import some of our domains even though they were in absolute format. What we found was that TTL times below 300 seconds would be rejected. So where we'd set TTLs on our server very low, those domain imports failed until we manually updated the domain dump file with higher TTLs. RS DNS imports failed for other reasons too. We modified the rackDNS.php file to show more detailed error results back from the RS DNS API to help diagnose this. It doesn't do it by default. See "show detail" in the RS DNS API documentation for more info.

Now that DNS had been migrated, essentially what we had was a complete mirror of our DNS server at Rackspace. All the domains pointed back to our current hosting server, not to rackspace itself. We then logged into our registrar, went under "register nameserver" and updated the IP addresses of our nameserver to those IPs of Rackspace's nameservers instead of ours. Everything kept running without a hitch.

Step two: move the files, databases and update config files

This part should be a little easier for most folks who have done a bit of hosting reselling to understand. The simple process is to use FTP to upload sites, use MySQL to upload databases and then update config files so sites at RS connect to RS's mysql servers.

We also chose to script this into one step. If you run cpanel there is some consistency in the way your accounts are setup, even if you don't, you have some consistency.

This is the basic perl script we used:

#!/bin/bash
#push an account to rackspace, files, database, etc. 
#NOTE THAT YOU have to update your server paths correspondingly
if [ -z "${11}" ]; then
echo 'Please supply arcuments after the script name in the following order'
echo '$1 = name of the home folder locally'
echo '$2 = username at rackspace'
echo '$3 = password at rackspace'
echo '$4 = the domain name' 
echo '$5 = the local database'
echo '$6 = the remote database hostIP'
echo '$7 = the remote database username'
echo '$8 = the remote database password' 
echo '$9 = the remote database name'
echo '$10 = the user number at rackspace'
echo '$11 = the remote database hostNAME'
exit
fi
#dump the database 
mysqldump -uroot -pYOURMYSQLROOTPASS $5 > /home/$1/$5.sql
#upload the database
mysql -h$6 -u$7 -p$8 $9 < /home/$1/$5.sql
#compress everything
cd /home/$1/public_html/
tar cvf /home/$1/thesite.tar *
#upload it
ncftpput -u $2 -p $3 ftp2.ftptoyoursite.com /$4/web/content /home/$1/thesite.tar
#we need to make sure a 'decompress' php file makes it up
ncftpput -u $2 -p $3 ftp2.ftptoyoursite.com /$4/web/content /home/PATHTOWHEREYOURESTORINGTHISFILE/unpack.php
#now run it so the site is decompressed (this also removes the tar and index.html file)
wget <a href="http://$4.php5-22.dfw1-1.websitetestlink.com/unpack.php">http://$4.php5-22.dfw1-1.websitetestlink.com/unpack.php</a>

 

You need to install ncftpput on your server for this to work. Try yum install ncftpput or google.

The script needs you to supply all the details as command line parameters. So what we did was we had a spreadsheet of all the websites along with columns for things like ftp username, password, database name, mysql hostname, etc.

At first we just did an ncftpput -r, which would recursively upload all the files one by one. We then found this not to be working too well for speed so we moved to uploading a TAR file. We got a little creative and wrote a php file that we could also upload to the hosting space at rackspace and then trigger it remotely from the script using wget. The script would basically unpack the tar at rackspace.

 

<?php
exec("rm index.html",$out,$retval);
exec("tar --keep-old-files -xvf thesite.tar",$out1,$retval1);
exec("rm thesite.tar",$out2,$retval2);
?>

 

If the site is large the tar fails to fully unpack within the 30 second timeout that rackspace allows. No worries though. Just --keep-old-files parameter. Wget will keep hitting the unpack.php and each time the untar happens, it will get further, finally unpacking all the files. Some large sites took 11-12 tries to fully unpack but they did work.

Also note in the script where it says "wget…" You'll have to edit that line to what ever websitetestlink.com address RS is generating for you. You could make the whole domain a command line parameter.

As I noted in the subheading above, the third part of this phase is to update all the config files. It's likely you're running a lot of wordpress, maybe some joomla, magento, drupal, etc. We got creative and actually included the edits for the config files in the script that was migrating.

Here's some sample code that edits a Joomla configuration.php (caution, your mileage may vary):

 

cp /home/$1/public_html/configuration.php /home/$1/public_html/tmp/configuration.php
#edit configuration.php
sed -i "/\$log_path/s/'.*'/'\/mnt\/stor3-wc1-dfw1\/MASTERRSACCOUNTID\/${10}\/$4\/web\/content\/logs'/" /home/$1/public_html/tmp/configuration.php
sed -i "/\$tmp_path/s/'.*'/'\/mnt\/stor3-wc1-dfw1\/MASTERRSACCOUNTID\/${10}\/$4\/web\/content\/tmp'/" /home/$1/public_html/tmp/configuration.php
sed -i "/\$host/s/'.*'/'${11}'/" /home/$1/public_html/tmp/configuration.php
sed -i "/\$user/s/'.*'/'$7'/" /home/$1/public_html/tmp/configuration.php
sed -i "/\$password/s/'.*'/'$8'/" /home/$1/public_html/tmp/configuration.php
sed -i "/\$db /s/'.*'/'$9'/" /home/$1/public_html/tmp/configuration.php
#upload config files because we customized those and need to overwrite remote old with new
ncftpput -u $2 -p $3 ftp2.ftptoyoursite.com /$4/web/content /home/$1/public_html/tmp/configuration.php

 

We're using sed to edit the config file on the fly and then upload the version that correctly configured for RS to RS. Note that we put this at the end of the script after all the other stuff is done. There's probably a more graceful way to do the sed but we did what we could. This approach could be adapted for any type of config for "insert your open source script here."

Testing

The last thing to do after all this was to simply test the sites work. Just visit the websitetestlink in your browser. The thing about this whole process is that you'll hit various snags along the way. For example with the DNS migration various zones got stuck and we had to fix them. Then with transferring files, sometimes the write permissions on the configuration.php would be wrong and we'd have to fix that. It's just troubleshooting at that point.

A special note on SSL. Some sites of course will require SSL. There's no need to generate a new CSR from rackspace and get a new cert. Just simply copy the certificate files from the old server. You'll have to do a bit of research to find out where they are. First you'll have to find your httpd.conf. On a cpanel server it may be difficult to know where that actually is. It's been a while since I've worked with cpanel so I can't recall exactly. A common place is /etc/httpd/conf/httpd.conf. Once you're in that file check to see if the virtual host entry for the domain is in there. Or else check at the bottom of the file for the include statement. Its generally going to include a block of files like /etc/httpd/conf/vhosts/*.conf. Once you find where the actual vhost file is you can look at that. Look for an entry for "SSLCertificateKeyFile". Note the location of that file. Go and open the file and copy and paste the key over to Rackspace. Then also copy and paste the "SSLCertificateFile" over. Note that when you save the SSL at rackspace, based on the methodology described in this guide, it WILL take the site live immediately - because it's updating the A record for the domain.

Beware of HTACCESS. If you're site such as Joomla or Magento is using SEF urls with htaccess rewrite - you MUST set the RewriteBase in htaccess. If you don't the site will not show. You also may find it extremely valuable to add the following values to the end of the htaccess file. It will enable your clients to upload larger files via their admins. 

php_value upload_max_filesize 50M
php_value post_max_size 50M
php_value max_execution_time 200
php_value max_input_time 200

We actually automated this too by tagging this code to the very end of our migration scripts: 

 

sed -i "s/# RewriteBase/RewriteBase/g" /home/$1/public_html/.htaccess
echo "
php_value upload_max_filesize 50M
php_value post_max_size 50M
php_value max_execution_time 200
php_value max_input_time 200" >> /home/$1/public_html/.htaccess
ncftpput -u $2 -p $3 ftp2.ftptoyoursite.com /$4/web/content /home/$1/public_html/.htaccess

 

Beware of include paths! If you have code in your old sites that have something like "include('/home/whatever/blah/file.php')" that will fail. Not only that, it will disable php error reporting so the error is not shown to you. I'm not sure why error reporting is disabled for this type of error but I'm thinking that it's a security thing? Maybe they don't want people to be able to probe server root paths and publicly show what paths exist or not. If you have a blank site - check the includes.

Switchover

So once the site is working its time to switch it over. Because we created placeholders for all the sites using the RS control panel to start with, then we moved all the current DNS zones over to RS via the API, then we repointed the hostingcompany's dns servers to RS's Nameserver's IP addresses - RS's Nameservers are still pointing back to the old hosting servers. The only thing to do is to go into RS's control panel, into the client's website and update the A record back to the default it would have been set at before we overwrote them with the custom zone entries (that, again, point back to the old dedicated servers). So HOW do we know what the IP is at RS???

Do a dig on the "websitetestlink.com" url supplied in the General tab of the website settings. If you dig that, it will give you the correct A record. If you also have an FTP cname for the domain, you may want to point that to ftp2.ftptoyoursite.com

Don't forget parked domains! When you migrate the sites, don't forget to also migrate the alias/addon domains. Putting an alias domain on a website at rackspace is a bit weird. See if you can figure out how to do it, but if not, chat support and they'll tell you. I'm not writing in here how it's done because I just want to make a point that I think this part of the process is a bit funky at RS.

If you migrated your aliased domains to RS before migrating the sites, RS will not let you reset their A records via the API. To repoint the alias domains over to RS, you have to use the "donotexec" toolkit above. Its easy to forget aliased domains but clients will call up at some point asking where their other domains aren't working.

If you refrained from actually going to theclientsdomain.com in your browser, you can actually go to it now and it SHOULD direct you to the client's site at RS so you can further test. The reason for this is that if you haven't directly hit the client's domain recently, then you don't have their IP cached locally and your computer/router is going to go grab the fresh IP. If you're not sure then open up /etc/system32/drivers/etc/hosts file and "hardcode" the new RS IP in for the clients domain and visit it. Your computer will definitely be showing the client's site at RS so you can test it. If you're really unsure, make a change to the site via FTP or websitetestlink.com and see if you can see the change.

The last thing you want is to do a switchover but then get a call from the client that their site is in actual fact, down.

Conclusion

I hope some have found this guide helpful. I wrote it because migrating from a dedicated server to a cloud environment can be a real bear. What makes it difficult is the control panels and lack of api to speed up the process. You have to do so much work manually. If it were migrating from one dedicated server to another, it would just be a matter of copying all the files and doing general config. If this helped you please feel free to comment below.

   

Using Eggdrop App as a virtual yard sale

General

Written by WinWorld Tuesday, 20 September 2011 14:17

eggdropI've sold my stuff on a number of yard sales throughout my life as I'm sure many have. One thing I never liked was all the effort involved. It don't like how you have to pick everything up and take it outside and potentially tag it. Then if it doesn't sell, you bring it back inside or take it to the thrift shop or dump. Or worse yet, if it rains you run around like crazy with tarps, etc. All this to make a couple hundred bucks (depending on what you're selling).

If you don't want to have a yard sale, there's always eBay. To me, eBay only seems to be for certain things. If you have something unique, valuable and shippable, then eBay is the way to go. A custom guitar for example. If it's a keyboard and mouse combo for $2.50 then eBay is not the way to go since there are 1000s of other sellers and you won't sell your item. The alternative is craigslist. You get to deal locally. To their credit, craigslist has kept things simple. You put in a title, price, description, place and pictures. To me this still seems a little harder than it needs to be. You've got to verify who you are and there are all these rules for posting stuff. A drawback of craigslist is that it seems you only have network marketers and dating services on there any more. They have not evolved.

Here's what I want...

I want a mobile app where all I have to do is take a picture of what I'm selling. That is litterally it. One step. If I want to title and price it, fine, its easy enough to do that quickly. Mobile phones have camera's built in so it just seems like the most logical decision to use them to make it easier to sell stuff. Recently the app "Eggdrop" came out. It seems to be pretty close to what I want. This article is a review of the app plus some things that I did to extend it's functionality into what I wanted.

   

Creating branching logic in multi-page RS Form Pro

Joomla

Written by WinWorld Friday, 26 August 2011 15:35

RS Forms is a great component. Its got all the hooks in the admin to be able to add any kind of advanced dynamic functionality that you want. A recent version of RS Form introduced the concept of 'pagination' or - breaking your form onto seperate pages. This can be a handy feature if you feel that your form is too ominous in it's entireity.

What we wanted to do however was build special logic into the sequencing of the pages. So based on how the user answers a question in RS Form, we direct them to the next question we want them to see. In the form builder world, this is sometimes refered to as branching logic. Understandably, the makers of RS Forms have not added this feature because it's possibly hard to administer. However by adding some jquery to the form, we can add the functionality we need.

Here's how you do it...

   

Processing Credit Card Payments with RS Form Pro

Joomla

Written by WinWorld Friday, 26 August 2011 14:20

RS Forms is a great component. It lets you build forms on your website by adding the fields you want. There are a number of default layouts for the form but what I like is that you can do your own layout for the form by moving {tags} around in HTML and putting the fields where you want them. you can also add attributes to fields for JavaScript actions and CSS styling. This is the first of two new tutorials I'm doing for RS Form. I have done  previous tutorials that you can find here. .

How to setup RS Forms Pro for Authorize.net payments

1. SSL in place

The first thing you have to do is get yourself an SSL certificate and make sure that is configured. Then you have to make sure that when you send people to the form, that the link is HTTPS. It is possible to PHP code in the form to sense this and automatically redirect but we have not bothered with this.

   

How to compare us to other web firms: what's not included

General

Written by WinWorld Tuesday, 16 August 2011 14:22

focusWhen shopping for a new web provider, it can be difficult to compare apples to apples. There are so many variables. One of the main points of comparison is price. With web development however there could be so many things included or not included.

Take house building for example, will the builder also landscape your yard? Will they also furnish and decorate the new house?

With websites, there are services that some firms throw into the package deal that we feel should be priced seperately (analogous to the house example in landscapers and interior decorators).

   

Page 1 of 9

Web Content Management System Web Development Technical Partners

Newsletter Signup

Signup for WinWorld's monthly newsletter
and special offers.

ARCHIVE >>
Our Web Design page on Facebook
  
Our Twitter Feed