Successfully Migrated Osprey/Permaseed Installation

This week I am tackling a conversion from my outdated server, currently running FC4, to new hardware which is now running CentOS 5.  So no big deal right?  I have certainly been dreading the move, because of all the fun I've had installing osprey/permaseed in the past.  I am happy to say that the conversion WAS in fact NO BIG DEAL.  Here' s what I did in case anyone else ever needs some advice on the process.

Assumptions:

  1. I am using the binary bnbt osprey tracker, not the built-in php-powered tracker.
  2. I moved my instance to a server with the same hostname.  Changing hostnames will be an extra step (possibly complex) to this process.
  3. I upgraded from FC4 to CentOS 5
  4. I upgraded from apache 2.0 to 2.2
  5. I upgraded from mysql 4.x to 5.x
  6. I had a working NamedVirtualHost configuration on apache


Take stock of everything from your current server.  You do take backups of your database right? Dump your database and copy your install files:


***Backup your database
mysqldump -uroot -p -D mydatabasename -c > /mybackupfolder/dumpfile

***Osprey directory where html and web app are rooted.
rsync -avr /opt/osprey /mybackupfolder

***Permaseed directory where I compiled everything initially.  You may not need this.
rsync -avr /opt/permaseed /mybackupfolder 

***Permaseed binary, configs, torrent storage and logs.
rsync -avr /usr/loca/permaseed /mybackupfolder/usr/local/permaseed

***Osprey binary, config and logs.
rsync -avr /usr/loca/osprey /mybackupfolder/usr/local/osprey

***My Osprey and Permaseed Service Scripts
rsync -avr /etc/init.d/permaseed /mybackupfolder/etc/init.d
rsync -avr /etc/init.d/osprey /mybackupfolder/etc/init.d

***My Osprey Virtual Host for Apache
rsync -avr /etc/httpd/conf.d/vhost-osprey.conf /mybackupfolder/etc/httpd/conf.d/


***Move your backups to the new server***
rsync -avr -e ssh /mybackupfolder newhostname:/opt/


Recreate the empty database, your dbuser and then re-Import your database on the new server.  I didn't have any problems with moving from mysql 4.x to 5.x.


mysql -uroot -p
>create database mydatabasename;
>grant all on mydatabasename.* to 'someuser'@'localhost' identified by 'password';
>flush privileges;
>quit
mysql -uroot -p -D mydatabasename < /opt/mybackupfolder/dumpfile

Move all the files where you need them.  We copied the files to the

/opt/mybackupfolder

into the directories where they belong on the new host.  There's probably some sweet rsync move you could do right now, but my confidence is not high enough to perform such a feat.  instead I just copied the files where they needed to go using the paths I setup as reminders.

 


cp -a /opt/osprey ..  
cp -a /opt/permaseed .. 
cp -a /usr/local/permaseed /usr/local/ 
cp -a /usr/local/osprey /usr/local/ 
cp -a /etc/init.d/permaseed /etc/init.d 
cp -a /etc/init.d/osprey /mybackupfolder/etc/init.d 
cp -a /etc/httpd/conf.d/vhost-osprey.conf /mybackupfolder/etc/httpd/conf.d/ 

***This is an extra step to link my psctl to all user paths.
ln -s /usr/local/permaseed/bin/psctl /usr/local/bin


At this point I have rebuilt the app layout and put everything back in it's place.  Nice right.  Well at this point you would almost be finished if you were moving to another server of equal setup (which is almost never).  So to shore up, I had to rebuild the dynamic parts of the apps (i.e. the compiled parts).

Grab the binaries that match your original install.  I grabbed v1.0 because I know my RC2 version was very close (aside from my web design and patching that I know didn't break anything).


cd /opt
wget http://osprey.ibiblio.org/download/osprey-1.0.tar.bz2
wget http://osprey.ibiblio.org/download/permaseed-1.0.tar.bz2

Extract, Configure and Compile.  You may have to grap some dependencies to finish this step.  Fix the ./configure errors, which usually means install the *-devel.rpm packages that you need.

yum install -y mysql-devel gcc-c++



tar xvf osprey-1.0.tar.bz2
cd osprey-1.0
./configure 
make
make install
cd ..

tar xvf permaseed-1.0.tar.bz
cd permaseed-1.0
./configure
make
make install
cd ..

I still had to do a few other things.  After running "make install", it should sync up your install directories with the latest compiled versions of the permaseed and osprey binaries and should leave your conf files untouched (since make install only creates *.conf-dist files).  So the last steps..  Create Osprey user and group for the tracker to run, create perms for Osprey to write logs, create session directory for PHP sessions and add services to system for auto startup.  Done...

 


useradd -r -s /bin/false osprey
chown osprey:osprey /usr/loca/osprey -R
*** this storage location is configurable in the osprey webapp "/path_to_osprey/web/etc/osprey.conf"
mkdir /opt/session
chgrp apache /opt/session  

chkconfig --add /etc/init.d/osprey
chkconfig osprey on
service osprey start

chkconfig --add /etc/init.d/permaseed
chkconfig permaseed on
service permaseed start

So, after all that... I opened my firewall, restarted apache and voila, I was back in action!!!  The only other thing I had to do was update my permaseed instance in the osprey web app.  Head to your new instance of osprey at this url:



***Edit your permaseed and change the ip address of the permaseed.
This will point all new bittorrent clients to the new permaseed rather 
than your old one.

http://ospreyurl/pseed.php?action=list

***Then don't forget to restart permaseed and osprey to re-initialize new torrents.

service osprey restart
service permaseed restart

And... Done.