Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
Updated code with downstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anusha Ranganathan committed May 28, 2012
1 parent e37400c commit 509f002
Show file tree
Hide file tree
Showing 27 changed files with 1,066 additions and 411 deletions.
2 changes: 1 addition & 1 deletion debian/README
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ The Debian Package databank

Comments regarding the Package

-- Anusha Ranganathan <[email protected]> Mon, 09 Apr 2012 17:08:50 +0000
-- Anusha Ranganathan <[email protected]> Thu, 03 May 2012 09:08:50 +0000
19 changes: 19 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
databank (0.3rc3) unstable; urgency=low

* Mod-wsgi and metadata update fixes to Sword server
* Minor user interface changes

-- Anusha Ranganathan <[email protected]> Thu, 03 May 2012 09:08:50 +0000

databank (0.3rc2) unstable; urgency=low

* Extended API to post a file without first having to create a data package
* New Databank authentication and authorization module.
- Designed to work with repoze.what and sqlalchemy.
- User and membership information stored in a mysql database
* Databank API extended to administer silos, users, and user membership
- Databank ui has new adminstration pages in line with api functionality
* Sword server packaged with databank

-- Anusha Ranganathan <[email protected]> Fri, 27 Apr 2012 09:08:50 +0000

databank (0.3rc1) unstable; urgency=low

* Basic support for sword deposit
Expand Down
6 changes: 6 additions & 0 deletions debian/config
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@ db_go
#db_input critical databank/passwdnote || true
#db_go

# Set default database name, database user
if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
. /usr/share/dbconfig-common/dpkg/config.mysql
dbc_go databank $@
fi

21 changes: 14 additions & 7 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,33 @@ XS-Python-Version: >= 2.6
Package: databank
Architecture: all
Depends: python,
python-pylons,
python-repoze.who,
python-repoze.who-friendlyform,
python-dev,
python-setuptools,
python-virtualenv,
python-rdflib,
python-dateutil,
python-libxml2,
python-libxslt1,
python-pairtree,
python-recordsilo,
python-solrpy,
python-redis,
mysql-server,
libmysql++-dev,
git-core,
unzip,
libxml2,
libxml2-dev,
libxslt1.1,
libxslt-dev,
apache2,
apache2-utils,
libapache2-mod-wsgi,
redis-server,
supervisor,
openjdk-6-jre,
debconf
Recommends: solr-tomcat
debconf,
dbconfig-common
Recommends: solr-tomcat,
mysql-client
Description: RDF-enhanced, pairtree-backed storage API
Databank is a simple, RDF-enhanced storage API which is backed by pairtree,
for the safe storage of and access to data.
2 changes: 1 addition & 1 deletion debian/copyright
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This work was packaged for Debian by:

Anusha Ranganathan <[email protected]> on Mon, 09 Apr 2012 17:08:50 +0000
Anusha Ranganathan <[email protected]> on Thu, 03 May 2012 09:08:50 +0000

It was downloaded from:

Expand Down
9 changes: 6 additions & 3 deletions debian/databank.install
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
docs/apache_config/databank_wsgi /etc/default/databank/
docs/apache_config/databank_ve26_wsgi /etc/default/databank/
docs/apache_config/databank_ve27_wsgi /etc/default/databank/
docs/solr_config/conf/schema.xml /etc/default/databank/
production.ini /etc/default/databank/
development.ini /etc/default/databank/
sss.conf.json /etc/default/databank/
MANIFEST.in /var/lib/databank/
mod_wsgi /var/lib/databank/
message_workers/ /var/lib/databank/
passwd-default /var/lib/databank/
rdfdatabank/ /var/lib/databank/
rdfdatabank.egg-info/ /var/lib/databank
test.ini /var/lib/databank/
who.ini /var/lib/databank/
sss.conf.json /var/lib/databank/
sss/ /var/lib/databank/
add_user.py /var/lib/databank/
persisted_state.json /var/lib/databank/
setup_db.py /var/lib/databank/
persisted_state.json /var/lib/databank/
4 changes: 4 additions & 0 deletions debian/dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/usr/share/databank
usr/share/dbconfig-common/data/databank/install/mysql
usr/share/dbconfig-common/data/databank/upgrade/mysql
/etc/default/databank
86 changes: 74 additions & 12 deletions debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ set -e

# Source debconf library.
. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/postinst.mysql

paramfile=/etc/default/databank/db.sh
dbc_generate_include=sh:$paramfile
dbc_go databank $@

# Ask questions
db_get databank/email
Expand All @@ -28,6 +33,7 @@ local dbpasswd="$RET"
#Modify the ini files
CONFIG_FILE1=/etc/default/databank/production.ini
CONFIG_FILE2=/etc/default/databank/development.ini
CONFIG_FILE3=/etc/default/databank/sss.conf.json
#replace email
TARGET_KEY=email_to
echo "Setting email Id: " $dbemail
Expand All @@ -47,24 +53,33 @@ sed -i "s,\($TARGET_KEY *= *\).*,\1$dbstore," $CONFIG_FILE2
#replace granary uri root
echo "Setting Base URI: " $dburi
TARGET_KEY=granary.uri_root
[ $TARGET_KEY != "*/" ] && TARGET_KEY="$TARGET_KEY""/"
#[ $dburi != "*/" ] && dburi="$dburi""/"
dburi=${dburi%/}
dburi="$dburi""/"
sed -i "s,\($TARGET_KEY *= *\).*,\1$dburi," $CONFIG_FILE1
sed -i "s,\($TARGET_KEY *= *\).*,\1$dburi," $CONFIG_FILE2

#Add the user password
#htpasswd -b -c /var/lib/databank/passwd admin $dbpasswd
#cp /var/lib/databank/passwd-default /var/lib/databank/passwd
cd /var/lib/databank
if ! [ -f /var/lib/databank/passwd ]
then
touch /var/lib/databank/passwd
fi
python add_user.py admin $dbpasswd
TARGET_KEY1=' "base_url"'
TARGET_KEY2=' "db_base_url"'
val1='"'$dburi'swordv2/",'
val2='"'$dburi'",'
sed -i "s|\($TARGET_KEY1 *: *\).*|\1$val1|" $CONFIG_FILE3
sed -i "s|\($TARGET_KEY2 *: *\).*|\1$val2|" $CONFIG_FILE3
#replace the database connection string
TARGET_KEY=sqlalchemy.url
echo "Setting Database connection string: "
chmod 744 $paramfile
. $paramfile
dburl=mysql://$dbuser:$dbpass@localhost:3306/$dbname
sed -i "s^\($TARGET_KEY *= *\).*^\1$dburl^" $CONFIG_FILE1
sed -i "s^\($TARGET_KEY *= *\).*^\1$dburl^" $CONFIG_FILE2

#Link config files
ln -sf /etc/default/databank/production.ini /var/lib/databank/production.ini
ln -sf /etc/default/databank/development.ini /var/lib/databank/development.ini
ln -sf /etc/default/databank/sss.conf.json /var/lib/databank/sss.conf.json
ln -sf /etc/default/databank/databank_wsgi /etc/apache2/sites-available/databank_wsgi
ln -sf /etc/default/databank/databank_ve26_wsgi /etc/apache2/sites-available/databank_ve26_wsgi
ln -sf /etc/default/databank/databank_ve27_wsgi /etc/apache2/sites-available/databank_ve27_wsgi

#Create dirs and change ownership and permissions
# ownership and permissions for /var/lib/databank
Expand All @@ -83,9 +98,56 @@ chgrp -R www-data /etc/default/databank/
chmod -R 770 /var/cache/databank/
# ownership and permissions granary.store
mkdir -p $dbstore
cp /var/lib/databank/persisted_state.json $dbstore
chgrp -R www-data $dbstore
chmod -R 770 $dbstore

#Setup the python virtual environment
virtualenv --no-site-packages /var/lib/databank/
cd /var/lib/databank/
. bin/activate
# Get the version of python being used
if [ -d /var/lib/databank/lib/python2.6/ ]
then
py_rs='https://github.com/anusharanganathan/RecordSilo/raw/master/dist/RecordSilo-0.4.15-py2.6.egg'
py_who='/var/lib/databank/lib/python2.6/site-packages/repoze.who-1.0.19-py2.6.egg/'
py_site=databank_ve26_wsgi
py_webob='/var/lib/databank/lib/python2.6/site-packages/WebOb-1.2b3-py2.7.egg'
else
py_rs='https://github.com/anusharanganathan/RecordSilo/raw/master/dist/RecordSilo-0.4.15-py2.7.egg'
py_who='/var/lib/databank/lib/python2.7/site-packages/repoze.who-1.0.19-py2.7.egg/'
py_site=databank_ve27_wsgi
py_webob='/var/lib/databank/lib/python2.7/site-packages/WebOb-1.2b3-py2.7.egg'
fi
easy_install python-dateutil==1.5
easy_install pairtree==0.7.1-T
easy_install $py_rs
easy_install solrpy==0.9.5
easy_install rdflib==2.4.2
easy_install redis==2.4.11
easy_install MySQL-python
easy_install pylons==1.0
easy_install lxml==2.3.4
easy_install web.py
easy_install sqlalchemy==0.7.6
easy_install webob==1.0.8
easy_install repoze.what-pylons
easy_install repoze.what-quickstart
if [ -d $py_who ]
then
rm -r $py_who
fi
if [ -d $py_webob ]
then
rm -r $py_webob
fi
easy_install repoze.who==2.0a4

#Setup the database and add the user password
cd /var/lib/databank
paster setup-app production.ini
python add_user.py admin $dbpasswd $dbemail

#Configure SOLR and message workers in supervisor
db_get databank/confsolr
local dbconf="$RET"
Expand Down Expand Up @@ -132,7 +194,7 @@ fi
#Enable site in apache
a2dissite default
a2dissite default-ssl
a2ensite databank_wsgi
a2ensite $py_site

#Start Apache
invoke-rc.d apache2 reload
Expand Down
18 changes: 16 additions & 2 deletions debian/postrm
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
#!/bin/bash
set -e

# Source debconf library.
. /usr/share/debconf/confmodule
if [ -f /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
fi
if [ -f /usr/share/dbconfig-common/dpkg/postrm.mysql ]; then
. /usr/share/dbconfig-common/dpkg/postrm.mysql
dbc_go databank $@
fi

if [ "$1" = "purge" ]; then
rm -f /etc/default/databank/db.sh
if which ucf >/dev/null 2>&1; then
ucf --purge /etc/default/databank/db.sh
ucfr --purge databank /etc/default/databank/db.sh
fi
fi


# Remove my changes to the db.
db_purge
10 changes: 10 additions & 0 deletions debian/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

set -e
#set -x

. /usr/share/debconf/confmodule
. /usr/share/dbconfig-common/dpkg/prerm.mysql
dbc_go databank $@


2 changes: 1 addition & 1 deletion debian/templates
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Description: Base URI:
Example: http://example.com/

Template: databank/password
Type: string
Type: password
Description: Administrator password:
The password for user 'admin'
The user 'admin' is the main administartor for Databank and
Expand Down
2 changes: 1 addition & 1 deletion development.ini
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ beaker.session.key = rdfdatabank
beaker.session.secret = somesecret

who.config_file = /var/lib/databank/who.ini
who.log_level = info
who.log_level = debug
who.log_file = stdout
#who.log_file = /var/log/databank/who.log

Expand Down
Loading

0 comments on commit 509f002

Please sign in to comment.