-
Notifications
You must be signed in to change notification settings - Fork 1
/
comandos.txt
executable file
·226 lines (158 loc) · 6.34 KB
/
comandos.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
apt-get update
sudo apt-get install python-pip python-dev ssh git
cd ~
mkdir -p www/Django/RecomendadorUD/source/
mkdir -p www/Django/RecomendadorUD/dev/
mkdir -p www/Django/RecomendadorUD/prod/
cd www/Django/RecomendadorUD/
#pip install virtualenv
#virtualenv env
#source env/bin/activate
cd source/
git clone https://github.com/camilortte/RecomendadorUD.git .
git clone --depth=1 https://github.com/camilortte/RecomendadorUD.git .
cd ..
sudo apt-get install redis-server redis-tools python-numpy python-nose python-matplotlib ipython ipython-notebook python-pandas python-sympy liblapack-dev libatlas-dev gfortran sqlite spatialite-bin python-scipy
sudo apt-get install build-dep libproj-dev libspatialite-dev libspatialite5 spatialite-bin python-pysqlite2 gdal-bin binutils libpq-dev
cd www/Django/RecomendadorUD/source/
pip install -r requeriments.txt
sudo pip install csc-pysparse networkx divisi2
sudo easy_install scipy
sudo pip install psycopg2
cd ~/www/Django/RecomendadorUD/
mkdir libs
cd libs
git clone https://github.com/ocelma/python-recsys.git pyrecsys
cd pyrecsys
sudo python setup.py install
sudo pip install yamjam
mkdir ~/.yamjam
touch ~/.yamjam/config.yaml
chmod -R go-rwx ~/.yamjam
nano ~/.yamjam/config.yaml
##EN EL ARCHIVO
RecomendadorUD:
POSTGRESDATABASE_USER: acces_django
POSTGRESDATABASE_PASSWORD: acces_django_pass
SECRET_KEY: oo*-tbab-(tdkyvo6bdc9=ir+75@#@bio^5w$17p9%l$qfdd55
MANDRILL_API_KEY: dF6LAeaL1H2ZGsbU-Ypu6Q
cd ..
export POSTGRESDATABASE_USER='acces_django'
export POSTGRESDATABASE_PASSWORD='acces_django_pass'
export SECRET_KEY='oo*-tbab-(tdkyvo6bdc9=ir+75@#@bio^5w$17p9%l$qfdd55'
export MANDRILL_API_KEY='dF6LAeaL1H2ZGsbU-Ypu6Q'
cd ~
cd www/Django/RecomendadorUD/dev/
spatialite spatial_db.db "SELECT InitSpatialMetaData();"
sudo apt-get install postgresql postgresql-contrib postgis postgresql-9.3-postgis-2.1
###Por si pasa lo de No PostgreSQL clusters exist; see "man pg_createcluster
http://solutions4linux.blogspot.com/2014/09/solving-no-postgresql-clusters-exist.html
sudo -i -u postgres
createdb recomendadorUD_database
psql
ALTER USER postgres PASSWORD 'RecomendadorUD';
\q
psql recomendadorUD_database
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
\q
createuser --interactive
acces_django
n
n
n
psql
ALTER USER acces_django PASSWORD 'acces_django_pass';
\q
psql recomendadorUD_database
GRANT ALL PRIVILEGES ON DATABASE "recomendadorUD_database" to acces_django;
\q
psql recomendadorUD_database -c "GRANT ALL ON ALL TABLES IN SCHEMA public to acces_django;"
psql recomendadorUD_database -c "GRANT ALL ON ALL SEQUENCES IN SCHEMA public to acces_django;"
psql recomendadorUD_database -c "GRANT ALL ON ALL FUNCTIONS IN SCHEMA public to acces_django;"
exit
./init
sudo apt-get install nginx
cd /etc/nginx/sites-enabled/
server {
listen 8000;
server_name RecomendadorUD;
access_log off;
location /static/ {
alias /home/recomendadorud/www/Django/RecomendadorUD/source/static/;
}
location /media/ {
autoindex on;
alias /home/recomendadorud/www/Django/RecomendadorUD/prod/media/;
}
location / {
proxy_pass http://127.0.0.1:8001;
#proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 10;
proxy_read_timeout 10;
client_max_body_size 11M;
}
# Compression
gzip on;
gzip_http_version 1.0;
gzip_comp_level 5;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Some version of IE 6 don't handle compression well on some mime-types,
# so just disable for them
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Set a vary header so downstream proxies don't send cached gzipped
# content to IE6
gzip_vary on;
charset utf-8;
#logs
#access_log ~/logs/access.log;
#error_log ~/logs/error.log;
}
mkdir -p ~/logs
touch ~/logs/access.log
touch ~/logs/error.log
sudo service nginx restart
export POSTGRESDATABASE_USER='acces_django'
export POSTGRESDATABASE_PASSWORD='acces_django_pass'
export SECRET_KEY='oo*-tbab-(tdkyvo6bdc9=ir+75@#@bio^5w$17p9%l$qfdd55'
export MANDRILL_API_KEY='dF6LAeaL1H2ZGsbU-Ypu6Q'
gunicorn RecomendadorUD.wsgi:application --bind=127.0.0.1:8001
sudo aptitude install supervisor
sudo nano /etc/supervisor/conf.d/recomendadorud.conf
cd ~/www/Django/RecomendadorUD/
touch log_supervisor.log
sudo supervisorctl reread
sudo supervisorctl update
[program:RecomendadorUD]
command = gunicorn RecomendadorUD.wsgi:application --bind=127.0.0.1:8001 ; Command to start app
directory= /home/recomendadorud/www/Django/RecomendadorUD/source/ ; Directory
user = recomendadorud ; User to run as
stdout_logfile = /home/recomendadorud/www/Django/RecomendadorUD/log_supervisor.log ; Where to write log messages
redirect_stderr = true ; Save stderr in the same log
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8 ; Set UTF-8 as default encoding
#Configurando redis
sudo nano /etc/sysctl.conf
vm.overcommit_memory = 1
sudo nano /etc/supervisor/conf.d/redis.conf
touch log_redis.log
sudo supervisorctl reread
sudo supervisorctl update
[program:Redis]
command = redis-server ; Command to start app
user = recomendadorud ; User to run as
stdout_logfile = /home/recomendadorud/www/Django/RecomendadorUD/log_redis.log ; Where to write log messages
redirect_stderr = true ; Save stderr in the same log
---###OJO PROBAR SI REDIS FUNCIONA###########
-------------------------------------------------------------------------------------
export POSTGRESDATABASE_USER='postgres'
export POSTGRESDATABASE_PASSWORD='RecomendadorUD'
cd www/Django/RecomendadorUD/source/
python manage.py runserver --configuration=Dev