Skip to content
Aldo edited this page Apr 17, 2017 · 5 revisions

LOEP Installation

  1. Previous requirements
    1. Generate SSH keys for GitHub
  2. Installation for development
    1. Required packages
    2. Set up the LOEP instance
    3. Database
    4. Populate the database
    5. Start server

  • A computer with:
    • Ubuntu 14.04 (also works with Ubuntu 12.04)
    • Internet connection

Install ruby2.x and git:

sudo apt-get install git-core
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby2.2

To access to GitHub repositories via git you need to generate public and private keys. If you have already generated SSH keys for Github, you can skip this step.
To generate the ssh keys, you can check the official github guide, or follow the next instructions.

Execute the following command:

ssh-keygen

Accept the default name it proposes and do not introduce password (if you introduce one you will have to introduce it every time you access the repository).

In /home/{your_user}/.ssh there will be two files: id_rsa and id_rsa.pub.
Now you have to add the public key (the one in id_rsa.pub) to your GitHub account.
To do that, go to Settings -> SSH keys -> Add SSH Key in your account, and save your public key.

To check that it has been added correctly execute the following command:

If everything works fine, this command will print a message like "You've successfully authenticated".

 
 

First off, you have to download the source code from git.
Go to your workspace folder and execute the following command to clone the LOEP repository:

git clone [email protected]:agordillo/LOEP.git

 

##Required packages

The following packages should be installed.

sudo apt-get install ruby2.2-dev libxml2-dev libxslt-dev libmysqlclient-dev libsqlite3-dev libpq-dev nodejs

Now enter in the folder LOEP and execute the following commands:

cd LOEP  
gem install bundler  
bundle install

 

##Set up the LOEP instance To start the LOEP application you need to set up the LOEP instance.
First off, you must copy the file /config/application_config.yml.example to config/application_config.yml.

cp config/application_config.yml.example config/application_config.yml

This file will look something like this:

#Copy this file to application_config.yml
#Configure here all the variables of your LOEP instance.

development:
  domain: "localhost:8080"
  mail:
    no_reply_mail: "[email protected]"
    main_mail: "[email protected]"
    # Type can be "SENDMAIL" or "SMTP" (default)
    type: "SMTP"
    #  gmail_credentials:
    #    username: ""
    #    password: ""
  # Your secret key for verifying the integrity of signed cookies.
  # If you change this key, all old signed cookies will become invalid!
  # Make sure the secret is at least 30 characters and all random,
  # no regular words or you'll be exposed to dictionary attacks.
  # This token is also used as secret key for Devise to generate the random tokens.
  # Execute 'bundle exec rake secret' to generate a new secret_token and copy it here
  secret_token: ""
  # Uncomment to enable recaptcha. Get your own keys from https://www.google.com/recaptcha
  # recaptcha:
  #   public_key: ""
  #   private_key: ""
  surveys: "false"
  evmethods: ["LORI v1.5","LOEM","WBLT-S","WBLT-T","Metadata Quality"]
  metrics: ["LORI Arithmetic Mean","LORI WAM CW","LOEM Arithmetic Mean","WBLT-S Arithmetic Mean","WBLT-T Arithmetic Mean","LOM Metadata Quality Metric","LOM Completeness Metadata Quality Metric"]
  allow_external_evaluations: ["WBLT-S","WBLT-T"]
  #Register Policy valid values ["FREE","INVITATION_ONLY","HYBRID"]
  register_policy: "FREE"
  #Default role can be any LOEP role ["User","Reviewer",...]
  default_role: "User"

To set up a LOEP instance for development you just need to fill one option: secret_token.
Execute the command 'bundle exec rake secret' and use the token as the value of the secret_token option.
If you are interested in the different options that can be specified in the application_config.yml file to customize and set up a LOEP instance, you can check the Setting up a LOEP instance section.

 

##Database with MySQL LOEP uses MySQL as database management system.
First off, you should install mysql and the mysql ruby library.

sudo apt-get install mysql-server libdbd-mysql-ruby

Enter in mysql:

mysql -u root -p (it will ask for the root password of the database)

To create the database for development (loep_development) execute the following sentences in the mysql console:

create database loep_development;

If we do not use the root user we will have to give access rights for the user that will access the database. Replacing "user" by your user:

grant all privileges on loep_development.*
to "user"@"localhost"
identified by ""
with grant option;

Exit mysql

quit;

Copy the file /config/database.yml.example to config/database.yml.

cp config/database.yml.example config/database.yml

The config/database.yml file will look like this:

development:
  adapter: mysql2
  database: loep_development
  username: root
  password:
  socket: /var/run/mysqld/mysqld.sock

Now, edit the file to fit your configuration.
Check that the username corresponds to the user that you have configured (either root or your user) and enter the password (if any).

##Set up the database Load the database scheme and apply the database migrations executing the following commands:

bundle exec rake db:schema:load
bundle exec rake db:migrate

##Populate the database

You must execute the following command in order to populate the database with essential data.

bundle exec rake db:populate:install

After this, your local LOEP instance will be ready for development.
The database will be almost empty. It will only store two users: one reviewer called 'demo' and one administrator called 'admin'.
The crendentials for the reviewer will be: email '[email protected]' and password 'demonstration'.
The credentials for the admin user will be: email '[email protected]' and password 'demonstration'.

Optionally, you may populate the database with random data by executing the following command:

 bundle exec rake db:populate:reload

 

##Start local server for development

Start the server executing:

rails s -p 8080

Check that it is working with a web browser (preferably Firefox or Chrome).
Open http://localhost:8080.
Remember that you can log in using the 'demo' user (email '[email protected]' and password 'demonstration') or the 'admin' user (email '[email protected]' and password 'demonstration').