EPrints for Deployments

ULCC deployment of EPrints 3.3 branch

View project on GitHub

About

ulcc-core was originally developed at the University of London Computer Centre http://www.ulcc.ac.uk/ and is the basis for all of ULCC's EPrints-based services. ulcc-core is a fork of https://github.com/eprints/eprints/tree/3.3 - currently the active EPrints development branch.

Aim

The aim of ulcc-core is to provide a deployment-ready codebase for EPrints that has a number of useful Bazaar modules already pre-installed. One of the (interesting?) features of ulcc-core is that configuration files in lib/defaultcfg are automatically loaded - this means that (a) the repository-level configuration can be very minimal as most settings are inherited from lib/defaultcfg and (b) any changes to lib/defaultcfg (for example as the result of a new EPrints release) are automatically inherited by all repositories.

How to Contribute

Please see http://eprintsug.github.io/

Deployment

Assuming you want to deploy ulcc-core into /opt/eprints3:

cd /opt
mkdir eprints3
chown eprints:eprints eprints3
chmod 02775 eprints3
cd eprints3
su eprints
git clone https://github.com/eprintsug/ulcc-core.git .
cp perl_lib/EPrints/SystemSettings.pm.ulcc perl_lib/EPrints/SystemSettings.pm

Edit SystemSettings.pm to suit - usually this just means adding the appropriate user and group.

Pull in the pre-installed Bazaar modules:

git submodule init
git submodule update

To create a repository, first fork https://bitbucket.org/ulcc-art/ulcc-skel, then:

cd archives
git clone https://bitbucket.org/your/fork

Your new repository will contain a minimal set of configuration files which you should now edit to suit your requirements:

tree archives/foo
 archives/foo/
 ├── bin
 │   └── nightly.sh # schedule this to run nightly via cron
 ├── cfg
 │   ├── cfg.d
 │   │   ├── 10_core.pl # hostname of repository
 │   │   ├── adminemail.pl # repository administrator email address
 │   │   └── database.pl # db connection details (use 'bin/epadmin config_db foo' to change if preferred)
 │   └── lang
 │       └── en
 │           └── phrases
 │               └── archive_name.xml # repository name
 ├── documents
 │   └── disk0
 ├── html
 └── var

The repository configuration should contain production settings so override these with settings suitable for your dev environment:

cd cfg/cfg.d
cp 10_core.pl 10_core_test.pl # set dev hostname
cp database.pl database_test.pl # (Optional: set dev db name, user and password)

To get everything up and running:

cd /opt/eprints3
bin/epadmin create_db foo
bin/import_subjects foo lib/defaultcfg/subjects
bin/epadmin create_user foo # create a user called 'admin'
testdata/bin/import_test_data foo archive admin
bin/generate_apacheconf --replace --system

Follow the instructions given by generate_apacheconf for adding EPrints to your global Apache configuration, then finally (re)start Apache.

Enabling Bazaar Modules

In most cases, plugins can be enabled with 2 steps, for example:

tools/epm link_lib bootstrap
tools/epm enable foo bootstrap

Some plugins require additional steps - see below.

RIOXX2 and Recollect

Both of these expect to find a workflow file archives/foo/cfg/workflows/eprint/default.xml - the ulcc-skel repository does not provide this file so do the following before enabling:

mkdir -p archives/blank/cfg/workflows/eprint/
cp lib/defaultcfg/workflows/eprint/default.xml archives/blank/cfg/workflows/eprint/

MePrints

MePrints expects to find 2 workflow files: archives/foo/cfg/workflows/eprint/default.xml and archives/foo/cfg/workflows/user/default.xml - the ulcc-skel repository does not provide these files so do the following before enabling:

mkdir -p archives/blank/cfg/workflows/eprint/
mkdir -p archives/blank/cfg/workflows/user/
cp lib/defaultcfg/workflows/eprint/default.xml archives/blank/cfg/workflows/eprint/
cp lib/defaultcfg/workflows/user/default.xml archives/blank/cfg/workflows/user/

Deployment @ ULCC

The steps that ULCC use for deploying ulcc-core on staging and production servers.

RHEL5 servers may not have the required SSL CAs for github: if you see an SSL certificate error prefix the git command with "env GIT_SSL_NO_VERIFY=true", for example:

env GIT_SSL_NO_VERIFY=true git clone https://github.com/eprintsug/ulcc-core.git .

Staging

After requesting DNS name for staging service, define staging service in Wumpus and deploy to staging server (see internal ULCC documentation).

Run the following on the staging server:

cd /www/foo-test
mkdir eprints3
chown eprints:eprints eprints3
chmod 02775 eprints3
cd eprints3
su foo
git clone https://github.com/eprintsug/ulcc-core.git .
cp perl_lib/EPrints/SystemSettings.pm.ulcc perl_lib/EPrints/SystemSettings.pm
vim perl_lib/EPrints/SystemSettings.pm # set user and group to 'foo'
git submodule init
git submodule update

To deploy the repository configuration from bitbucket you need to create an ssh key and add it to bitbucket as a Deployment Key https://confluence.atlassian.com/bitbucket/use-deployment-keys-294486051.html:

ssh-keygen # if keys not already generated
cat /u/web/foo/.ssh/id_rsa.pub # copy to bitbucket

The deployment key should then let you checkout the repository configuration:

cd archives
git clone git@bitbucket.org:ulcc-art/foo.git footest

The repository configuration should contain production settings so override these with settings suitable for staging:

cd cfg/cfg.d
cp 10_core.pl 10_core_test.pl # set staging hostname
cp database.pl database_test.pl # set staging db name, user and password

Enable required Bazaar modules:

cd /www/foo-test/eprints3
for epm in $(ls archives/footest/cfg/epm); do tools/epm link_lib $epm; done
tools/epm link_lib irus # always enable IRUS
tools/epm link_lib meprints # if irstats enabled without meprints (to prevent warnings)

Get up and running:

bin/epadmin create_db footest
bin/generate_apacheconf
bin/epadmin footest # final sanity check
/scripts/mapachectl2 restart FOO-test # restart apache for 'foo' staging service

Production

After requesting DNS name for production service, define production service in Wumpus and deploy to production server (see internal ULCC documentation).

Run the following on the production server:

cd /www/foo
mkdir eprints3
chown eprints:eprints eprints3
chmod 02775 eprints3
cd eprints3
su foo
git clone https://github.com/eprintsug/ulcc-core.git .
cp perl_lib/EPrints/SystemSettings.pm.ulcc perl_lib/EPrints/SystemSettings.pm
vim perl_lib/EPrints/SystemSettings.pm # set user and group to 'foo'
git submodule init
git submodule update

To deploy the repository configuration from bitbucket you need to create a key pair and add the public to bitbucket as a Deployment Key https://confluence.atlassian.com/bitbucket/use-deployment-keys-294486051.html:

ssh-keygen # if keys not already generated
cat /u/web/foo/.ssh/id_rsa.pub # copy to bitbucket

The deployment key should then let you checkout the repository configuration:

cd archives
git clone git@bitbucket.org:ulcc-art/foo.git foo

Enable required Bazaar modules:

cd /www/foo/eprints3
for epm in $(ls archives/foo/cfg/epm); do tools/epm link_lib $epm; done
tools/epm link_lib meprints # if irstats enabled without meprints (to prevent warnings)
tools/epm link_lib irus # always enable IRUS

Get up and running:

bin/epadmin create_db foo
bin/generate_apacheconf
bin/epadmin footest # final sanity check
/scripts/mapachectl2 restart FOO # restart apache for 'foo' production service

Contributing to ulcc-core

Adding new plugins

git submodule add https://github.com/eprintsug/foo.git lib/epm/foo
git status # should show changes to .gitmodules and lib/epm/foo
git commit -am "Added foo 1.0.0"
git push

Merging upstream changes

To merge upstream changes from eprints/3.3 directly into ulcc-core/master, run the following:

git clone git@github.com:eprintsug/ulcc-core.git
git submodule init
git submodule update
git remote add upstream https://github.com/eprints/eprints.git
git fetch upstream 3.3
git merge upstream/3.3
# may need to fix conflicts and commit
git push