mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fixing empty recommendations for new servers. Also adding firewall information and fixing up fabfile.
This commit is contained in:
parent
fbfede640c
commit
b5ea1dcdf6
8 changed files with 43 additions and 14 deletions
|
@ -1,4 +1,5 @@
|
|||
from utils import log as logging
|
||||
from django.http import HttpResponse
|
||||
from django.template import RequestContext
|
||||
from django.shortcuts import render_to_response
|
||||
from apps.recommendations.models import RecommendedFeed
|
||||
|
@ -26,4 +27,6 @@ def load_recommended_feed(request):
|
|||
'usersub' : usersub,
|
||||
'has_next_page' : len(recommended_feeds) > 1,
|
||||
'has_previous_page' : page != 0,
|
||||
}, context_instance=RequestContext(request))
|
||||
}, context_instance=RequestContext(request))
|
||||
else:
|
||||
return HttpResponse("")
|
12
config/hosts
12
config/hosts
|
@ -1,11 +1,11 @@
|
|||
127.0.0.1 localhost
|
||||
|
||||
# 10.10 app01
|
||||
10.5.1.100 db01
|
||||
# 10.5.1.100 db01
|
||||
# 10.10 task01
|
||||
10.5.1.101 task02
|
||||
# 10.5.1.101 task02
|
||||
|
||||
199.15.250.228 app01.newsblur.com
|
||||
199.15.253.162 db01.newsblur.com
|
||||
199.15.250.229 task01.newsblur.com
|
||||
199.15.250.230 task02.newsblur.com
|
||||
199.15.250.228 app01 app01.newsblur.com
|
||||
199.15.253.162 db01 db01.newsblur.com
|
||||
199.15.250.229 task01 task01.newsblur.com
|
||||
199.15.250.230 task02 task02.newsblur.com
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
; database name = connect string
|
||||
[databases]
|
||||
|
||||
newsblur = host=db01 port=5432 dbname=newsblur
|
||||
newsblur = host=db01.newsblur.com port=5432 dbname=newsblur user=newsblur pass=
|
||||
|
||||
;; Configuation section
|
||||
[pgbouncer]
|
||||
|
||||
ignore_startup_parameters = application_name
|
||||
|
||||
;;;
|
||||
;;; Administrative settings
|
||||
;;;
|
||||
|
@ -27,7 +29,7 @@ unix_socket_dir = /var/run/postgresql
|
|||
;;;
|
||||
|
||||
; any, trust, plain, crypt, md5
|
||||
auth_type = trust
|
||||
auth_type = plain
|
||||
; auth_file = 8.0/main/global/pg_auth
|
||||
auth_file = /etc/pgbouncer/userlist.txt
|
||||
|
||||
|
|
1
config/pgbouncer_userlist.txt
Normal file
1
config/pgbouncer_userlist.txt
Normal file
|
@ -0,0 +1 @@
|
|||
"newsblur" ""
|
6
config/server_migration_forwarding.txt
Normal file
6
config/server_migration_forwarding.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
server {
|
||||
listen 199.15.250.228:80;
|
||||
location ~ / {
|
||||
proxy_pass http://173.230.136.120;
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@ alias cd..='cd ..'
|
|||
|
||||
alias smtp='python -m smtpd -n -c DebuggingServer 127.0.0.1:1025'
|
||||
alias tlnb='echo "----------------\n"; tail -f logs/newsblur.log'
|
||||
alias sp='~/newsblur/manage.py shell_plus'
|
||||
alias cdsg='cd ~/staging'
|
||||
alias cdnb='cd ~/newsblur'
|
||||
|
||||
|
|
24
fabfile.py
vendored
24
fabfile.py
vendored
|
@ -100,12 +100,13 @@ def backup_postgresql():
|
|||
def setup_app():
|
||||
setup_common()
|
||||
setup_app_motd()
|
||||
setup_nginx()
|
||||
setup_gunicorn()
|
||||
update_gunicorn()
|
||||
setup_nginx()
|
||||
|
||||
def setup_db():
|
||||
setup_common()
|
||||
setup_db_firewall()
|
||||
setup_db_motd()
|
||||
setup_db_installs()
|
||||
setup_rabbitmq()
|
||||
|
@ -119,6 +120,8 @@ def setup_task():
|
|||
setup_task_motd()
|
||||
setup_task_installs()
|
||||
setup_celery()
|
||||
setup_gunicorn(supervisor=False)
|
||||
update_gunicorn()
|
||||
|
||||
def setup_common():
|
||||
setup_installs()
|
||||
|
@ -151,6 +154,9 @@ def setup_installs():
|
|||
sudo('python ez_setup.py -U setuptools && rm ez_setup.py')
|
||||
sudo('chsh sclay -s /bin/zsh')
|
||||
|
||||
def config_pgbouncer():
|
||||
put('config/pgbouncer.conf', '/etc/pgbouncer/pgbouncer.ini', use_sudo=True)
|
||||
put('config/pgbouncer_userlist.txt', '/etc/pgbouncer/userlist.txt', use_sudo=True)
|
||||
|
||||
def setup_user():
|
||||
# run('useradd -c "NewsBlur" -m conesus -s /bin/zsh')
|
||||
|
@ -168,6 +174,7 @@ def setup_repo():
|
|||
with cd('~/newsblur'):
|
||||
run('cp local_settings.py.template local_settings.py')
|
||||
run('mkdir -p logs')
|
||||
run('touch logs/newsblur.log')
|
||||
|
||||
def setup_local_files():
|
||||
put("config/toprc", "./.toprc")
|
||||
|
@ -225,11 +232,12 @@ def setup_app_installs():
|
|||
def setup_app_motd():
|
||||
put('config/motd_app.txt', '/etc/motd.tail', use_sudo=True)
|
||||
|
||||
def setup_gunicorn():
|
||||
put('config/supervisor_gunicorn.conf', '/etc/supervisor/conf.d/gunicorn.conf', use_sudo=True)
|
||||
def setup_gunicorn(supervisor=True):
|
||||
if supervisor:
|
||||
put('config/supervisor_gunicorn.conf', '/etc/supervisor/conf.d/gunicorn.conf', use_sudo=True)
|
||||
with cd('~/code'):
|
||||
sudo('rm -fr gunicorn')
|
||||
run('git clone git://github.com/benoitc/gunicorn.git')
|
||||
sudo('ln -s ~/code/gunicorn/gunicorn /usr/local/lib/python2.6/dist-packages/gunicorn')
|
||||
|
||||
def update_gunicorn():
|
||||
with cd('~/code/gunicorn'):
|
||||
|
@ -261,6 +269,14 @@ def setup_nginx():
|
|||
def setup_db_installs():
|
||||
pass
|
||||
|
||||
def setup_db_firewall():
|
||||
sudo('ufw default deny')
|
||||
sudo('ufw allow ssh')
|
||||
sudo('ufw allow 5432')
|
||||
sudo('ufw allow 27017')
|
||||
sudo('ufw allow 5672')
|
||||
sudo('ufw enable')
|
||||
|
||||
def setup_db_motd():
|
||||
put('config/motd_db.txt', '/etc/motd.tail', use_sudo=True)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
kill -HUP `cat ~/newsblur/logs/gunicorn.pid`
|
||||
echo '----\n'
|
||||
tail -f /home/conesus/newsblur/logs/newsblur.log
|
||||
tail -f ~/newsblur/logs/newsblur.log
|
Loading…
Add table
Reference in a new issue