- clone
lab-data-service
from githubgit clone http://github.com/vlead/lab-data-service.git
- Install Virtual Environment
sudo pip install virtualenv
- Create Virtual Environment in the
lab-data-service
directorycd lab-data-service git checkout develop virtualenv venv
- Activate the Virtual Environment
source venv/bin/activate
- Run
make
file inlab-data-service
.make
Note: Test cases will fail at this point because there are no dependencies installed. Proceed to next step to install dependencies.
- Install
mysql
andapache2
if not already installed on your machine otherwise skip this step.sudo apt-get install mysql-server sudo apt-get install apache2
- Install all the dependencies for running the
lds
applciation. run thesetup.py
file, available atbuild/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 skipsudo 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
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'
- Login to mysql
mysql -u <username> -p<password>
- Show all databases
show databases;
- Drop database
lds
if already present. Otherwise skip this stepdrop database lds;
- Create database
lds
.create database lds;
- Exit out of the mysql console
ctrl+c
- 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
- Restore Dump in Database
mysql -u root -p<db-password> <db-name> < <dumpfile.sql>
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
The application is accessed at http://localhost:5000
URL : REST APIS