An open API service indexing awesome lists of open source software.

https://github.com/mskcc/igo-sample-qc-backend


https://github.com/mskcc/igo-sample-qc-backend

Last synced: 5 days ago
JSON representation

Awesome Lists containing this project

README

          

# Sample QC Backend

## Deploying on a server

Clone the repository to a path under your local folder.
Pull the changes you wish to deploy.
Move them over to the corresponding file under `/srv/www/sample-qc/sample-qc-backend/` and then restart uwsgi with
```
dzdo systemctl restart uwsgi
```

Sample QC backend runs on Python. You will have to follow this set up if it's your first time running this project locally.

## Basic Setup Instructions

**Install python3 and pip3**

```
$ brew install python
```
```
$ brew install pip3
```

**Get mySQL running on your machine**

```
$ brew install mysql
```
You'll then need to start your mySQL server (this will keep it running in the background on your machine)

```
$ brew services start mysql
```
First time downloads, you'll want to securely set up the mySQL server by running

```
$ mysql_secure_installation
```
Follow the prompts and set up your root password

At this point, you can connect to your mySQL server with the following command

```
$ mysql -u root -p
```
NOTE: you can also use mySQL Workbench for a UI to manipulate your db

**Set up your Virtual Environment**

```
$ pip3 install virtualenv
```
Make sure you `cd` into `igo-sample-qc-backend` in your terminal, then run the following cmd to setup the VE locally

```
$ virtualenv venv
```
Activate the venv

```
$ source venv/bin/activate
```
You should now see `(venv)` appear at the beginning of your terminal prompt indicating that you are working inside the virtualenv

Check out [this setup walk through](https://sourabhbajaj.com/mac-setup/Python/virtualenv.html) for additional steps/options

**Set up config file**

Create a new file at root level of this project called `secret_config.py`

To get fields needed for this config, consult a fellow dev :) but the most important field needed in this config is a `SQLALCHEMY_DATABASE_URI` field that matches a user in your local mySQL instance.

Example field:

```
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://sample_qc_dev_user1:napkinWatermelon1Dev!@localhost:3306/dev_sample_qc"
```

How to create mySQL users and grant privileges (do this within `mysql>` server):
```
# CREATE USER 'sample_qc_dev_user'@'localhost' IDENTIFIED BY 'napkinWatermelon1Dev!';
# GRANT ALL PRIVILEGES ON dev_sample_qc.* TO 'sample_qc_dev_user'@'localhost';
```

[Look here for more info on how you can add/remove users from your MySQL server](https://sebhastian.com/mysql-error-1396/)

**Install project packages**

(this is usually only for the first run)

```
$ pip3 install -r requirements.txt
```

**Start the python server**

```
$ python3 run.py
```
NOTE: You might run into an error that `uwsgi` is not defined. To run locally, you might have to comment out all references to `uwsgi` in the `qc_report.py` file