juigilkishore / butterfly

health monitor
0 stars 1 forks source link

Butterfly

Download

git clone git@github.com:juigilkishore/butterfly.git
cd butterfly

Install Dependencies

sudo apt-get install python-virtualenv $(cat dependencies.txt)
virtualenv butterfly-env
source butterfly-env/bin/activate
pip install -r requirements.txt

Database creation

For MySQL database

mysql -uroot -p
mysql> CREATE DATABASE butterfly;
mysql> GRANT ALL PRIVILEGES ON butterfly.* TO 'butterflyuser'@'localhost' IDENTIFIED BY 'butterflypass';
mysql> GRANT ALL PRIVILEGES ON butterfly.* TO 'butterflyuser'@'%' IDENTIFIED BY 'butterflypass';

mysql -ubutterflyuser -p
mysql> USE butterfly;

For SQLite database

touch butterfly.db

Edit Configuration

Edit "connection" key in "Database" section in the etc/butterfly.conf configuration file

For MySQL database

connection=mysql+mysqldb://<butterflyuser>:<butterflypass>@localhost/<butterfly-db-name>

For SQLite database

connection=sqlite:///butterfly.db

Database initialize

Create all the tables and populate with initial values

source butterfly-env/bin/activate
python butterfly.py --action db_init --config etc/butterfly.conf

Database delete

Drop all the tables

source butterfly-env/bin/activate
python butterfly.py --action db_drop --config etc/butterfly.conf

Run service

Run the butterfly service

source butterfly-env/bin/activate
python butterfly.py --action run --config etc/butterfly.conf

API list

User APIs
  1. GET /user Retrieves all user details
  2. GET /user/ Retrieves user 's details
  3. POST /user Creates a user
  4. PUT /user/ Edits user 's details
  5. DELETE /user/ Delete user
Lesson APIs
  1. GET /lesson Retrieves all lesson details
  2. GET /lesson/ Retrieves lesson 's details
  3. POST /lesson Creates a lesson
  4. PUT /lesson/ Edits lesson 's details
  5. DELETE /lesson/ Delete lesson
Goal APIs
  1. GET /goal Retrieves all goal details
  2. GET /goal/ Retrieves goal 's details
  3. POST /goal Creates a goal
  4. PUT /goal/ Edits goal 's details
  5. DELETE /goal/ Delete goal
Lesson Activity APIs
  1. GET /user//activity/lesson Retrieves all lesson activity details of
  2. GET /user//activity/lesson/ Retrieves lesson activity of 's details for
  3. POST /user//activity/lesson Creates a lesson activity for
  4. PUT /user//activity/lesson/ Edits lesson activity 's details for
  5. DELETE /user//activity/lesson/ Delete lesson activity 's details for
Goal Activity APIs
  1. GET /user//activity/goal Retrieves all goal activity details of
  2. GET /user//activity/goal/ Retrieves goal activity of 's details for
  3. POST /user//activity/goal Creates a goal activity for
  4. PUT /user//activity/goal/ Edits goal activity 's details for
  5. DELETE /user//activity/goal/ Delete goal activity 's details for