Persistent Identifier Resolver
Table of Contents
1 Description
See the 909 Registry for the function of the application.
2 Locations
2.1 Production
host: pi.lib.uchicago.edu
{source|executable}: /usr/local/www/pi/pi1001.{erl|beam}
2.2 Test
host: pi-test.lib.uchicago.edu
{source|executable}: /usr/local/www/pi-test/pi1001t.{erl|beam}
3 Dependencies
configuration file: /usr/local/etc/yaws/yaws.conf
yaws.conf contains the following sections relevant to this service.
For the production service:
ebin_dir = /usr/local/www/pi
<server pi.lib.uchicago.edu>
port = 80
listen = 0.0.0.0
docroot = /usr/local/www/pi
appmods = </1001, pi1001>
dir_listings = false
</server>
For the test service:
ebin_dir = /usr/local/www/pi-test
<server pi-test.lib.uchicago.edu>
port = 80
listen = 0.0.0.0
docroot = /usr/local/www/pi-test
appmods = </1001, pi1001t>
dir_listings = false
</server>
5 Updating the resolver
5.1 Edit and Test
ssh pi-test cd /usr/local/www/pi-test co -l pi1001t.erl scp pi:/usr/local/www/pi/pi1001.erl . sed -e 's#%% http://pi.lib#%% http://pi-test.lib#g' -e 's:-module(pi1001):-module(pi1001t):g' pi1001.erl > pi1001t.erl [edit pi1001t.erl] erlc pi1001t.erl (as the appropriate user, do the following)
Method 1 (on a FreeBSD system set up this way).
service yaws restart
Method 2 (on a system set up otherwise).
yaws --load pi1001t (See note below)
Test the new code using a few of the commented lines from /usr/local/www/pi-test/pi1001t.erl designed for the purpose, e.g., curl http://pi-test.lib.uchicago.edu/1001/test/test/test. These lines are to be found above each function clause.
Once you are satisfied with the changes:
ci -u pi1001t.erl
Load them into the production system, as follows.
5.2 Productionize
ssh pi cd /usr/local/www/pi cp pi1001.erl pi1001.erl_ scp pi-test:/usr/local/www/pi-test/pi1001t.erl . sed -e s':pi1001t:pi1001:' -e s':pi-test:pi:'g pi1001t.erl > pi1001.erl diff pi1001.erl pi1001.erl_ (note the differences; they should be as expected) erlc pi1001.erl (as the appropriate user, do the following)
Method 1 (on a FreeBSD system set up this way).
service yaws restart
Method 2 (on a system set up otherwise).
yaws --load pi1001 (See note below)
Test the new code using a few of the commented lines from /usr/local/www/pi/pi1001.erl designed for the purpose, e.g., curl http://pi.lib.uchicago.edu/1001/test/test/test. These lines are to be found above each function clause.
6 Notes
The master copy of the code is pi1001t.erl on pi-test.lib. This is the version that is kept under revision control. Changes are made to that copy first, then, once tested, they are moved into production as described above.
yaws –load [module] allows the reloading of a changed appmod into a running YAWS instance without stopping and starting YAWS. This assumes that yaws has already been started as follows:
yaws -D --heart
The resolver depends on http://marklogic.lib.uchicago.edu:8012/get-pi-pres.xqy. This means that any changes to, for example, the marklogic port number, need to be reflected in the corresponding erlang code. See the additional documentation for more information.
Note dependencies like these in the source code:
/usr/local/lib/erlang/lib/yaws-2.0.2/include/yaws_api.hrl /usr/local/lib/erlang/lib/xmerl-1.38/include/xmerl.hrl
Paths will very likely change when software is upgraded. Make sure to update the source code accordingly.
7 Requirements
Erlang; YAWS. See http://yaws.hyber.org/appmods.yaws for appmods.
