SOPAC is a next-generation catalog system that takes advantage of online, web 2.0-like interaction to build a rich, engaging discovery layer.
If you are installing SOPAC, or would like to know how SOPAC is installed and configured, then this is the right guide for you.
The following pages will introduce you to SOPAC, its mechanics, its configuration points, and a number of best practices in deploying and using it.
SOPAC, Locum, and Insurge are developed as a LAMP-based (Linux Apahce MySQL PHP) suite of products. Locum and Insurge are not dependent on Apache, however, while SOPAC is.
In addition, SOPAC is a Drupal module written for Drupal 6. If you are running a previous version of Drupal, SOPAC will not work.
To give you an idea of what the "generic" requirements are, the following is the configuration and load-out of Darien Library's SOPAC development server versus its production server:
Software
CPU & Memory
Software
CPU & Memory
It is recommended that you put plenty of memory in your production server. Since much of Locum's search capability is built on harnessing the speed of memory searches, the more the better. Locum can actually perform searches and build facets amazingly fast because of it's in-memory dataset dependence. Our philosophy: memory is cheap, time is not.
Sphinx
Locum requires that you build and install the Sphinx full text search engine. You can download it here and following these recommended installation instructions.
In order to build Sphinx, you will need to make sure you have the following installed:
PEAR::MDB2
Locum and Insurge also require that you install PEAR::MDB2.
for Apache
for PHP
SOPAC requires that you download and install four items: SOPAC itself, Insurge, Locum, and a Locum connector.
All four components can be obtained from the download page on this site. You will need to download SOPAC, Insurge, and Locum. You will then need to identify the appropriate connector for your ILS and version. (Currently, there is only one connector for III's Millennium 2006).
This installation guide assumes that you have Drupal 6 up and running already. If you need help with that part of the process, head on over to drupal.org and get acquainted with the best open source CMS in the world.
While the SOPAC suite can be installed anywhere on your file system, it is recommended that you place the locum and insurge directories in /usr/local/lib. Your file tree would then look like:
/usr/local/lib/locum
/usr/local/lib/insurge
Once you have downloaded Insurge and Locum, you can extract and move them to the correct location:
tar zxvf locum-1.x.x.tar.gz
mv locum /usr/local/lib
tar zxvf insurge-1.x.x.tar.gz
mv insurge /usr/local/lib
You will also need to drop in the ILS connector you are using. As an example, if you are using the III connector, you would place the entire folder into the locum/connectors directory:
tar zxvf locum_iii_2006-1.0.0-beta1.tar.gz
mv locum_iii_2006 /usr/local/lib/locum/connectors
In addition, you should create a DSN directory that is external to your web root. This will contain the DSN that both Insure and Locum use. It's recommended that this folder reside in /usr/local/etc. If it doesn't exist:
mkdir /usr/local/etc
Once the DSN directory has been created, go ahead and create a new mysql database for Locum and Insurge to use. By default, Locum and Insurge assume that the name of the database is 'scas' (Social Catalog Application Suite). You can change this, of course, but you will then need to make sure it is updated appropriately in the distributed schema code.
While you're at it, you might as well create a user for the database as well.
mysql> create database scas;
mysql> grant all privileges on scas.* to scasuser@'localhost' identified by 'scaspassword';
mysql> flush privileges;
Of course, you can change 'scasuser' and 'scaspassword' to whatever you like. When you're done with this step, go ahead and create a file called 'scas.php' in your dsn directory and put the following in it (changing values as needed):
<?php
$dsn = 'mysql://scasuser:scaspassword@localhost/scas';
Once you're done with this step, you're ready to move on to the actual installation of the Sphinx full-text search engine.
Sphinx is an important component of the Locum library. It is well worth your time to read through the Sphinx documentation because you will be able to greatly customize it to exactly match your needs. Of course, Locum is distributed with a Sphinx configuration file that should work out of the box with very little modification.
Locum was designed to run on Sphinx 0.9.8, which can be downloaded here.
Also, make sure the following are installed on your system (package names may vary by Linux distribution. For more detailed information on these prerequisites, see the Sphinx home page):
Here are the recommended steps to get Sphinx installed (run as root):
cd ~
wget http://sphinxsearch.com/downloads/sphinx-0.9.8.tar.gz
tar zxvf sphinx-0.9.8.tar.gz
cd sphinx-0.9.8
./configure --prefix=/usr/local/sphinx
make
make install
Next, we'll make sure that the PHP API is available in the install tree. From the same source directory do:
mkdir /usr/local/sphinx/lib
cp api/sphinxapi.php /usr/local/sphinx/lib/
Next, you have to create a sphinx user, a PID directory and set the right ownership so we can install a nice init script ( !!! make sure you do '>>' and NOT '>'):
echo "sphinx:x:999:999:Sphinx User,,,:/usr/local/sphinx/:/bin/true" >> /etc/passwd
echo "sphinx:x:999:999:Sphinx User,,,:/usr/local/sphinx/:/bin/true" >> /etc/passwd-
echo "sphinx:x:999:" >> /etc/group
echo "sphinx:x:999:" >> /etc/group-
mkdir /usr/local/sphinx/var/run
chown -R sphinx.sphinx /usr/local/sphinx/var
cd /etc/init.d
wget http://www.thesocialopac.net/sites/thesocialopac.net/files/sphinx
chmod +x /etc/init.d/sphinx
Finally, you're going to copy the Locum-specific Sphinx configuration file into place.
cp /usr/local/lib/locum/sphinx/sphinx.conf /usr/local/sphinx/etc/
Once that's copied over, edit it, and replace all instances of "locum_db_user" and "locum_db_pass" with the MySQL username and password you set up in the initial preparation.
Sphinx should now be ready. We will do a little more with it when we get in to installing Locum.
Now that the operating environment for Locum and Insurge has been installed and configured, it's time to do the actual installation. In the case of both these libraries, it's a matter of installing the database schema and configuring the library.
Again, this installation guide assumes that you already have Drupal 6 installed and a basic working knowledge of how to administer and use Drupal.
For the purposes of running SOPAC, you will be concerned only with the Insurge client component.
This installation guide covers a stand-alone installation of Insurge. Future documentation will describe the process involved in participating with a central social repository. In this context, installation of Insurge is very simple.
First, you must install the Insurge database schema:
mysql -u root -p < /usr/local/lib/insurge/sql/scas_insurge.sql
If you did not name your database 'scas', you will need to edit the schema file to reflect that.
If the schema was successfully imported, then you can move on to configuring Insurge. Insurge's configuration options are located in its INI file: /usr/local/lib/insurge/config/insurge.ini.
Because we are setting up a stand-alone (non-repository) Insurge site, you only need to set the dsn_file parameter. It should look something like:
dsn_file = "/usr/local/etc/scas_dsn.php"
Setup of Locum is probably the most complex step in this installation process. This is because Locum must be configured to operate in your environment. Since every library is different, the actual organization and structure of configuration files can vary significantly between institutions.
First, you must install the Locum database schema:
mysql -u root -p < /usr/local/lib/locum/sql/scas_locum.sql
If you did not name your database 'scas', you will need to edit the schema file to reflect that.
Once you've verified that the schema has successfully imported, you will need to configure MySQL to initialize the Locum facet heap table. In your /etc/mysql/my.cnf (may be in a different location, depending on your distribution), add the following under the [mysqld] section:
max_heap_table_size = 200M
init_file = /usr/local/lib/locum/sql/locum_init.sql
Once you've done this, you can move on to configuring Locum. Locum's configuration options are located in its INI file: /usr/local/lib/locum/config/locum.ini.
Take some time to become familiar with the distributed INI file. Many of the options are self-explanatory, but several critical options may need some explanation.
The initial configuration section is fairly straight-forward. Be sure to create /usr/local/var/log if it does not exist. run_quiet forces locum to only use the log file and not stdout as well.
[locum_config]
dsn_file = "/usr/local/etc/scas_dsn.php"
log_file = "/usr/local/var/log/locum.log"
run_quiet = FALSE
You should not have to change these values if you installed Sphinx using this guide.
[sphinx_config]
api_path = "/usr/local/sphinx/lib"
server_addr = "localhost"
server_port = 3312
If you have pcntl enabled in PHP, you should not need to change this. You may want to come back and tweak it later. If you do not have pcntl enabled, you'll need to change harvest_with_children to FALSE. Your harvest time will be much greater without it, however.
[harvest_config]
harvest_with_children = TRUE
max_children = 10
harvest_reach = 1000
Setting up your API configuration is entirely optional. But you will need to enable either Syndetics or Amazon if you want to have cover images. Also, Locum uses Google for search suggestions. You can enable this here and tell Locum the number of search result under which to activate it. In this example here, Locum will try Syndetics for a cover image first, then Amazon.
[api_config]
use_amazon_images = TRUE
amazon_access_key = "786YBG8D7F6GO8DFN7B6"
amazon_img_prio = 2
use_syndetic_images = TRUE
syndetic_custid = "syndtid"
syndetic_img_prio = 1
use_google_suggest = TRUE
suggestion_threshold = 10
This section is critical in order for Locum to integrate with your ILS. It is where you determine which ILS connector to use and how to connect to your ILS server. Because this example uses the III connector, it will need to harvest on port 2082 (using xrecord). You will need to make sure the harvesting server has access to that port on your ILS server and that if there is a firewall between, it can pass through it.
[ils_config]
ils = "iii";
ils_version = "2006"
ils_server = "ils.yourlibrary.org"
ils_harvest_port = "2082"
The rest of the configuration file will be very specific to your organization. Read the commented sections carefully for instructions. Bear in mind that for purposes of the initial harvest, any sections below [ils_config] do not need to be completed yet. It is safe to "tweak them" once everything is up and running.
Because SOPAC is a Drupal module, installation paths will vary from system to system. You will install and enable it as you would with any other third party Drupal module.
It is strongly recommended that you purchase a SSL certificate for your Drupal site. SOPAC has the built-in ability to encrypt pages appropriately and will take advantage of your encrypted server.
Configuring Apache2 for SSL support is beyond the scope of this guide and there is plenty of instruction and support available on the web.
You will, however, need to make the following addition to your SSL virtualhost definition (just the SSL definition, not the regular one). Your enabled SSL site should be encapsulated in a definition that looks like this:
<VirtualHost 1.2.3.4:443>
...
<VirtualHost>
Within that definition, put the following line:
SetEnv HTTPS TRUE
SOPAC/SSL integration will not work unless this parameter has been properly set.
Once you have succesfully installed the SOPAC module, you will want to tailor it to your environment. SOPAC makes this very easy for you.
First you will need to set the appropriate permissions. They should look something like this:

Next, visit the SOPAC configuration page under Administer > Site configuration > SOPAC Settings (or /admin/settings/sopac). You'll notice that there are three configuration sections. The first contains the critical elements that must be correctly set:

You can choose to tweak the settings in the other two sections now, or wait until later.
In a perfect world, you should only have to harvest once then run your maintenance script to keep your database and index up-to-date. The next section will cover those maintenance tasks and how to automate them.
If everything has been configured correctly, running the initial harvest should be very simple. The harvest script is included in the Locum distribution. (/usr/local/lib/locum/tools/harvest.php). You will need to edit it to make sure all of the parameters are correct. You need to know the lowest bib number and highest bib number in your system now and plug them in here. You don't need to change $large_record_split.
// You'll need to change these:
$first_record = 1000006;
$last_record = 1284000;
$large_record_split = 10;
// Init scripts, library locations, and binaries
$locum_lib_dir = '/usr/local/lib/locum';
$mysql_init_script = '/etc/init.d/mysql';
$sphinx_init_script = '/etc/init.d/sphinx';
$sphinx_indexer = '/usr/local/sphinx/bin/indexer';
Once you have harvest.php configured properly, you'll make it executable and run it:
chmod +x /usr/local/lib/locum/tools/harvest.php
/usr/local/lib/locum/tools/harvest.php
If you don't see any errors, things should be OK. You ought to make sure that the scrip is actually exporting records:
mysql> SELECT COUNT(*) FROM locum_bib_items;
It would be a good idea to go one step further and examine the data going in as well. If everything look OK, go get a cup of coffee, a meal, a good night's sleep and check it in the morning.
If the process completes without errors, great! You're almost there! You'll need to prep your index tables before indexing:
chmod +x /usr/local/lib/insurge/tools/update-index.php
ln -s /usr/local/lib/insurge/tools/update-index.php /etc/cron.hourly/locum
Finally, go and build your Sphinx index and start Sphinx:
/usr/local/sphinx/bin/indexer --all
/etc/init.d/sphinx start
You should now have SOPAC up and running!
All that is left to do now it tend to the maintenance responsibilities. I would go on to the next step once you have verified that SOPAC is indeed working properly and that you have a viable data set.
Once you have set up SOPAC, Locum, and Insurge, you will have to schedule the regular maintenance tasks. There are both daily and hourly tasks. The hourly tasks can be schedules and a higher or lower frequency if you like, but hourly seems a safe bet.
The daily Locum maintenance script (maint.php) does several things:
The maintenance script is in the Locum tools directory (/usr/local/lib/locum/tools/maint.php). You'll want to check its configuration parameters then add it to cron.daily:
chmod +x /usr/local/lib/locum/tools/maint.php
ln -s /usr/local/lib/locum/tools/maint.php /etc/cron.daily/locum
The hourly maintenance script does the following:
The maintenance script is in the Insurge tools directory (/usr/local/lib/Insurge/tools/update-index.php). You'll want to check its configuration parameters then add it to cron.hourly:
chmod +x /usr/local/lib/insurge/tools/update-index.php
ln -s /usr/local/lib/insurge/tools/update-index.php /etc/cron.hourly/locum
It's a good idea to let logrotate manage your locum log file. You can do that easily, by adding an entry in /etc/logrotate.d
Finally, it's a really good idea to have sphinx autostart so that if you reboot the server, it comes up by itself. In Debian, the default runlevel is 2, so you would do something like:
ln -s /etc/init.d/sphinx /etc/rc2.d/S99-Sphinx