5.4. Setup the development catalog

Now we have a branch in CVS, but we need to tie it to something in the real world, namely, an Interchange catalog.

5.4.1. Importing the catalog

Like we did in Integrating CVS with Interchange, you must make another copy of your catalog for use as the development version. Some would like to keep the orders/, logs/, and other directories the same, but I prefer to start with a clean slate, especially since I don't plan on having any customers visit the development site. (In fact, you can restrict who can access the development URL using the Apache <Directory> allow from... directive).

5.4.1.1. Checkout source code

cd /var/lib/interchange
cvs co -d foundation_dev foundation

5.4.1.2. Copy any other needed directories to complete the catalog

Depending on how complete your catalog is in CVS, you may need to create or copy directories/files.

cd /var/lib/interchange/foundation
cp -a catalog.cfg orders/*   \
        /var/lib/interchange/foundation_dev


Note: A lot of the following steps are performed by the /usr/local/interchange/bin/makecat script, but here is how to do it manually:

5.4.2. Setting up a separate database

Most often, I find it profitable to make use of a second database for the development catalog, rather than having both catalogs reference the same database (especially if the first catalog is live).

5.4.2.1. Create a second database

Use the means of your database platform to create a separate database. For example, PostgreSQL users might do something like:

createdb foundation_dev

5.4.2.2. Populate the database

You can rely on the catalogs internal products/*.txt data to generate the database tables and populate them, or you can export another catalog's database and import it for the development catalog, like the example below for PostgreSQL users.

pg_dump foundation  > ~/foundation.dump
psql foundation_dev < ~/foundation.dump

5.4.3. Copy the catalog support files

#Must be root
su - root

#Copy HTML
cd /var/www/html/
cp -a foundation foundation_dev

#Copy CGI
cd /var/www/cgi-bin
cp -a foundation foundation_dev

5.4.4. Configure the Interchange daemon

Perform the necessary modifications to interchange.cfg. For example:

/usr/local/interchange/interchange.cfg:
Catalog found     /var/lib/interchange/foundation     /cgi-bin/foundation
Catalog found_dev /var/lib/interchange/foundation_dev /cgi-bin/foundation_dev

5.4.5. Configure the catalog specifics

The development catalog will differ at least a little bit from the standard catalog, such as in the CGI_URL and database parameters. I recommend using a separate "local" configuration file to hold the separate values, such as config/local.cfg, and then include it from catalog.cfg.

/var/lib/interchange/config/local.cfg:
Variable CGI_URL   /cgi-bin/foundation_dev
Variable IMAGE_DIR /foundation_dev/images

Now you can restart Interchange to make your changes take effect.