OpenACS Articles‎ > ‎

Moving Servers

Background

First of all, let me describe my situation:

I have two OpenACS servers, each serving a different site. I'm going to move site A to site B's hardware, so that both of them will run off of the same hardware.

The name of the database will be called siteA.

This all took me less than an hour, including writing up this documentation. However, I leave off with the documentation before the whole job is done :-)

Steps

  1. Make a dump of the database from site A.
    pg_dump -f db_backup_030729.dmp siteA
    
  2. Any information that changes on the web site after the database backup will be lost in the transition. I was worried about new registrations after that date, so I looked at the admin page for users to see who had been registered recently. If there were any additions after the transition, I would add them back in manually. You could also take down the site during the transition.
  3. I have siteA on CVS, and siteB on CVS too. However, both of them are using CVS repositories on their own server. So I want to move one repository to the other location. Fortunately, they have different names (siteA and siteB in the /var/cvs directory). The CVS guide to moving repositories claims that it is a simple matter to move your repository from one server to another. We'll see.
  4. As root, tar up the repository for siteA.
    cd /cvsroot
    tar -cf siteA.tar siteA
    gzip siteA.tar
    
  5. Transfer cvs repository to site B:
    Log in to site B, as a normal user
    sftp root@siteA.com
    sftp> cd /cvsroot
    sftp> get siteA.tar.gz
    sftp> cd /web/siteA/database-backup
    sftp> get db_backup_030729.dmp
    sftp> exit
    su -
    cd ~username
    mv siteA.tar.gz /cvsroot
    cd /cvsroot
    tar -xzf siteA.tar.gz
    
  6. Oops, we need to create the user to own these files. This command may vary depending on which distribution you have (read the man pages first).
    useradd -m -g web siteA
    su - siteA
    
    Follow the rest of the directions on how to set up the user on the OpenACS Official Documentation. Specifically, on setting up the .bashrc and/or .bash_profile files. Make sure you add in the CVSROOT.
  7. Change permissions on the cvs repository. As root:
    ls -lh
    chown -R siteA.web siteA
    
  8. Check out a copy of the repository
    su - siteA
    cd /web
    cvs checkout siteA
    
  9. Continue with the OpenACS Official Install Guide except...
  10. When you get to the part about setting up the database, instead get the data from your database backup. See Restoring from backup for details.

    If you get an error like this while restoring:

    psql -f db_backup_030622.dmp siteA
    You are now connected as new user postgres.
    psql:db_backup_030622.dmp:12: ERROR:  function plpgsql_call_handler already exists with same argument types
    psql:db_backup_030622.dmp:20: ERROR:  Language plpgsql already exists
    psql:db_backup_030622.dmp:22: \connect: FATAL 1:  user "siteA" does not exist
    
    The problem is you have users with different names. The way I got around this is...

    I opened up the .dmp file in emacs and replaces all the references to the old siteA user to the new one.

Comments