Newer
Older
Jonathan Seguin
committed
R: https://gitlab.iric.ca/bioinfo_iric/riricdata
Python: https://gitlab.iric.ca/bioinfo_iric/pyiricdata
## Dependencies
- Python (> 3.6)
- PostgreSQL (> 9.4)
- Node (> 6.12)
## New DEV installation
```bash
# Clone repo and install pypi packages
cd <somewhere>
git clone git@gitlab.iric.ca:bioinfo_iric/iric-data.git
# Create a virtenv, py3
module add python/3.6.7
python -m venv .venv
# Activate venv
source .venv/bin/activate
pip install --upgrade pip # update pip version to latest
pip install -r requirements.txt
# Install node modules
module add node
npm install
# run default gulp job to generate CSS/JS resources
gulp
# NB: gulp will keep running in "listening" mode, so open a new shell to keep going
Jean-Philippe Laverdure
committed
## (login to postgresql server)
CREATE USER iric_data_user WITH PASSWORD 's0me_new_p4ssword';
CREATE DATABASE iric_data_dev;
GRANT ALL PRIVILEGES ON DATABASE iric_data_dev TO iric_data_user;
Jean-Philippe Laverdure
committed
Jean-Philippe Laverdure
committed
## Project requires the hstore extension be activated on the project's database
### Need to be admin on postgresql
\c iric_data_dev
# update .env to local settings
cp .env.example .env
# Make edits to .env file (including db user passwd !)
# If you need to drop the DB tables
# login postgreSQL server and connect to db
DROP OWNED BY iric_data_user;
python manage.py migrate
python manage.py populate_iric
## If NOT initial deploy (safe to run if no migrations exist)
# Add initial (super) user
python manage.py createsuperuser
# Run without SSL
python manage.py runserver
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
```
## Deploy
```bash
git pull origin master
gulp prod
source .venv/bin/activate
python manage.py collectstatic
python manage.py migrate portal
touch iric_data/wsgi.py
```
## Initial Deploy
```bash
# as adsoft, setup environment
sudo yum remove mod_wsgi
sudo yum install python34-devel
sudo pip3 install mod_wsgi
sudo mod_wsgi-express install-module
sudoedit /etc/httpd/conf.d/aa.conf
cd /var/www/private
git clone git@gitlab.iric.ca:bioinfo_iric/iric-data.git
cd
python3 -m venv .venv_local
source /var/www/private/iric-data/.venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
module add node
npm install
gulp prod
cp .env.example .env
# edit .env file
python manage.py migrate
sudo systemctl restart httpd
```
## Translations
Make sure your virtual environment is active
```bash
django-admin makemessages -l fr
emacs portal/locale/fr/LC_MESSAGES/django.po # (or install gettext extension of choice)
Jean-Philippe Laverdure
committed
[Django documentation](https://docs.djangoproject.com/en/2.2/ref/django-admin/#migrate)
python manage.py migrate portal [migration_name]
Jean-Philippe Laverdure
committed
If migration_name is omitted, **ALL** migrations will be applied.
Specify a migration_name to apply migrations **up to that one and no further**.
This can be used to un-apply a migration.
Jonathan Seguin
committed
## API Endpoints
Jonathan Seguin
committed
Returns list of datafiles based on dataset id, key and/or values present in annotation :
- api/v1/datafiles/list/json/lookup-key/str:key/
- api/v1/datafiles/list/json/lookup-key/str:key/str:dataset/
- api/v1/datafiles/list/json/lookup-value/str:value/
- api/v1/datafiles/list/json/lookup-value/str:value/str:dataset/
Jonathan Seguin
committed
- api/v1/datafiles/list/json/lookup-key-value/str:key/str:value/
- api/v1/datafiles/list/json/lookup-key-value/str:key/str:value/str:dataset
- api/v1/datafiles/list/json/lookup-dataset/str:dataset
Jonathan Seguin
committed
Returns annotation for given datafile :
- api/v1/datafiles/json/annotation/int:pk
- api/v1/datafiles/json/annotation/slug:iric_data_id
Jonathan Seguin
committed
Returns metadata for given datafile :
- api/v1/datafiles/json/metadata/int:pk
- api/v1/datafiles/json/metadata/slug:iric_data_id
Jonathan Seguin
committed
Returns list of datasets :
- api/v1/admin/str:sim/datasets/list/json/
- api/v1/my-datasets/list/json/
Jean-Philippe Laverdure
committed
[Private Storage](https://pypi.org/project/django-private-storage/)
[PostgreSQL HStore](https://docs.djangoproject.com/en/2.2/ref/contrib/postgres/fields/#hstorefield)