From 2c50d148b4a27027bcebf838be946e319019c655 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 18 Dec 2013 23:32:31 +0000 Subject: [PATCH 1/4] Move the client body buffering over to /mnt (non-ebs). --- README.md | 2 +- nginx-staging.conf | 8 +++++--- nginx.conf | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ba4eb11e8..edddaef82 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ pip install -r requirements.txt running: ``` -sudo nginx -c `pwd`/nginx.conf +sudo mkdir -p /mnt/nginx/ && sudo nginx -c `pwd`/nginx.conf STACK=prod gunicorn -D --workers 4 -b unix:/tmp/gunicorn.sock --worker-class gevent -t 2000 application:application ``` diff --git a/nginx-staging.conf b/nginx-staging.conf index 68e88b274..252d9d21d 100644 --- a/nginx-staging.conf +++ b/nginx-staging.conf @@ -1,8 +1,8 @@ worker_processes 1; user root nogroup; -pid /tmp/nginx.pid; -error_log /tmp/nginx.error.log; +pid /mnt/nginx/nginx.pid; +error_log /mnt/nginx/nginx.error.log; events { worker_connections 1024; @@ -14,7 +14,7 @@ http { include /etc/nginx/mime.types; default_type application/octet-stream; - access_log /tmp/nginx.access.log combined; + access_log /mnt/nginx/nginx.access.log combined; sendfile on; root /root/quay/; @@ -43,6 +43,7 @@ http { server { listen 443 default; client_max_body_size 8G; + client_body_temp_path /mnt/nginx/client_body 1 2; server_name _; keepalive_timeout 5; @@ -73,6 +74,7 @@ http { proxy_pass http://app_server; proxy_read_timeout 2000; + proxy_temp_path /mnt/nginx/proxy_temp 1 2; } } } diff --git a/nginx.conf b/nginx.conf index 536e09303..a9d460f81 100644 --- a/nginx.conf +++ b/nginx.conf @@ -41,6 +41,7 @@ http { server { listen 443 default; client_max_body_size 8G; + client_body_temp_path /mnt/nginx/client_body 1 2; server_name _; keepalive_timeout 5; @@ -71,6 +72,7 @@ http { proxy_pass http://app_server; proxy_read_timeout 2000; + proxy_temp_path /mnt/nginx/proxy_temp 1 2; } } } \ No newline at end of file From d527746cfe350acd912cd3cd84a8ab1818f96a06 Mon Sep 17 00:00:00 2001 From: yackob03 Date: Wed, 18 Dec 2013 19:16:58 -0500 Subject: [PATCH 2/4] Fix the list of public repos to respect the limit set by the API request. --- data/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/model.py b/data/model.py index 629d06700..0945f9dc0 100644 --- a/data/model.py +++ b/data/model.py @@ -544,7 +544,7 @@ def get_visible_repositories(username=None, include_public=True, limit=None, where_clause = new_clause if limit: - query.limit(limit) + query = query.limit(limit) return query.where(where_clause) From d0e62d209995033a3409103fc87e7847fc58748d Mon Sep 17 00:00:00 2001 From: yackob03 Date: Wed, 18 Dec 2013 19:41:22 -0500 Subject: [PATCH 3/4] Don't load olark if the host doesn't specify prod. --- templates/base.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/base.html b/templates/base.html index de2578ce7..8940e9d33 100644 --- a/templates/base.html +++ b/templates/base.html @@ -123,6 +123,7 @@ var isProd = document.location.hostname === 'quay.io'; + {% if request.host == 'quay.io' %} + {% endif %} From dec74fc6080bfe3cac34138d738a76c848bcb9a7 Mon Sep 17 00:00:00 2001 From: yackob03 Date: Wed, 18 Dec 2013 19:47:42 -0500 Subject: [PATCH 4/4] When an email code has already been used, just redirect to signin. --- data/model.py | 7 +++++-- endpoints/web.py | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/data/model.py b/data/model.py index 0945f9dc0..ddfa74417 100644 --- a/data/model.py +++ b/data/model.py @@ -327,8 +327,11 @@ def create_confirm_email_code(user): def confirm_user_email(code): - code = EmailConfirmation.get(EmailConfirmation.code == code, - EmailConfirmation.email_confirm == True) + try: + code = EmailConfirmation.get(EmailConfirmation.code == code, + EmailConfirmation.email_confirm == True) + except EmailConfirmation.DoesNotExist: + raise DataModelException('Invalid email confirmation code.') user = code.user user.verified = True diff --git a/endpoints/web.py b/endpoints/web.py index 347969268..22fb279a1 100644 --- a/endpoints/web.py +++ b/endpoints/web.py @@ -226,7 +226,11 @@ def github_oauth_callback(): @app.route('/confirm', methods=['GET']) def confirm_email(): code = request.values['code'] - user = model.confirm_user_email(code) + + try: + user = model.confirm_user_email(code) + except model.DataModelException as ex: + return redirect(url_for('signin')) common_login(user)