summaryrefslogtreecommitdiff
path: root/_posts/2012-08-09-install-opentox-development-environment.md
blob: 27d87258655e83af84645234426e9c9551a98142 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
---
layout: post
title: "Install opentox development environment"
description: ""
category: Installation
tags: [Deployment, Ubuntu, Debian, Setup]
---
{% include JB/setup %}

Architecture overview and how to install recent opentox services on Ubuntu or Debian.

# Philosophy

The [opentox installer](https://github.com/opentox/install/tree/development) provides a [POSIX](http://en.wikipedia.org/wiki/POSIX) compatible way to prepare Debian-based systems and install ISTs OpenTox compatible web-services and library code. Please report bugs [here](http://github.com/opentox/install).

Apart from some basic Debian packages, no action requires root access. Everything is installed in the user's home directory. Inside it, the installer prepares the base directory (referred to as `OT_PREFIX`) for OpenTox REST services and provides libraries for the installation and shell integration of services. 

Here are some more goals we had in mind when writing the installer:

- Safe (existence of all binaries will be checked before running, apart from GNU Core Utils)
- Idempotent (multiple execution incurs no changes to the system)
- Atomic (return value of non-elementary actions asserted to be TRUE)
- Encapsulated (everything installed in `OT_PREFIX`)
- Logged (all non-elementary actions are logged)

Conceptual approach:

1. Configure the installer in config.sh, then run `install`. 
2. Configure the system by adding a line to the startup file of your favorite shell (e.g. BASH with the file `~/.bashrc`) to read in `~/.opentox/opentox-ui.sh` (e.g. with `source ~/.opentox/opentox-ui.sh`), so any newly started shell will be configured. 
3. Use the system, in particular by starting webservices (see below). For BASH users, a set of tools (ot-tools) is available.
4. To uninstall, simply remove the line from the startup file. To save disc space also remove directory `OT_PREFIX` (not recommended). To remove also the configuration, remove `~/.opentox` (not recommended).

<br>
<br>
<hr>
<br>
<br>

# Installation

Installation (`development` at the point of writing this = 08/2012) tested with Debian 6.0.5 and Ubuntu 11.04. Installer available at [github](https://github.com/opentox/install).

Check you can run "sudo" commands (e.g. `sudo ls`), which is required for base packages. Install git:

    # Install git
    sudo apt-get install git 

Add your public key at `https://github.com`. Download, configure and execute the installer:

    git clone git@github.com:opentox/install.git $HOME/install
    cd $HOME/install
    git checkout development
    # First check config.sh with your favorite editor
    ./install silent

This will prepare the system for opentox web services, including dependencies. 

# Install OpenTox services

Load environment (general):

    . $HOME/.opentox/config/install/config.sh
    . $OT_PREFIX/install/utils.sh
    
Load environment (with BASH):

    . $HOME/.opentox/ot-tools.sh
    otconfig

Download and install opentox-client and opentox-server:
    
    for f in opentox-client opentox-server; do 
      git clone "git@github.com:opentox/$f.git" $OT_PREFIX/$f
      cd $OT_PREFIX/$f
      git checkout development 2>/dev/null
    done 
    cd $OT_PREFIX/opentox-client/bin 
    ./opentox-client-install silent
    cd $OT_PREFIX/opentox-server/bin
    ./opentox-server-install silent

Download and install services and tests:

    for f in algorithm compound dataset feature model validation task opentox-test; do
      git clone "git@github.com:opentox/$f.git" $OT_PREFIX/$f
      cd $OT_PREFIX/$f
      git checkout development 2>/dev/null
      if [ -f $OT_PREFIX/$f/bin/$f-install ]; then
        cd $OT_PREFIX/$f/bin
        ./$f-install silent
      fi
    done
    notify

OpenTox compatible web services are now installed and configured.   
    

# Activate and use ot-tools for BASH 

NOTE: ot-tools require BASH.

Add ot-tools to your `.bashrc`:

    echo '. $HOME/.opentox/ot-tools.sh' >> ~/.bashrc
    # source .bashrc or restart shell

All ot-tools (`otconfig`, `otstart`, `otcheck`, `otreload`, `otkill`) are available in your shell. General usage: 

    [otstart|otcheck|otreload|otkill] [all|algorithm|compound|dataset|feature|
    model|task|validation|4store]

`otconfig` is the only command not taking an argument. It sets the environment variables for all services. 

Start all services and the 4store backend with:

    otstart all 

Kill all services and the 4store backend with:
    
    otkill all

It is possible to manage single services (e.g. `otstart dataset` to run dataset web service). 

# Access web services

The default port setting for the web services and the 4store backend,  (see config files `~/.opentox/config/*.rb`):

| Service | URI | 
| ------ | ------ |
| --------------------  | ------------------------------------- |
| Algorithm | localhost:8081/algorithm | 
| Compound | localhost:8082/compound |
| Dataset | localhost:8083/dataset |
| Feature | localhost:8084/feature |
| Model | localhost:8085/model |
| Task | localhost:8086/task |
| Validation | localhost:8087/validation |
| 4store | localhost:9088/ |

NOTE: Only installed service URIs are set in the config files. Model and validation service are not available yet. 

# Testing services

    cd $OT_PREFIX/opentox-test
    otconfig
    ruby opentox-client.rb
    ruby test/dataset-large.rb


The tests take some time and finish with a short report:

    Finished tests in 44.690815s, 0.9622 tests/s, 4.4528 assertions/s.
    43 tests, 199 assertions, 1 failures, 0 errors, 0 skips

To test one specific service, run its script (`ruby [service_name].rb`) in `$OT_PREFIX/opentox-test/test`.