Demoprints Repository

From EPrints Documentation
Revision as of 16:29, 30 September 2010 by Th.lauke@arcor.de (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


This is a brief guide on how-to setup, install and maintain the demoprints.eprints.org repository

Base Install

  • Obtain a VM from the VM Pool (contact ld@ecs)
  • Install debian on it and follow the Installing EPrints 3 via apt (Debian/Ubuntu) guide to install eprints
  • Configure and Install a basic repository called demoprints with a demoprints mysql database

Customisations

Stop users from editing perl files

  • remove the roles field from the workflows/user/default.xml
  • remove the edit-config privileges from cfg.d/user_roles.pl

Allow users to create any type of account

  • Edit archive_name/cfg/cfg.d/registration.pl find and edit the user_registration_fields to read as follows:
 $c->{user_registration_fields} = [ "name", "usertype" ];

Install postfix for mail delivery

  • You may also need to contact postmaster@ecs to get the server permission to send email.

Update the welcome message

  • Add the following to the top message box in index.xpage

<ul> <li>This repository is a demonstration of <epc:print expr="$config{version_id}" />.</li> <li>It is open for anyone to manage and change.</li><li>You may register as an administrator or editor (on a normal installation you could not do this).</li> <li>All changes are reset automatically every <b>Sunday at 4am</b>, at which point all data is lost.</li> </ul>

Add the reset scripts (root)

  • create a file called demoprints_snapshot in the eprints home dir (as root), contents are:
 #!/bin/bash
 cd /usr/share/eprints3/archives/
 rm -f demoprints.*
 tar -cvf demoprints.tar demoprints
 mysqldump -u root demoprints > demoprints.sql
  • execute this file
  • create a file called demoprints_offline in the eprints home dir (as root), contents are:
 #!/bin/bash
 a2dissite eprints3
 /etc/init.d/apache2 reload
  • create a file called demoprints_online in the eprints home dir (as root), contents are:
 #!/bin/bash
 a2ensite eprints3
 /etc/init.d/apache2 reload
  • create a file called usercount_reset.bash in the eprints home dir (as root), contents are:
 #!/bin/bash
 source=`echo "SELECT max(userid)+10 from user;" | mysql -u root demoprints`
 rest=`echo $source | sed 's/[^ ]* \(.*\)/\1/'`
 reset=`echo "UPDATE counters set counter=$rest where countername='userid';" | mysql -u root demoprints


  • create a file called demoprints_reset in the eprints home dir (as root), contents are:
 #!/bin/bash
 a2dissite eprints3
 /etc/init.d/apache2 reload
 cd /usr/share/eprints3/archives/
 rm -fR demoprints
 tar -xvf demoprints.tar
 mysqldump -u root demoprints user > users.sql
 echo "drop database demoprints" > mysql -u root
 echo "create database demoprints" > mysql -u root
 mysql -u root demoprints < demoprints.sql
 mysql -u root demoprints < users.sql
 rm -f users.sql
 cd /usr/share/eprints3/
 ./usercount_reset.bash
 chown eprints:eprints *
 a2ensite eprints3
 /etc/init.d/apache2 reload
  • create a file called demoprints_reset.cron in the eprints home dir (as root), contents are:
 0 3 * * * /usr/share/eprints3/demoprints_offline
 10 3 * * * /usr/share/eprints3/demoprints_online
 0 4 * * 0 /usr/share/eprints3/demoprints_reset
  • make all the above files executable and add the cronjob to system startup

Add the reset scripts (eprints)

  • create a file called demoprints_daily_reset in the eprints home dir (as eprints), contents are:
 #!/bin/bash
 cd /usr/share/eprints3/archives/
 rm -f /usr/share/eprints3/archives/demoprints/cfg/lang/en/phrases/zz_webcfg.xml
 cp zz_webcfg.xml /usr/share/eprints3/archives/demoprints/cfg/lang/en/phrases/
 cd demoprints/cfg/lang/en/
 tar -xvf static.tar
 cd /usr/share/eprints3/
 ./bin/generate_static demoprints
 ./bin/generate_views demoprints
  • create a file called demoprints_import_data in the eprints home dir (as eprints), contents are:
 #!/bin/bash
 cd /usr/share/eprints3/testdata
 ./bin/import_test_data demoprints
  • create a file called demoprints_reset_eprints.cron in the eprints home dir (as eprints), contents are:
 5 3 * * * /usr/share/eprints3/demoprints_daily_reset
 10 4 * * 0 /usr/share/eprints3/demoprints_import_data
  • make all the above files executable and add the cronjob to system startup

Upgrading the EPrints Software (untested at time of writing)

  • As root
 a2dissite eprints3
 /etc/init.d/apache2ctl reload
 apt-get update && apt-get install eprints
 
 ...follow messages
 
 su eprints
 cd
 ./bin/epadmin upgrade
 a2ensite eprints3
 /etc/init.d/apache2ctl reload