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

Commit

Permalink
Merge branch 'master' of ssh://github.com/EUDAT-B2SAFE/B2SAFE-core
Browse files Browse the repository at this point in the history
  • Loading branch information
ccacciari committed Jul 9, 2015
2 parents a6011fc + 1a254d2 commit 1ecb9e3
Show file tree
Hide file tree
Showing 13 changed files with 289 additions and 50 deletions.
12 changes: 12 additions & 0 deletions b2safe.config
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
#directory of the iRODS installation
#for irods3 it is, typically, /home/user/iRODS
#for irods4 it is, typically, /var/lib/irods/iRODS
IRODS_DIR: /var/lib/irods/iRODS

#directory of the iRODS configuration files
#for irods3 it is, typically, /home/user/iRODS/server/config/reConfigs
#for irods4 it is, typically, /etc/irods
IRODS_CONF_DIR: /etc/irods

#directory of the iRODS server configuration file (server.config)
#for irods3 it is, typically, /home/user/iRODS/server/config
#for irods4 it is, typically, /etc/irods
IRODS_SERVER_CONF_DIR: /etc/irods

#directory of the source package downloaded via git
SOURCE_DIR: /var/lib/irods/B2SAFE-core

#directory of iRODS module configuration files
#for irods3 it is, typically, /home/user/b2safe-core
#for irods4 it is, typically, /etc/irods/b2safe-core
CONF_DIR: /etc/irods/b2safe-core

#default iRODS resource
Expand All @@ -20,6 +28,8 @@ DEFAULT_RESOURCE: demoResc
CRED_STORE_TYPE: os

#path to the credentials file for EPIC
#for irods3 it is, typically, /home/user/b2safe-core/credentials
#for irods4 it is, typically, /etc/irods/b2safe-core/credentials
CRED_FILE_PATH: /etc/irods/b2safe-core/credentials

#iRODS server id in the form <protocol>://<server_name>:<irods_port>
Expand All @@ -42,6 +52,8 @@ USERS: *
LOG_LEVEL: DEBUG

#directory of the B2SAFE log files
#for irods3 it is, typically, /home/user/b2safe-core/log
#for irods4 it is, typically, /etc/irods/b2safe-core/log
LOG_DIR: /etc/irods/b2safe-core/log

#shared iRODS collection to store command files
Expand Down
26 changes: 23 additions & 3 deletions b2safe_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,14 @@ def check(strr, fname):
+ BACK).lower()
chk = inpt(inp)

stat(SOURCE_DIR)
try:
subprocess.check_call(["stat", SOURCE_DIR])
except subprocess.CalledProcessError:
print RED + BOLD + 'Directory ' + SOURCE_DIR + ' does not exist.' \
'Please, check the SOURCE_DIR in 2safe.config. ' \
'It should point to the place where you have downloaded ' \
'the git repository' + BACK
exit()

try:
subprocess.call(["cp", "-r"] + glob.glob(os.path.join(SOURCE_DIR \
Expand Down Expand Up @@ -238,7 +245,7 @@ def check(strr, fname):
symlink(SOURCE_DIR + "/rulebase/local.re", \
IRODS_CONF_DIR + "/euloc.re", \
IRODS_CONF_DIR + "/euloc.re")

print '3. edit <irods>/server/config/server.config and append '\
',eudat,eurepl,eupids,eucerr,euloc'\
',to reRuleSet (make sure to include the comma and no spaces)'
Expand Down Expand Up @@ -267,7 +274,20 @@ def check(strr, fname):
line1 = line.replace("replication","eurepl")
line1 = line1.replace("pid-service","eupids")
line1 = line1.replace("catchError","eucerr")
line1 = line1.replace(",eudat-authZ-filters","")
line1 = line1.replace("eudat-authZ-filters,","")
line1 = line1.replace(",authZ","")
line1 = line1.replace("authZ,","")
line1 = line1.replace("local","euloc")
line1 = line1.replace(",integritycheck","")
line1 = line1.replace("integritycheck,","")
destination.write(line1)
elif (line.find('euaf') > -1) or \
(line.find('euint') > -1):
line1 = line.replace(",euaf","")
line1 = line1.replace("euaf,","")
line1 = line1.replace(",euint","")
line1 = line1.replace("euint,","")
destination.write(line1)
else:
destination.write(line)
Expand Down Expand Up @@ -521,7 +541,7 @@ def check(strr, fname):
else:
subprocess.call(["mkdir", LOG_DIR])
else:
print RED + BOLD + 'Directory ' + LOG_DIR + ' exists. \n'
print RED + BOLD + 'Directory ' + LOG_DIR + ' exists. \n' + BACK

filename = CONF_DIR + "/log.manager.conf"
try:
Expand Down
89 changes: 51 additions & 38 deletions install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,27 @@ Enable the module

Automatically:

1.1. enable the module in "<irods>/modules/B2SAFE/info.txt"
If a previous version of the module is present, disable it before to install the new one, in "<irods>/
modules/OLD_MODULE/info.txt" (if the directory name is the same, change it)

1.2. rerun the irodssetup script

Manually:

1.1. <irods>/scripts/configure --enable-B2SAFE
If a previous version of the module is present, disable it before to install the new one (if the directory
name is the same, change it):
<irods>/scripts/configure --disable-OLD_MODULE --enable-B2SAFE
1.2. make clean
1.3. make
1.4 <irods>/irodsctl restart
0. download the git repository
from https://github.com/EUDAT-B2SAFE/B2SAFE-core/releases

1. copy source conf dir (/whre_you_have_downloaded/B2SAFE-core/conf)
to the future config directory of the b2safe module
(for irods4: /etc/irods/b2safe-core; for irods3: /home/user/b2safe-core)

2. create a symbolic link to the eudat rulebase
cd <irods>
ln -s <absolute-irods-path>/modules/B2SAFE/rulebase/*.re ./server/config/reConfigs/*.re
for irods3: ln -s /whre_you_have_downloaded/B2SAFE-core/rulebase/*.re <irods>/server/config/reConfigs/*.re
for irods4: ln -s /whre_you_have_downloaded/B2SAFE-core/rulebase/*.re /etc/irods/*.re

replacing the jolly character "*" with each file name available in the directory "rulebase".

3. edit <irods>/server/config/server.config and append to "reRuleSet" the list of ruleset file names written
3. edit <irods>/server/config/server.config (irods3) or /etc/irods/server.config (irods4)
and append to "reRuleSet" the list of ruleset file names written
in a single line and without the suffix".re", in this way ",filename1,filename2,filename3 ..."
(make sure to include the comma and no spaces)

4. configure iRODS hooks.
edit the <irods>/server/config/reConfigs/core.re file and add the following two acPostProcForPutHooks:
edit the <irods>/server/config/reConfigs/core.re (irods3) or /etc/irods/core.re (irods4) file
and add the following two acPostProcForPutHooks:

acPostProcForPut {
ON($objPath like "\*.replicate") {
Expand All @@ -61,30 +54,40 @@ Manually:
}
}

5. properly configure the default resource in <irods>/server/config/reConfigs/core.re
5. properly configure the default resource in <irods>/server/config/reConfigs/core.re (irods3)
or /etc/irods/core.re (irods4)

6.1 install the python scripts
cd <irods>
ln -s <absolute-irods-path>/modules/B2SAFE/cmd/* ./server/bin/cmd/
for irods3: <irods_dir> is usually /home/user/iRODS
for irods4: <irods_dir> is usually /var/lib/irods/iRODS
ln -s /whre_you_have_downloaded/B2SAFE-core/cmd/* <irods_dir>/server/bin/cmd/
check permissions on the scripts and make sure they are executable by the irods user
e.g.chmod u+x cmd/*

6.2 update the "getEpicApiParameters" rule in "./server/config/reConfigs/local.re"
- Configure the credential storage type: "os": stored on the local filesystem or "irods": stored on de irods namespace.
6.2 update the "getEpicApiParameters" rule in "./server/config/reConfigs/euloc.re" (irods3)
or /etc/irods/euloc.re (irods4)
- Configure the credential storage type: "os": stored on the local filesystem
or "irods": stored on de irods namespace.
- Set the path to the credentials file
- set the correct serverID to include the fully qualified hostname. For instance: "irods://node.domain.com:1247"
- Set the proper values in the credentials file (see ./cmd/credentials_example for an example)
6.3 update the "getAuthZParameters" rule in "./server/config/reConfigs/local.re"
- Set the proper values in modules/B2SAFE/cmd/authz.map.json
6.4 update the "getLogParameters" rule in "./server/config/reConfigs/local.re"
- Set the proper values in modules/B2SAFE/cmd/log.manager.conf
- set the correct serverID to include the fully qualified hostname.
For instance: "irods://node.domain.com:1247"
- Set the proper values in the credentials file
(see /whre_you_have_downloaded/B2SAFE-core/cmd/credentials_example for an example)

6.3 update the "getAuthZParameters" rule in "./server/config/reConfigs/euloc.re" (irods3)
or /etc/irods/euloc.re (irods4)
- Set the proper values in <irods>/server/bin/cmd/authz.map.json

6.4 update the "getLogParameters" rule in "./server/config/reConfigs/euloc.re" (irods3)
or /etc/irods/euloc.re (irods4)
- Set the proper values in <irods>/server/bin/cmd/log.manager.conf

7. create a shared space in all zones as configured in the eudat.re rulebase getSharedCollection function.
- defaults to "<zone>/replicate"
- make sure all users involved in the replication can write in this collection.
7. create a shared space in all zones (local and remote), for example: "<zone>/replicate".
Grant all users involved in the replication write access to this collection.

8.0.1 change "#!/usr/bin/env python" in the python scripts in modules/B2SAFE/cmd/ to your python installation
8.0.2 install httplib2, simplejson, lxml, defusedxml, and pylint:

8.0.2 install httplib2, simplejson, lxml, defusedxml, queuelib, and pylint:
httplib2
download from http://code.google.com/p/httplib2
python setup.py install
Expand All @@ -97,15 +100,25 @@ Manually:
pip install defusedxml
apt-get install pylint
yum install pylint

queuelib
download from https://pypi.python.org/pypi/queuelib
python setup.py install

8.1 test the epic api interaction by running the "./cmd/epicclient.py test" script manually and with "iexecmd epicclient.py"
8.2 test the replication by changing and triggering "replicate.r" rule in <irods>/modules/B2SAFE/rules
8.1 test the epic api interaction by running
"./cmd/epicclient.py <os_or_irods> <path_to_credentials> test" script manually
and with "iexecmd epicclient.py"

8.2 test the module by changing and triggering rules in <irods>/modules/B2SAFE/rules
For example, eudatRepl.r to replicate a data set. See the hints inside the rule.

DATACENTER only:

it is necessary to configure the authz.map.json file in order to allow user to execute rules, which calls external scripts (see documentation).
it is necessary to configure the <irods>/server/bin/cmd/authz.map.json file
in order to allow user to execute rules, which calls external scripts (see documentation).

it is necessary to configure the log.manager.conf file in order to enable the logging system (see documentation).
it is necessary to configure the <irods>/server/bin/cmd/log.manager.conf file
in order to enable the logging system (see documentation).

*** Command files ***

Expand Down
8 changes: 5 additions & 3 deletions packaging/create_deb_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ RPM_BUILD_ROOT="${HOME}/debbuild/"
RPM_SOURCE_DIR=$B2SAFEHOME
PRODUCT="irods-eudat-b2safe"
IRODS_PACKAGE_DIR=`grep -i _irodsPackage ${PRODUCT}.spec | head -n 1 | awk '{print $3}'`
# retrieve parameters from spec file. So we only have to update the spec file.
VERSION=`grep -i "^Version:" ${PRODUCT}.spec | awk '{print $2}'`
RELEASE=`grep -i "^Release:" ${PRODUCT}.spec | awk '{print $2}'`
# retrieve parameters from local.re in tree
MAJOR_VERS=`grep "^\s*\*major_version" $B2SAFEHOME/rulebase/local.re | awk -F\" '{print $2}'`
MINOR_VERS=`grep "^\s*\*minor_version" $B2SAFEHOME/rulebase/local.re | awk -F\" '{print $2}'`
VERSION="${MAJOR_VERS}.${MINOR_VERS}"
RELEASE=`grep "^\s*\*sub_version" $B2SAFEHOME/rulebase/local.re | awk -F\" '{print $2}'`
PACKAGE="${PRODUCT}_${VERSION}-${RELEASE}"

if [ "$USERNAME" = "root" ]
Expand Down
11 changes: 10 additions & 1 deletion packaging/create_rpm_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,16 @@ else
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
fi

# find directory where we are executing:
ABSOLUTE_PATH=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)

#extract major_version, minor_version and subversion from local.re in tree
MAJOR_VERS=`grep "^\s*\*major_version" $ABSOLUTE_PATH/../rulebase/local.re | awk -F\" '{print $2}'`
MINOR_VERS=`grep "^\s*\*minor_version" $ABSOLUTE_PATH/../rulebase/local.re | awk -F\" '{print $2}'`
SUB_VERS=`grep "^\s*\*sub_version" $ABSOLUTE_PATH/../rulebase/local.re | awk -F\" '{print $2}'`
VERSION="${MAJOR_VERS}.${MINOR_VERS}"

# build rpm
rpmbuild -ba irods-eudat-b2safe.spec
rpmbuild -ba --define "_version $VERSION" --define "_release $SUB_VERS" irods-eudat-b2safe.spec

# done..
Loading

0 comments on commit 1ecb9e3

Please sign in to comment.