b8399215c96a9547b26cbb70963cb7b5b9e3e78d
[pharos.git] / tools / pharos-dashboard / deploy.org
1 * Database
2
3 ** Setup
4 -   sudo -u postgres psql
5 -   postgres=# CREATE DATABASE pharos_dashboard
6 -   postgres=# CREATE USER opnfv WITH PASSWORD 'opnfvopnfv'
7 -   postgres# createuser --interactive
8 -   postgres# ALTER ROLE opnfv SET client_encoding TO 'utf8';
9 -   postgres# ALTER ROLE opnfv SET default_transaction_isolation TO 'read committed';
10 -   postgres# ALTER ROLE opnfv SET timezone TO 'UTC';
11 -   postgres# GRANT ALL PRIVILEGES ON DATABASE pharos_dashboard TO opnfv;
12
13 ** Dump data
14
15 -   log out all users, stop server
16 -   (venv) # python manage.py dumpdata > dashboard/fixtures/<dump_name>.json
17
18 ** Load dump
19
20 -   setup clean database, run migrate
21 -   (venv) # python manage.py loaddata <dump_name>
22
23 * Django
24
25 ** Virtualenv setup
26
27 -   # virtualenv venv
28 -   # source venv/bin/activate
29 -   (venv) # pip install -r requirements.txt
30
31 ** initializing or after change in models.py
32
33 -   (venv) # python manage.py makemigrations
34 -   (venv) # python manage.py migrate
35
36 ** Development
37
38 -   (venv) # python manage.py runserver
39 -   (venv) # python manage.py shell  
40
41 * Dependencies
42
43 Javascript / CSS dependencies are managed with bower. To install them, you have to install bower, switch directory to the dashboard/static folder and run 
44 # bower install
45 Bower will download and install the right versions of all the static files.