in last 10 minutes
Moving an OpenACS instance to another server
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
- Make a dump of the database from site A.
pg_dump -f db_backup_030729.dmp siteA
- 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.
- 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.
- As root, tar up the repository for siteA.
cd /cvsroot tar -cf siteA.tar siteA gzip siteA.tar
- 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
- 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
- Change permissions on the cvs repository. As root:
ls -lh chown -R siteA.web siteA
- Check out a copy of the repository
su - siteA cd /web cvs checkout siteA
- Continue with the OpenACS Official Install Guide except...
- 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
I opened up the .dmp file in emacs and replaces all the references to the old siteA user to the new one.