forked from Bioconductor/legacy.support.bioconductor.org
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHow_I_Setup_Biostar.txt
355 lines (282 loc) · 13.4 KB
/
How_I_Setup_Biostar.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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
#############################################################################
#############################################################################
## ALWAYS DO THIS BEFORE YOU WORK ON BIOSTARS:
source ~/virt_env/biostar/bin/activate
## http://simononsoftware.com/virtualenv-tutorial/
## For the initial installs:
source conf/defaults.env
pip install --upgrade -r conf/requirements/base.txt
## Then edit conf/defaults.env so that:
## export BIOSTAR_HOSTNAME="0.0.0.0:8080"
#############################################################################
## Then there was the weird filterError that Dan had seen before
## (from his email)
## Dan followed the instructions in the first answer here:
## http://stackoverflow.com/questions/17474687/npm-install-giving-error-installing-express
## Except that instead of v0.10.12 I picked the most recent version.
## Then he ran:
npm install less
## Setup for this:
# Install the requirements.
pip install --upgrade -r conf/requirements/base.txt
# Load the environment variables.
source conf/defaults.env
# Initialize, import test data and run the site.
./biostar.sh init import index run
## 'import' will pull in older email files...
## Starting it up:
## This just fires it up with test BS:
## ./biostar.sh index run
##
## Look for it at: http://gamay:8080
#############################################################################
#############################################################################
#############################################################################
#############################################################################
## ALWAYS DO THIS BEFORE YOU WORK ON BIOSTARS:
source ~/virt_env/biostar/bin/activate
## DB creation and loading:
source ~/virt_env/biostar/bin/activate
source live/loading.env ## needed to prevent us from spamming everyone while we import emails
## Before you drop the DB, be sure to remove this directory too:
rm -r import/bioc
## THEN to delete, re-create and init postgres DBs
export PGUSER=postgres
./biostar.sh pg_drop pg_create init
## if the above causes an error saying someone is using the
## database, then restart apache like this:
## sudo service apache2 restart
## THEN import the emails (R script)
## THEN run the tagging script (R script)
## How to back up and restore:
## To back up, do this
./biostar.sh pg_dump
## You need to enter the postgresql admin password
## This will tell you the name of the file that it is dumping to.
## And before you can restore, you need to drop and recreate
## the database, by doing:
./biostar.sh pg_drop pg_create
## If moving the DB to production, copy the dump file to habu and then ssh to habu
## Then restore with:
./biostar.sh pg_import /home/mcarlson/data/filename
## where filename is the file that was created by pg_dump.
## WHEN you have copied the dump over to Habu (scp
## /home/mcarlson/data/fullyTagged_biostar-2.2.0-2014-09-05.sql.gz
## www-data@habu:~/biostar-central/) do it like this:
ssh www-data@habu
workon biostarsenv
cd biostar-central/
source live/custom.env
./biostar.sh pg_drop pg_create
./biostar.sh pg_import NAME_OF_DUMP_FILE_.sql.gz
## Then continue as below with the permissions
## Then before you can run things you need to set up permissions:
psql -U postgres biostar
## (enter postgres admin password)
grant all privileges on database biostar to biostar;
grant all on all tables in schema public to biostar;
grant all on all sequences in schema public to biostar;
grant all on all functions in schema public to biostar;
## If on production, also need to do:
update django_site set domain = 'support.bioconductor.org';
## In order to log in as an admin user you need to log into the database
## (psql -U postgres biostar) and then do commands like this (you can do this before dumping)
update users_user set is_admin = TRUE, is_staff = TRUE where email = 'dtenenba@fhcrc.org';
update users_user set is_admin = TRUE, is_staff = TRUE where email = 'mcarlson@fhcrc.org';
update users_user set is_admin = TRUE, is_staff = TRUE where email = 'mtmorgan@fhcrc.org';
update users_user set is_admin = TRUE, is_staff = TRUE where email = 'vobencha@fhcrc.org';
update users_user set is_admin = TRUE, is_staff = TRUE where email = 'sarora@fhcrc.org';
update users_user set is_admin = TRUE, is_staff = TRUE where email = 'nhayden@fhcrc.org';
update users_user set is_admin = TRUE, is_staff = TRUE where email = 'hpages@fhcrc.org';
## Also need to go to admin back and end change ignacio's name to 'Guest User'.
## To do that you need to go here as an admin account:
## https://support.bioconductor.org/admin/
## After restoring, you need to re-enter social login info.
## Unfortunately, even though this information is required to be in the config
## environment that initializes biostar, it also requires it
## (redundantly) to be in the database as well. So go to
https://support.bioconductor.org/admin/
## and click on Social Apps and then go through each app and fill in the
## appropriate values.
## The canonical place to look for these values is on habu (ssh
## www-data@habu) in the file ~/biostar-central/index.wsgi. This is a
## python script that initializes the app and it's not checked into
## github because it has sensitive information in it.
## Now test it:
## On gamay this means:
load live/custom.env ## needed to actually run the site for testing
./biostar.sh run # only ever do this on gamay
## And on production it's just always kept alive.
## and see if you can access http://gamay:8080 or production url
#####################################################################
## older stuff from when we had a sqlite back end:
## Then re-init:
## ALWAYS DO THIS BEFORE YOU WORK ON BIOSTARS:
## source ~/virt_env/biostar/bin/activate
## source live/loading.env
## This deletes all posts from the DB (CAREFUL!)
## ./biostar.sh delete
## ./biostar.sh init
## Then import emails etc. (two R scripts for this)
## THEN index (don't need to run this unless you want to index OLD search boxes)
## This step is only to index the search engine (and we swapped to
## using a different one of those...
## ./biostar.sh index
## THEN load new env variables so that the email can work...
source live/custom.env
## Or if you have indexed before, just re-run.
./biostar.sh run
## Then run it
nohup ./biostar.sh init run > biostar.log 2>&1 &
#############################################################################
#############################################################################
#############################################################################
#############################################################################
#############################################################################
## Questions about biostars:
## Can I create an account? If so, will it still link me to previous
## posts? Yes, I can create an account, but EVEN IF the emails are
## the same I don't have credit for previous posts...
##
## How can I change the look / tabs?
## Where are the word association file for automatically tagging posts?
## Tagging ANSWER:
## For tagging, I should be able to do it like this:
## http://docs.biostars.org/en/latest/manage.html#command-line-tagging
## How do I set up the automatic email option for users?
## What is difference between 'email' and 'email for every thread'?
## And why is it that every time I make a post I never get any emails?
## I just get some stuff in the server output. Looks like this:
## More questions and answers
## You showed how I can command line give myself a password like this:
## python manage.py usermod -e foo@bar.com -p newpass
## I now know where the DB lives (so I can't ever back it up)
## They are in:
## ~/tasks/testBiostar/biostar-central/live/
## So just go there and
## sqlite3 biostar.db will get you in...
## test posts (still getting sent to email)
## replies STILL get sent to local stream (instead of out to world)
#####################################################################
## I have to set this up and test. Instructions are here:
## http://docs.biostars.org/en/latest/customize.html
## looks like I need to just add some python to ./live
#############################################################################
#############################################################################
##Configuring email:
## ad this value to the custom.env file described in this doc
## (http://docs.biostars.org/en/latest/customize.html):
export DJANGO_SETTINGS_MODULE=live.custom
## And this is what goes in the email section of that file
export EMAIL_HOST='mx.fhcrc.org'
export EMAIL_PORT='25'
export EMAIL_HOST_USER='biocbuild@fhcrc.org'
export EMAIL_HOST_PASSWORD=''
## and the DEFAULT_FROM_EMAIL value decides where the email comes from so:
export DEFAULT_FROM_EMAIL='biocbuild@fhcrc.org'
## OK this FINALLY seems to work. BUT: only if instead of starting with:
source conf/defaults.env
./biostar.sh run
## I instead have to start with:
source live/custom.env
./biostar.sh run
########################################################################
########################################################################
########################################################################
########################################################################
## Skinning:
## art is in:
## /home/mcarlson/tasks/testBiostar/biostar-central/biostar/static
## biostar2.logo.png
## And this is referred to here (pointed this to new image)
## biostar/settings/base.py:SITE_LOGO = "biostar2.logo.png"
## This above change was formalized by adding the following to live/custom.py
## # The site logo.
## SITE_LOGO = "bioconductor_logo_rgb_small.jpg"
##
## style stuff is in:
## biostar/static/biostar.style.less
##
## Colors:
## #5b8c3e: forest green
## #6b3e4a: DARK maroon
## #E9530F: orange?
## #8f2c47: unanswered color default (cranberry)
##
## And in fact some colors have not yet been factored out of here:
## biostar/static/biostar.base.less
## (They still need to be moved over to here:)
## biostar/static/biostar.style.less
## This was done before and submitted to the core
##
########################################################################
## Bioc Colors (as grepped from our web site)
## BiocGreen: #87b13f
## BiocBlue: #1881c2
## And our logos:
## http://www.bioconductor.org/about/logo/
##
########################################################################
########################################################################
#########################################################################
## Dans emails about the production server:
## Everything is hosted on habu. I *think* you should be able to
## ssh mcarlson@habu
## without needing a password. Let me know if that works.
## And everything runs as the www-data user (this is the user that
## apache runs as). So you should not make any changes as mcarlson,
## instead you should:
## sudo su - www-data
##
## AMMENDMENT: now just ssh in directly as the www-data user:
ssh www-data@habu
## You should have sudo privileges so that should work, let me know if not.
## I tried to set up ssh'ing directly to www-data@habu and for
## whatever reason it doesn't work. I can look into it but this is a
## not too annoying workaround.
## Anyway, inside ~www-data you'll see a biostar-central
## directory. This is a clone of our fork of biostars.
## The way that Apache links to biostar is through the index.wsgi file
## inside the biostar-central directory, which is a python script.
## Since apache calls this script directly, there is no opportunity to
## source a .sh file like you do on gamay, so all the environment
## variables that were set in live/custom.env are now set in
## index.wsgi. They are just set in python instead of shell script.
## One more thing, biostar runs in a virtualenv on habu just like it
## does on gamay, and you can activate that virtualenv as follows:
source ~/.virtualenvs/biostarsenv/bin/activate
## ALSO: on production there should never be a need to run the "run" script
## So no: ./biostar.sh run
## ALSO: do NOT ever load this on production since the envir there is
## not able to be set to 'safe' - IOW the always active index.wsgi
## apache file is based only on the unsafe contents of live/custom.env
## AND: if you must restart apache you do it like this:
sudo service apache restart
## once things are finished indexing on gamay, I need to 1) copy the
## contents of /live/custom.py from gamay 2) re-run the init script,
## 3) copy the DB, and then apache should be running it.
## Changing default biostar templates
## The templates are in biostar/server/templates
## Dan changed starbase.html in this directory to make
## it very clear that the site is not live yet. There
## are comments indicating what changed. This content
## should be removed when we go live.
################################################################################
## Notes from Dan on how to best merge in 'improvements' from the istvan branch.
##
## Hi Marc,
## I went ahead and pulled and merged this. Here is how I did it, for
## your future reference:
## cd tasks/forkBiostars/biostar-central/
## git branch # show what branch you're on
## git checkout istvan # fails because some stuff is not committed
## # so commit it:
## git commit -a
## # now try again
## git checkout istvan # now works
## git pull istvan
## git checkout master # switch back to master
## git merge istvan
## # hopefully the merge will succeed w/o conflicts. If not, let me know.
## git status
## git push # enter your github username and password when prompted