TG-noid

last modified on Okt 08, 2015

Overview

TG-noid is a service that mints (generates) the TextGrid URIs for each TextGrid object. It is used by TG-crud only. The TextGrid URIs have the prefix textgrid: and are followed by a generated character sequence, that consists of the NOID enhanced character set. Starting with textgrid:00 the URIs can be increased infinitly.

TG-noid is nothing more than a specificly configured NOID (Nice Opaque Identifier) service, that mainly is consisting of a Perl script and some HTTP server configurations.

More Documentation

The NOID is a minter and name resolver used as a microservice by the UC Curation Center of the California Digital Library.

More information concerning the NOID and related issues you can get here:

https://wiki.ucop.edu/display/Curation/NOID,

The Perl implementation used by TextGrid here:

Noid@CPAN.

Direct links to the NOID Perl module documentation you can find here:

http://search.cpan.org/\~jak/Noid-0.424/noid (HTML)

And here:

http://www.cdlib.org/inside/diglib/ark/noid.pdf (PDF)

Installation

Download and unpack

http://search.cpan.org/CPAN/authors/id/J/JA/JAK/Noid-0.424.tar.gz

to a folder of your choice. Follow the installing instructions of the NOID (or of course the following quick installation guideĀ :-).

Quick Installation Guide

Install the libberkeleydb-perl as Perl module BerkeleyDB, and compile the NOID as follows. Just type the following on your command line (beeing in the main NOID folder).

perl Makefile.PL
make
make test
sudo make install

Configuration

Copy the binary from /usr/local/bin/noid to \~/htdocs/nd/noid, to **\~/htdocs/nd/noidr_textgrid, and \~/htdocs/nd/noidu_textgrid** (last two names depend on your minter to be created).

Call (in folder /nd)

mkdir textgrid
cd textgrid
noid dbcreate textgrid:.zee

Add the noid apache configuration to /etc/apache2/sites-available/default, please install mod-rewrite first:

# --------------------------------------------------------------------------
# All the NOID configuration things following here for minting TextGrid URIs
# --------------------------------------------------------------------------

# ScriptAlias /cgi-bin/ /home/textgrid-noid/htdocs/nd/
<Directory "/home/textgrid-noid/htdocs/nd/">
    AuthType Basic
    AuthName "The TextGrid URI NOID Service"
    AuthUserFile /etc/apache2/tgnoid.htpasswd
    Require valid-user
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
</Directory>

# Make the server recognize links to htdocs/nd
ScriptAliasMatch ^/nd/noidr(.*) "/home/textgrid-noid/htdocs/nd/noidr$1"
ScriptAliasMatch ^/nd/noidu(.*) "/home/textgrid-noid/htdocs/nd/noidu$1"

# Define all the rewrite maps, start every program once on server start
RewriteMap rslv_textgrid prg:/home/textgrid-noid/htdocs/nd/noidr_textgrid

Chang group of /textgrid and NOID folders to www-data, set write permissions for group, both recursively (must be textgrid and NOID 775 and NOID/* 664).

The HTTP access then will be (e.g. for minting seven URIs).

http://[hostname]/nd/noidu_textgrid?mint+7

(after setting password... see Authentication below!)

Authentication

If you want to secure the minter just use HTTP authentication protocols (e.g. basic auth):

Set user/password authentication in /etc/apache2/sites-available/default (as shown above).

Create password file for the NOID and add user tgcrud, for TG-crud is the only one to use the TG-noid and create URIs.

htpasswd -c tgnoid.htpasswd tgcrud

Change permissions to 600, owner to www-data:root and copy to /etc/apache2/

Add /etc/apache2/tgnoid.passwd to NOID config.

Set user/passwd in TG-crud config file (as shown above).

Known Problems

  • Error: No "Env" object (Permission denied): Set correct access permissions to folder NOID (775 und 664)!
  • Error "Use of uninitialized value in split at /usr/local/bin/noid line 65." is thrown by noid script every time. The line comes fromĀ http://cpansearch.perl.org/src/NOBULL/perl5lib-1.02/lib/perl5lib.pmand was solved by replacing line 65 by the following code:

    syntaxhighlighter-pre use lib map { /(.*)/ } defined($ENV{PERL5LIB}) ? split(/$Config{path_sep}/, $ENV{PERL5LIB}) : ();

    Best is to add the above code before making the NOID!