Skip to content

Latest commit

 

History

History
executable file
·
121 lines (110 loc) · 3.61 KB

run-lds-in-development-environment.org

File metadata and controls

executable file
·
121 lines (110 loc) · 3.61 KB

Running Lab Data Service on Developement Environment

Creation of Virtual Environment

  1. clone lab-data-service from github
    git clone http://github.com/vlead/lab-data-service.git
        
  2. Install Virtual Environment
    sudo pip install virtualenv
        
  3. Create Virtual Environment in the lab-data-service directory
    cd lab-data-service
    git checkout develop
    virtualenv venv
        
  4. Activate the Virtual Environment
    source venv/bin/activate
        

Setting up dependencies

  1. Run make file in lab-data-service.
    make
        

    Note: Test cases will fail at this point because there are no dependencies installed. Proceed to next step to install dependencies.

  2. Install mysql and apache2 if not already installed on your machine otherwise skip this step.
    sudo apt-get install mysql-server
    sudo apt-get install apache2
        
  3. Install all the dependencies for running the lds applciation. run the setup.py file, available at build/code/deployment/.
    cd build/code/deployment/
    python setup.py install
        

    Note : If you found error something like error:Couldn't find a setup script in/tmp/easy_install-oTRjpD/oursql-0.9.3.2.linux-i686.tar.gz please execute below steps otherwise skip

    sudo apt-get install libmysqlclient-dev python-dev
    mkdir oursql
    cd oursql
    wget https://pypi.python.org/packages/8c/88/9f53a314a2af6f56c0a1249c5673ee384b85dc791bac5c1228772ced3502/oursql-0.9.3.2.tar.gz#md5=ade5959a6571b1626966d47f3ab2d315
    tar xvf oursql-0.9.3.2.tar.gz
    cd oursql-0.9.3.2
    python setup.py install
        

Set SQLALCHEMY_DATABASE_URI

The variable SQLALCHEMY_DATABASE_URI has to be set to value in build/code/runtime/config/flask_app_config.py so that the application can use the database.

SQLALCHEMY_DATABASE_URI = 'mysql+oursql://root:<password>@localhost/lds'

Creation of database

  1. Login to mysql
    mysql -u <username> -p<password>
        
  2. Show all databases
    show databases;
        
  3. Drop database lds if already present. Otherwise skip this step
    drop database lds;
        
  4. Create database lds.
    create database lds;
        
  5. Exit out of the mysql console
    ctrl+c
        
  6. Get the latest mysql dump file from the files server. http://files.vlabs.ac.in/lds
    wget http://files.vlabs.ac.in/lds/<lds-latest-dump-19-12-2017>.sql
        
  7. Restore Dump in Database
mysql -u root -p<db-password> <db-name> < <dumpfile.sql>

Run the application

The application can now be run from the build/code/runtime/rest/ directory

cd build/code/
export PYTHONPATH=$(pwd)
cd runtime/rest/
python app.py

Access the application

The application is accessed at http://localhost:5000

API Documentation

URL : REST APIS