Testing Metacat
===============


Procedure:

1. Build Metacat

2. Deploy to servlet container
   1. Build a VM and install software dependencies
   2. Configure tomcat
   3. Configure postgres

3. Configuration magic


4. Execute tests


Virtual Machine for Hosting Test Instance
-----------------------------------------

Create a new KVM client::

  ubuntu-vm-builder kvm karmic \
    --arch='amd64'  \
    --mem='1024'  \
    --rootsize='20000'  \
    --swapsize='1024'  \
    --dest=/kvm/dev-testing.dataone.org \
    --kernel-flavour='server'  \
    --hostname='dev-metacat'  \
    --domain='dev-metacat.dataone.org'  \
    --mirror='http://archive.ubuntu.com/ubuntu'  \
    --components='main,universe,multiverse'  \
    --addpkg ufw \
    --addpkg dnsutils \
    --addpkg curl \
    --addpkg wget \
    --addpkg libnss-ldap \
    --addpkg nscd \
    --addpkg openssh-server \
    --addpkg nano \
    --addpkg man \
    --addpkg acpid \
    --name='Administrator'  \
    --user='localadmin'  \
    --pass='<< password >>'  \
    --bridge=br0 \
    --ip='129.24.0.17'  \
    --mask='255.255.255.0'  \
    --net='129.24.0.0'  \
    --bcast='129.24.0.255'  \
    --gw='129.24.0.1'  \
    --dns='129.24.8.4' \
    --libvirt qemu:///system 


Post installation::

  cd /etc/ssl/certs
  wget https://repository.dataone.org/software/cicore/trunk/os-base-install/dataone-os-base/etc/ssl/certs/ecoinfo-ldapcert.pem


Replace ``/etc/ldap.conf`` with this::

  $ cat /etc/ldap.conf
  
  base ou=Account,dc=ecoinformatics,dc=org
  ldap_version 3
  uri ldap://ldap.ecoinformatics.org
  pam_groupdn cn=dataone-shell,ou=Groups,dc=ecoinformatics,dc=org
  pam_member_attribute uniqueMember
  pam_password md5
  ssl start_tls
  tls_checkpeer yes
  tls_cacertfile /etc/ssl/certs/ecoinfo-ldapcert.pem
  nss_initgroups_ignoreusers avahi,backup,bin,daemon,games,gnats,irc,landscape,libuuid,list,lp,mail,man,messagebus,news,pan,postgres,proxy,root,sshd,sync,sys,syslog,tomcat6,uucp,www-data


Edit ``/etc/pam.d/common-session`` and add the ``pam_mkhomedir`` entry::

  # here are the per-package modules (the "Primary" block)
  session	[default=1]     pam_permit.so
  # here's the fallback if no module succeeds
  session	requisite       pam_deny.so
  # prime the stack with a positive return value if there isn't one already;
  # this avoids us returning an error just because nothing sets a success code
  # since the modules above will each just jump around
  session	required        pam_permit.so
  # and here are more per-package modules (the "Additional" block)
  session	required        pam_unix.so 
  session required        pam_mkhomedir.so skel=/etc/skel/
  session	optional        pam_ldap.so 
  # end of pam-auth-update config

Add users to passwd file::

  pass


Install Postgresql::

  sudo apt-get install postgresql


Install Tomcat, ant::

  sudo apt-get --no-install-recommends install java-6-sun
  sudo update-java-alternatives -s java-6-sun
  sudo apt-get --no-install-recommends install ant
  sudo apt-get install tomcat6 tomcat6-admin