Moving websites

Discussion in 'General' started by Walker, Aug 17, 2010.

  1. Walker

    Walker New Member

    Currently I'm running a production server with ISPConfig 3.
    The OS is Debian-Lenny, and it's configured as described by Falko in 'The perfect server - Debian Lenny'.

    Now I want to set up a separate web server (as ISPConfig slave) and move the web sites to that server.
    All other services (mail, DNS) will remain on the old server.
    Both servers will have their own public IP address.

    What is the best way to move the web sites with as least downtime as possible?
  2. Toucan

    Toucan New Member

    Set the second server up as per the perfect server guide but use the expert option. Use the same root password as the master.

    You need to allow the two servers to communicate with each other, although I can't remember which way round. You need to do this in the mysql table.
    In phpmyadmin export the root user records and import them to the slave (or maybe the other way around) You need to change the IP addresses to match the other so it can access the tables.

    Take a copy of /var/www and subdirectories.

    Unfortunately I can't think of an easy way to do the next part...

    You'll have to then in the control panel of the master (never the slave) remove the sites and recreate them in the slave.

    Then, using your backup copy of /var/www copy it to the slave.

    You could use a command like scp to copy the files cross servers.

    Remember you'll have to change your DNS records to point to the new server

    Feel free to correct me anyone if you feel this method wouldn't work.
  3. Walker

    Walker New Member

    I don't know if ISPConfig allows to have the same website name on both servers at the same time.

    In that case I think the solution below might work:
    - A few days before the actual move, I set the TTL of the DNS to something like 120.
    - Create the same website on the new server in ISPConfig
    - Use NFS to mount /var/www/<website name>/web on the new server to let's say /mnt on the old server
    - On the new server: chmod 777 /var/www/<website name>/web
    - On the old server as root: cd /var/www/<website name>/web
    - tar cvf /mnt/webcopy.tar .
    - On the new server: cd /var/www/<website name>
    - chmod 710 web
    - cd web
    - tar xvf webcopy.tar
    - change to correct user: find . -user web<old> -print -exec chown web<new> {} \;
    - If the website has dynamic content (Joomla, webshop): Set it to 'in service'.
    - Export the database(s) on the old server and import on the new one.
    - Change the DNS entry to point to the new server.
    - Change the TTL of the DNS back to a normal value.
    - remove the website on the old server in ISPConfig.

    Obviously, above can be done quite fast with a few scripts.

    However, if it is not possible to have the same website on both servers at the same time, the above solution won't work.
    Removing the sites and then recreating them on the new server leads to too much downtime.
  4. Toucan

    Toucan New Member

    No, ispconfig3 will not allow you to have one website on two servers where one is a slave of the other, unless..... One server is set as a mirror of the other, but then when you stop the mirror function you run into more problems.
  5. Walker

    Walker New Member

    Is there a way to get around that?
    For example, by creating a new website in ISPConfig on the new server with a slightly different name. Then, on the new server in /etc/apache/sites-available I change the vhost file (ServerName and ServerAlias) by hand into the correct website. Now I can copy the files to the new server and point the DNS to it. Afterwards, in ISPConfig, I delete the site on the old server, and rename it to the correct one on the new server. ISPconfig will now 'overwrite' the vhost file, but that's fine because it remains the same website, it just makes it consistent again.

    I know it's a bit dirty, but I can't think of a better way to do it.

Share This Page