Skip to content
yeban edited this page Nov 13, 2014 · 62 revisions

Setup (using docker - experimental)

Install docker. Then:

cd afra
facebook_app_id=<value> facebook_app_secret=<value> docker build -t yeban/afra .
docker run -t -i -p 9292:9292 afra

Setup (without docker)

Ruby 2.0

ruby-install, chruby and chgems is prescribed so as to facilitate troubleshooting potential issue with Ruby setup. You can use rbenv, etc. as well.

Ruby 2.x ships with RubyGems 2.x and Rake 10.x which are required to setup and run Afra. If you install Ruby from your package manager, you may have to install RubyGems and Rake separately.

# install ruby-install (https://github.com/postmodern/ruby-install).
$ cd
$ wget -O ruby-install-0.3.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.3.0.tar.gz
$ tar xvf ruby-install-0.3.0.tar.gz
$ cd ruby-install-0.3.0/
$ sudo make install

# install Ruby 2.0
$ sudo ruby-install ruby

# install chruby (https://github.com/postmodern/chruby)
$ cd
$ wget -O chruby-0.3.7.tar.gz https://github.com/postmodern/chruby/archive/v0.3.7.tar.gz
$ tar xvf chruby-0.3.7.tar.gz
$ cd chruby-0.3.7/
$ sudo make install

# install chgems (https://github.com/postmodern/chgems)
$ cd
$ wget -O chgems-0.3.2.tar.gz https://github.com/postmodern/chgems/archive/v0.3.2.tar.gz
$ tar xvf chgems-0.3.2.tar.gz
$ cd chgems-0.3.2/
$ sudo make install

Perl 5

Should be pre-installed on your system.

Node 0.11.11

n is prescribed to facilitate troubleshooting possible issues with Node setup. You can use nvm, etc.

Recent releases of Node ships with npm which is required to setup and run Afra. If you install Node from your package manager, you may have to install npm separately.

$ wget -c https://github.com/visionmedia/n/archive/1.2.1.tar.gz
$ tar xvf 1.2.1.tar.gz
$ cd n-1.2.1
$ sudo make install
$ sudo n latest

Postgres 9.3

Mac

$ brew install postgresql

You may have to separately install libpqxx.

$ brew install libpqxx

Then,

$ createdb `whoami`

Linux (Debian)

$ sudo aptitude install postgresql-9.3
$ sudo -u postgres createuser --interactive # when asked, make role superuser
$ sudo -u postgres createdb <name of the role used in previous step>

Afra

$ git clone https://github.com/yeban/afra.git
$ cd afra

# install dependencies and configure Afra
$ rake

# import test data
$ rake import\[data/annotations/Solenopsis_invicta/Si_gnF.gff\]

# launch Afra server
$ rake serve

Open http://localhost:9292 in your browser and start curating!

Production

Using reverse proxy setup on http://afra.sbcs.qmul.ac.uk with Nginx as the frontend server.

# nginx.conf
# [...]
http {
    sendfile on;

    server {
        listen       80;
        server_name  localhost;

        location @afra {
                proxy_redirect off;
                proxy_read_timeout 180;
                proxy_intercept_errors on;
                proxy_set_header   X-Forwarded-Host $host;
                proxy_set_header   X-Sendfile-Type     X-Accel-Redirect;
                proxy_set_header   X-Accel-Mapping     /Users/priyam/src/afra/data/jbrowse/=/files/jbrowse/;
                proxy_pass http://localhost:9292;
        }

        location /files/jbrowse/ {
          internal;
          alias /Users/priyam/src/afra/data/jbrowse/;
        }

        location / {
            root   /Users/priyam/src/afra/www;
            index  index.html;
            try_files $uri $uri/ @afra;
        }
    }
}
# afra.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>KeepAlive</key>
        <true/>
        <key>Label</key>
        <string>uk.ac.qmul.sbcs.afra</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/bin/chruby-exec</string>
                <string>2.1.0</string>
                <string>--</string>
                <string>bundle</string>
                <string>exec</string>
                <string>rake</string>
                <string>serve</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>UserName</key>
        <string>priyam</string>
        <key>WorkingDirectory</key>
        <string>/Users/priyam/src/afra</string>
</dict>
</plist>
Clone this wiki locally