Permalink
Browse files

Re-upping 12 to 64 free feeds.

  • Loading branch information...
1 parent 63fe529 commit ee4fd11ca752424443df38a9a1e6d96753eeaec7 @samuelclay committed Mar 17, 2013
@@ -0,0 +1,79 @@
+global
+ maxconn 4096
+ user haproxy
+ group haproxy
+ daemon
+ ca-base /srv/newsblur/config/certificates
+ crt-base /srv/newsblur/config/certificates
+
+defaults
+ log global
+ maxconn 4096
+ mode http
+ # Add x-forwarded-for header.
+ option forwardfor
+ option http-server-close
+ timeout connect 5s
+ timeout client 30s
+ timeout server 30s
+ # Long timeout for WebSocket connections.
+ timeout tunnel 1h
+ errorfile 503 /srv/newsblur/templates/502.html
+ errorfile 504 /srv/newsblur/templates/502.html
+
+frontend public
+ bind :80
+ bind :443 ssl crt newsblur.pem
+ # Redirect all HTTP traffic to HTTPS
+ # redirect scheme https if !{ ssl_fc }
+
+ use_backend node if { path_beg /socket.io/ }
+ default_backend nginx
+
+backend node
+ balance roundrobin
+ server nodedebug 127.0.0.1:8888 check inter 500ms
+ # server node10 198.211.109.197:8888 check inter 2000ms weight 0
+ # server node11 198.211.110.131:8888 check inter 2000ms
+ # server node12 198.211.110.230:8888 check inter 2000ms
+ # server node13 192.34.61.227:8888 check inter 2000ms
+ # server node14 198.211.109.155:8888 check inter 2000ms
+ # server node15 198.211.107.87:8888 check inter 2000ms
+ # server node16 198.211.105.155:8888 check inter 2000ms
+ # server node17 198.211.104.133:8888 check inter 2000ms
+ # server node18 198.211.103.214:8888 check inter 2000ms
+ # server node19 198.211.106.22:8888 check inter 2000ms
+ # server node20 198.211.110.189:8888 check inter 2000ms
+ # server node21 198.211.106.215:8888 check inter 2000ms
+ # server node22 192.81.209.42:8888 check inter 2000ms
+ # server node23 198.211.102.245:8888 check inter 2000ms
+
+backend nginx
+ balance roundrobin
+ server nginxdebug 127.0.0.1:81 check inter 500ms
+ # server nginx10 198.211.109.197:81 check inter 2000ms
+ # server nginx11 198.211.110.131:80 check inter 2000ms
+ # server nginx12 198.211.110.230:80 check inter 2000ms
+ # server nginx13 192.34.61.227:80 check inter 2000ms
+ # server nginx14 198.211.109.155:80 check inter 2000ms
+ # server nginx15 198.211.107.87:80 check inter 2000ms
+ # server nginx16 198.211.105.155:80 check inter 2000ms
+ # server nginx17 198.211.104.133:80 check inter 2000ms
+ # server nginx18 198.211.103.214:80 check inter 2000ms
+ # server nginx19 198.211.106.22:80 check inter 2000ms
+ # server nginx20 198.211.110.189:80 check inter 2000ms
+ # server nginx21 198.211.106.215:80 check inter 2000ms
+ # server nginx22 192.81.209.42:80 check inter 2000ms
+ # server nginx23 198.211.102.245:80 check inter 2000ms
+
+
+frontend stats
+ bind :1936 ssl crt newsblur.pem
+ default_backend stats
+
+backend stats
+ stats enable
+ stats hide-version
+ stats realm Haproxy\ Statistics
+ stats uri /
+ stats auth sclay:password
View
@@ -214,7 +214,7 @@ def deploy_node():
with cd(env.NEWSBLUR_PATH):
run('sudo supervisorctl restart node_unread')
run('sudo supervisorctl restart node_unread_ssl')
- run('sudo supervisorctl restart node_favicons')
+ # run('sudo supervisorctl restart node_favicons')
def gunicorn_restart():
restart_gunicorn()
@@ -676,7 +676,7 @@ def configure_node():
sudo('rm -fr /etc/supervisor/conf.d/node.conf')
put('config/supervisor_node_unread.conf', '/etc/supervisor/conf.d/node_unread.conf', use_sudo=True)
put('config/supervisor_node_unread_ssl.conf', '/etc/supervisor/conf.d/node_unread_ssl.conf', use_sudo=True)
- put('config/supervisor_node_favicons.conf', '/etc/supervisor/conf.d/node_favicons.conf', use_sudo=True)
+ # put('config/supervisor_node_favicons.conf', '/etc/supervisor/conf.d/node_favicons.conf', use_sudo=True)
sudo('supervisorctl reload')
def copy_app_settings():
@@ -701,30 +701,31 @@ def maintenance_off():
run('mv templates/maintenance_on.html templates/maintenance_off.html')
run('git checkout templates/maintenance_off.html')
-def setup_haproxy(install=False):
- # sudo('apt-get install -y haproxy')
- # sudo('ufw allow 81') # nginx moved
- if install:
- with cd(env.VENDOR_PATH):
- run('wget http://haproxy.1wt.eu/download/1.5/src/devel/haproxy-1.5-dev17.tar.gz')
- run('tar -xf haproxy-1.5-dev17.tar.gz')
- with cd('haproxy-1.5-dev17'):
- run('make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1')
- sudo('make install')
+def setup_haproxy():
+ sudo('ufw allow 81') # nginx moved
+ with cd(env.VENDOR_PATH):
+ run('wget http://haproxy.1wt.eu/download/1.5/src/devel/haproxy-1.5-dev17.tar.gz')
+ run('tar -xf haproxy-1.5-dev17.tar.gz')
+ with cd('haproxy-1.5-dev17'):
+ run('make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1')
+ sudo('make install')
put('config/haproxy-init', '/etc/init.d/haproxy', use_sudo=True)
sudo('chmod u+x /etc/init.d/haproxy')
put('config/haproxy.conf', '/etc/haproxy/haproxy.cfg', use_sudo=True)
sudo('echo "ENABLED=1" > /etc/default/haproxy')
- cert_path = "%s/../secrets-newsblur/certificates" % env.NEWSBLUR_PATH
+ cert_path = "%s/config/certificates" % env.NEWSBLUR_PATH
run('cat %s/newsblur.com.crt > %s/newsblur.pem' % (cert_path, cert_path))
run('cat %s/intermediate.crt >> %s/newsblur.pem' % (cert_path, cert_path))
run('cat %s/newsblur.com.key >> %s/newsblur.pem' % (cert_path, cert_path))
sudo('/etc/init.d/haproxy stop')
sudo('/etc/init.d/haproxy start')
-def config_haproxy():
- put('config/haproxy.conf', '/etc/haproxy/haproxy.cfg', use_sudo=True)
+def config_haproxy(debug=False):
+ if debug:
+ put('config/debug_haproxy.conf', '/etc/haproxy/haproxy.cfg', use_sudo=True)
+ else:
+ put('config/haproxy.conf', '/etc/haproxy/haproxy.cfg', use_sudo=True)
sudo('/etc/init.d/haproxy reload')
# ==============
@@ -889,7 +889,7 @@
$progress.addClass('NB-progress-error').addClass('NB-progress-big');
$('.NB-progress-link', $progress).html($.make('div', {
className: 'NB-modal-submit-button NB-modal-submit-green NB-menu-manage-feedchooser'
- }, ['Choose your 12 sites']));
+ }, ['Choose your 64 sites']));
this.show_progress_bar();
},
@@ -919,7 +919,7 @@
NEWSBLUR.assets.folders.length) {
_.defer(_.bind(this.open_feedchooser_modal, this), 100);
} else if (!NEWSBLUR.Globals.is_premium &&
- NEWSBLUR.assets.feeds.active().length > 12) {
+ NEWSBLUR.assets.feeds.active().length > 64) {
_.defer(_.bind(this.open_feedchooser_modal, this), 100);
}
},
@@ -2639,7 +2639,7 @@
]),
(show_chooser && $.make('li', { className: 'NB-menu-item NB-menu-manage-feedchooser' }, [
$.make('div', { className: 'NB-menu-manage-image' }),
- $.make('div', { className: 'NB-menu-manage-title' }, 'Choose Your 12 sites'),
+ $.make('div', { className: 'NB-menu-manage-title' }, 'Choose Your 64 sites'),
$.make('div', { className: 'NB-menu-manage-subtitle' }, 'Enable the sites you want.')
])),
$.make('li', { className: 'NB-menu-separator' }),
@@ -10,7 +10,7 @@ NEWSBLUR.ReaderFeedchooser.prototype = {
runner: function() {
this.start = new Date();
- this.MAX_FEEDS = 12;
+ this.MAX_FEEDS = 64;
this.approve_list = [];
this.make_modal();
this.make_paypal_button();
@@ -0,0 +1,41 @@
+import stripe, datetime, time
+stripe.api_key = settings.STRIPE_SECRET
+
+week = (datetime.datetime.now() - datetime.timedelta(days=7)).strftime('%s')
+failed = []
+limit = 100
+offset = 0
+while True:
+ print " ---> At %s" % offset
+ try:
+ data = stripe.Customer.all(created={'gt': week}, count=limit, offset=offset)
+ except stripe.APIConnectionError:
+ time.sleep(10)
+ continue
+ customers = data['data']
+ if not len(customers):
+ print "At %s, finished" % offset
+ break
+ offset += limit
+ usernames = [c['description'] for c in customers]
+ for username in usernames:
+ try:
+ user = User.objects.get(username=username)
+ except User.DoesNotExist:
+ print " ***> Couldn't find %s" % username
+ failed.append(username)
+ try:
+ if not user.profile.is_premium:
+ user.profile.activate_premium()
+ elif user.payments.all().count() != 1:
+ user.profile.setup_premium_history()
+ else:
+ print " ---> %s is fine" % username
+ except stripe.APIConnectionError:
+ print " ***> Failed: %s" % username
+ failed.append(username)
+ time.sleep(2)
+ continue
+
+
+

0 comments on commit ee4fd11

Please sign in to comment.