forked from thehub/hubplus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.txt
280 lines (174 loc) · 7.28 KB
/
install.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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
When deploying hubplus we should try and do multisite django http://effbot.org/zone/django-multihost.htm - this will allow us to use a single indexing server for multiple sites too.
Application setup
-----------------
# create psn user
useradd -m -s /bin/bash psn
# get python dev
apt-cache search python-dev
sudo apt-get install python-dev git-core curl emacs22-nox python-psycopg2 libxslt1-dev gcc python-imaging rsync postgresql-client-8.3 libevent-dev
# create directory
cd /
sudo mkdir opt/apphomes
sudo mkdir opt/apphomes/mhpss
cd opt/apphomes
sudo chown -R psn:adm mhpss/
cd mhpss
# become psn user
sudo -i -u psn
# get pinax
git clone git://github.com/pinax/pinax.git
#check the tags available
git-tag -l
# NOTE that this makes a new branch called mhpss (containing the tag version 0.7beta3
git checkout -b mhpss 0.7beta3
# edit pinax-boot.py --> comment out django 1.0.4 and add 1.1
python scripts/pinax-boot.py --development --django-version=1.1 /opt/apphomes/mhpss/pinax
source ./pinax-env/bin/activate
# get our hub+ repo
git clone git://github.com/thehub/hubplus.git hubplus
# and run the startup the following script which adds a git-hook to your repo. May do more in future
./on_clone/RUNME.sh
# init the submodules containing YUI
git-submodule init
git submodule update
cp local_settings_example.py local_settings.py
cp external_apps.txt ../src/pinax/requirements/external_apps.txt
cp libs.txt ../src/pinax/requirements/libs.txt
pip install --requirement src/pinax/requirements/external_apps.txt
git checkout -b mhpss2 0.7beta2
#run as fcgi
python manage.py runfcgi method=prefork host=127.0.0.1 port=3033
Database setup
--------------
# Install Postgresql
sudo apt-get install postgresql
# Save Postgresql's default config,
sudo cp -a /etc/postgresql/8.3/main/postgresql.conf /etc/postgresql/8.3/main/postgresql.conf.ORIG
sudo cp -a /etc/postgresql/8.3/main/pg_hba.conf /etc/postgresql/8.3/main/pg_hba.conf.ORIG
# In Postgresql's config, set directive "listen_addresses" to
# the local *private* IP address
sudo sed -e "s/^#\(listen_addresses =\) 'localhost'/\1 '172.24.2.72'/" -i /etc/postgresql/8.3/main/postgresql.conf
echo "#Allow access from local VMs with username and password" | sudo tee -a /etc/postgresql/8.3/main/pg_hba.conf
echo "host all all 188.40.250.64/27 md5" | sudo tee -a /etc/postgresql/8.3/main/pg_hba.conf
# we need to change the existing line in pg_hba.conf for local access
local all all ident sameuser
# to
local all all md5
# Restart Postgresql
sudo /etc/init.d/postgresql-8.3 restart
# Check that Postgresql binds to right IP address:
sudo netstat -nlp46
# as user postgres...
createuser -S -d -R -P psn
createdb psn
# set local_settings.py in hubplus accordingly
Pulling the data from plus_demo
-------------------------------
Exporting the database to a file :
pg_dump -U thehub -Fc psn > new.dump
On mhpss-db :
# as admin
cd
rcp phil@pinaxdev.the-hub.net:/home/phil/test/pinax-env/psn_demo/new.dump .
# make sure you copy to somewhere where admin can write and user postgres can read
# become postgres
sudo -i -u postgres
#
dropdb psn
createdb psn
pg_restore -O -U psn -d psn new.dump
# find the password for user psn in the local_settings on the app server
Pulling files
-------------
Login to mhpss-app as admin-xx (eg. admin-pj)
cd /tmp
sudo mkdir /mnt/hubplus-static/mhpss
# copy avatars and members
rsync -avz phil@pinaxdev.the-hub.net:/home/phil/test/pinax-env/psn_demo/site_media/avatars .
rsync -avz phil@pinaxdev.the-hub.net:/home/phil/test/pinax-env/psn_demo/site_media/member_res .
sudo mv avatars/ /mnt/hubplus-static/mhpss/
sudo mv member_res/ /mnt/hubplus-static/mhpss/
sudo mkdir /mnt/hubplus-static/mhpss/themes
sudo mkdir /mnt/hubplus-static/mhpss/css
sudo mkdir /mnt/hubplus-static/mhpss/images
sudo mkdir /mnt/hubplus-static/mhpss/js
# make the symbolic links from our directory
cd /opt/apphomes/mhpss/pinax/hubplus/site_media
ln -s /mnt/hubplus-static/mhpss/avatars/ avatars
ln -s /mnt/hubplus-static/mhpss/member_res/ member_res
ln -s /mnt/hubplus-static/mhpss/themes/ themes
ln -s /mnt/hubplus-static/mhpss/css/ css
ln -s /mnt/hubplus-static/mhpss/images/ images
ln -s /mnt/hubplus-static/mhpss/js/ js
# you now have django seeing the static file directories through symlinks to the shared mount
Fulltext indexing
----------------
HubPlus' fulltext search uses Django-Haystack so in theory you could use lots of different backends but we have chosen to go with the Solr backend since it seems to be the most supported. To install a Solr server on Linux do the following in pinax-env/src:
Go to the index server :
# create psn user
useradd -m -s /bin/bash psn
# get python dev (including jetty)
sudo apt-get install git-core curl emacs22-nox jetty python-setuptools
# stop standard jetty server (we don't want it to become a public web-server)
sudo /etc/init.d/jetty stop
sudo rm /etc/rc2.d/S20jetty
cd /opt
sudo mkdir homeapps
sudo mkdir homeapps/solr
chown -R psn:adm homeapps
# become psn user
sudo -i -u psn
cd homeapps/solr
# get the tarball for solr
curl -O http://apache.mirrors.tds.net/lucene/solr/1.3.0/apache-solr-1.3.0.tgz
tar xvzf apache-solr-1.3.0.tgz
cd apache-solr-1.3.0
cd example
# this now runs the indexer ... do it this way initially to test
java -jar start.jar
** We should make the hubplus start script automatically start this service if it isn't running. **
When installing or revising your schema / search indexes
--------------------------------------------------------
Back on the application server in the pinax application directory :
python manage.py build_solr_schema
1. Take the output from that command and place it in apache-solr-1.3.0/example/solr/conf/schema.xml on the index server
2. Change the line: <schema name="default" version="1.1"> to <schema name="example" version="1.1"> Or to the name of the directory you actually run the start.jar from.
3. Then restart Solr.
To reindex your data
--------------------
python manage.py rebuild_index
# or once the index has been created
python manage.py update_index
Supervisord
===========
The supervisord is a python program to manage a number of processes, which we'll use for the the indexer and django server
On the index server
# Install
sudo easy_install supervisor
#
# restart supervisor
sudo /etc/init.d/supervisord restart
# supervisor shell
sudo supervisorctl
# or run a supervisor directly
sudo supervisorctl help
sudo supervisorctl restart hubplus-mhpss
Configuring Lighttpd
====================
# Nils has created a config file on the shared mount which is included in the lighttpd config.
# make mhpss web-server config changes there. There's a copy of this file in the "etc" directory in
# our pinax directory
# After any change, always run syntax checking
lighttpd -t -f /etc/lighttpd/lighttpd.conf
# restart lighty (or reload could be faster)
sudo /etc/init.d/lighttpd restart
Installing Redis
================
# download the latest redis following the instructions here : http://code.google.com/p/redis/wiki/QuickStart
wget http://redis.googlecode.com/files/redis-1.02.tar.gz
tar xvzf redis-1.02.tar.gz
cd redis-1.02
make
# test run the redis server with
./redis-server
# but would be better to put this under supervisord control