Create a test server using clone/backup snapshot
I want there to be zero variation between current production and this new test Linode. Linode's clone/backup features seem to make this possible in theory, but I'm stuck in the mud with launching my test server given that all it's configurations are set to my production site. I What I did so far is pretty simple:
1. Restored my production linode volumes/profile to a new linode VPS (same data center)
2. Through GoDaddy I have pointed the test domain name to the Linode VPS address.
I understand I can't just boot my test linode server (different IP address) from the restored volumes of my production server because all the settings match my production site and bad things would happen such as SQL on the test site trying to connect to my production site, etc. Perhaps I should boot in recovery mode and change conf settings through SSH. If so, where/how?
Taking a step back, the only thing that's different here is my IP address… It's kind of like making an exact copy of a guy named 'Bill', and renaming him 'Tom', but everything else about the two is the same. So is there an easy way for this to happen, or is the dream too much of a headache than it's worth. Seems like it would be a pretty awesome thing to accomplish that a lot of people would want to do.
Thoughts? Steps involved? Thanks!
9 Replies
@Ramanonos:
Perhaps I should boot in recovery mode and change conf settings through SSH. If so, where/how?
Yes, that's the way I'd suggest doing it, as it avoids making the new machine live until you've "corrected" any duplication of the production system you need to change. Boot your new Linode into rescue mode (with the Finnix image), log in over Lish (or enable ssh on the rescue system), and then mount any volumes you need to tweak and make your changes. During this time it's the Finnix kernel that is running and not your actual system so you won't have any conflicts with the production system.
Simplest way to do the recovery boot is on the rescue tab in the manager - see also
I usually make the minimum number of changes with this approach (such as IP address, and perhaps to disable any automatically started services I'm not yet ready to enable) and then boot normally and do the rest of the configuration on the actual system.
-- David
One is invasive to the production system; make the places in code that right now contain directly-coded IP addresses, hostnames, and stuff to automatically choose the prod or test settings on some basis (like the public IP address of the server).
Upside to that is that in the future, all you need to do is to clone the disk and boot it as the other Linode, and the code is 100% the same between them; downside is that you need to change the production files, and sometimes it takes one or another trick to make this possible (eg. when a config file doesn't allow for an external include).
I'm using that one.
Other option is to keep a small prepared boot profile in your test Linode, that boots to a tiny distro that automatically mounts the disk, does the necessary changes, and reboots back into it.
This one lets you "not touch" the production at all; however you need to make sure to keep the auto-alteration script up to date.
Both options should allow you to just about completely automate the cloning process in the future, with help of Linode API.
I changed to the new domain name in /etc/sysconfig/network
I changed to the new IP address in var/aegir/config/server_master/apache/vhostd/example.com
I changed to the new IP address in /etc/httpd/conf.d/aegir.conf
Still, nothing… Maybe it's a CentOS thing or an Aegir thing. But I've been at this for two days and can't access the site under a different domain. It's such a basic thing I want to do here, yet I can't get it work for the life of me. Linode support says clone feature was great for what I wanted to do, but once we looked at few things, support admitted being totally stumped. A guide here would be useful. I actually chose Linode service because I thought Clone looked really powerful and useful. It's too bad because the Linode's clone feature would be really awesome if I could actually use it.
Anyways, unless anyone has any clues, I'm going to just build up a test site from scratch.
Thanks again.
Alas, I have nothing else useful to contribute (other than my usual "good luck!" from past experience with CentOS and Aegir, and assurances that it works just fine without CentOS or Aegir.)
@Ramanonos:
Thanks. I suppose with either approach I'd have to first know which files I need to change IP settings. I can't believe how mysterious it really is to change a IP address of a clone… I thought it was as simple as pointing a test domain name at the test linode ip address, adding a couple name servers, and pasting in the new IP address into etc/sysconfig/network-scripts/ifcfg-eth0 . Right? wrong… Ugh i think the first clue was that I didn't have a static IP inside ifcfg-eth) file.. Instead it said BOOTPROTO=dhcp
I changed to the new domain name in /etc/sysconfig/network
I changed to the new IP address in var/aegir/config/server_master/apache/vhostd/example.com
I changed to the new IP address in /etc/httpd/conf.d/aegir.conf
Still, nothing… Maybe it's a CentOS thing or an Aegir thing. But I've been at this for two days and can't access the site under a different domain. It's such a basic thing I want to do here, yet I can't get it work for the life of me. Linode support says clone feature was great for what I wanted to do, but once we looked at few things, support admitted being totally stumped.
You said you can get in via SSH (presumably by IP or hostname?), so let's assume the clone is running and DNS is working. Maybe I'm misreading your post but it sounds like you can't load the web sites on the cloned Linode, which narrows it down to Apache. Are your ServerName or ServerAlias directives set to listen for the correct hostnames? If your original site was
I'm probably misunderstanding what you're trying to do and the problem, but that was what came to mind when you said you couldn't access the sites under a different domain.
You also don't necessarily need to hard-code IP addresses in VirtualHost directives; if your configuration allows it just use VirtualHost *:80 and then you don't have to many so many changes between the production and clone conf files.
To be sure, I ran the command to recursively cahnge any instance of old IP (123.456.789.012) with my new IP address (555.55.555.55)
find ./ -type f -exec sed -i 's/123\.456\.789\.012/555\.55\.555\.55/' {} \;
Not sure if that did anything. But I still can't access
I suppose the only stones I may have left unturned is on what you're suggesting with matching my servername matching requested hostname. I'm not I'm fully understanding what to check here, and/or what to change. Any thoughts?
BTW- I'll be happy to document this whole thing with pretty pics if I get this working. I have to imagine there's a ton of CentOS/Aegir on Linode people out who would love to to do what I'm trying to do.
I have a very old, very outdated CentOS box running cPanel, so this info may not be the same for you, but my virtual host directives are in /etc/httpd/conf/httpd.conf. For each virtual host, you must have a ServerName or ServerAlias directive matching the host name (wildcards are OK) that the browser is sending to Apache with each request.
For example, one of my vhost entries starts like this:
<virtualhost 111.111.111.111:80="">ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /home/me/public_html
ServerAdmin webmaster@mydomain.com
UseCanonicalName Off
...</virtualhost>
That vhost will respond to the URL "mydomain.com" or "
Sounds like you're using a completely different domain name instead of a subdomain, so if your vhost is looking for
If you can get this working, I'd suggest eliminating the IPs from the vhost directives (if you can) and set up wildcard vhost ServerNames like .mydomain.com (obviously don't do something to break any existing subdomain vhosts on your production server though). Then you could just point an A record for "dev.mydomain.com" to the clone IP and leave the existing DNS for the domain intact. Then by the DNS records, the clone Apache will respond to "dev.mydomain.com" and the production server will still respond to "
Hope that helps some.