This repository contains resources for John Jacquay's iRODS UGM 2017 talk/demo. The following instructions are for building and testing the Golang microservice demo.
Two microservices are included: msiextract_image_metadata
and msibasic_example
.
msiextract_image_metadata
extracts metadata information from image files using Google's Cloud Vision API and a Golang EXIF package.
msibasic_example
accepts a two column CSV string as the first argument, and returns an output KeyValPair_MS_T
data structure in the second argument.
$ git clone https://github.com/jjacquay712/irods-ugm-2017.git
$ cd irods-ugm-2017
$ vagrant up && vagrant ssh
$ sudo service irods start
$ sudo sh -c 'curl https://gist.githubusercontent.com/jjacquay712/f8e07a73e7e59ae03125f5d5a300821a/raw/c2506a5e267e6ca8f32dda1c960c316dcd310954/gistfile1.txt > /etc/irods/iRODS-UGM-Demo.json'
Note: You can also use your own Google Cloud Platform Service Account key. Simply save to /etc/irods/iRODS-UGM-Demo.json
.
- Install iRODS 4.2.1 and dependencies (In my case, CentOS 7)
$ sudo rpm --import https://packages.irods.org/irods-signing-key.asc
$ wget -qO - https://packages.irods.org/renci-irods.yum.repo | sudo tee /etc/yum.repos.d/renci-irods.yum.repo
$ yum install irods-externals* irods-runtime irods-devel
-
Fetch project files
$ git clone https://github.com/jjacquay712/irods-ugm-2017.git
- Setup $PATH
$ export PATH=$PATH:/opt/irods-externals/cmake3.5.2-0/bin
$ export PATH=$PATH:/opt/irods-externals/clang3.8-0/bin
- Build and install
$ cd irods-ugm-2017/go-microservice
$ mkdir build && cd build
$ cmake .. && make
$ sudo make install
- Create Google Cloud Platform Service Account
Save to private key to /etc/irods/iRODS-UGM-Demo.json
- You're all set!
- Edit iRODS
core.re
$ sudo vi /etc/irods/core.re
- Add the following contents to
core.re
file (if you chose manual install, not required for Vagrant):
acPostProcForPut {
# Second parameter enables/disables gzip compression
msiextract_image_metadata($objPath, 0);
}
- Run
iput
on image file from rootirods-ugm-2017/
repo directory:
$ iput gopher.jpg
List Metadata:
$ imeta ls -d gopher.jpg
Or if you used the Vagrant install or enabled gz compression:
$ imeta ls -d gopher.jpg.gz
Output:
AVUs defined for dataObj gopher.jpg:
attribute: tags_english
value: mammal,vertebrate,squirrel,wildlife,fauna,whiskers,prairie dog,marmot,rodent,fox squirrel
units:
----
attribute: tags_dutch
value: zoogdier,gewerveld,eekhoorn,dieren in het wild,fauna,bakkebaarden,prairiehond,marmot,knaagdier,Vos eekhoorn
units:
- Run
irule -F go-microservice/msibasic_example/test.r
from rootirods-ugm-2017/
repo directory.
test.r:
TestBasicExample {
msibasic_example("keytest,valuetest", *outKVP);
msiPrintKeyValPair("stderr", *outKVP)
}
INPUT null
OUTPUT ruleExecOut
Output:
keytest = valuetest
From irods-ugm-2017/
root repo directory:
$ go-microservice/run_tests.sh
Output:
=== RUN TestBasicExample
--- PASS: TestBasicExample (0.00s)
msibasic_example_test.go:19: Success!
PASS
ok command-line-arguments 0.023s