README.md 2.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
FIBRE Portal
================

FIBRE portal repository.

https://fibre.org.br


Dependencies
===============
11

12 13 14 15 16
### Redis
```
docker run --name fibre-redis -d -p 6379:6379 redis
```

17
Postgresql
18

19
Python3
20

21
Python3 pip
22

23
Django 1.10.2
24

25
Django recaptcha
26

27 28 29 30 31
psycopg2

Installation guide
================

32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
## Python environment 
[Virtual Environments](http://docs.python-guide.org/en/latest/dev/virtualenvs/)

Install virtualenv via pip:
```
$ pip install virtualenv
```

Active venv:
```
$ cd fibre-terminal
$ virtualenv venv
$ source venv/bin/activate
```

Install dependencies
```
pip install -r requirements.txt
```

## Project

Migrate:
```
python manage.py migrate
```

Run server:
```
python manage.py runserver 8000
```

64 65
- Install OS dependencies

66
```
67
sudo apt-get update
68
sudo apt-get install -y python3 python3-pip python3-venv python3-openssl python-psycopg2 libxml2-dev libxslt1-dev python3-lxml postgresql postgresql-server-dev-9.4 libffi-dev libxmlsec1-dev git vim
69
```
70 71 72

- Clone the Portal repo:

73
```
74 75
git config --global http.sslverify false
git clone https://git.rnp.br/fibre/portal-interface.git
76
```
77 78 79

- Create virtual environment

80
```
81 82
pyvenv venv
python3 -m venv venv
83
```
84 85 86 87


- Activate virtual environment

88
```
89
source venv/bin/activate
90
```
91 92 93

- Install python dependencies

94
```
95 96
pip3 install Django==1.10.2
pip3 install django-recaptcha2
Phelipe Alves's avatar
Phelipe Alves committed
97
pip install django-bootstrap3
98 99 100
pip3 install psycopg2
pip3 install sqlalchemy
pip3 install cryptography
Tiago Salmito's avatar
Tiago Salmito committed
101
pip3 install httplib2
102
pip3 install xmlsec
Phelipe Alves's avatar
Phelipe Alves committed
103
pip3 install networkx
104
pip3 install psycopg2-binary
Danielle Caled's avatar
Danielle Caled committed
105

106 107
pip3 install urllib3
aptitude -V install python3-urllib3/jessie-backports
Tiago Salmito's avatar
Tiago Salmito committed
108 109
```

110
- Run server
Tiago Salmito's avatar
Tiago Salmito committed
111 112

```
113
screen -S portal-interface python3 manage.py runserver 8080
114
```
115 116 117

- Install nginx for localhost proxy

118
```
119 120 121
apt-get install nginx
sudo ln -s nginx/portal.conf /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
122 123 124 125 126 127 128 129 130
```

- Database configuration

```
sudo -u postgres psql template1 -c "CREATE USER portaladmin WITH PASSWORD 'portal' CREATEDB;"
sudo -u postgres psql -c "CREATE DATABASE portaldb;"
sudo -u postgres psql portaldb -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO portaladmin;"
python3 manage.py migrate
131
```