From 5a45f505839adba8b982be55c37a595b58521d72 Mon Sep 17 00:00:00 2001 From: yackob03 Date: Thu, 14 Nov 2013 14:53:55 -0500 Subject: [PATCH 1/4] Log the repository name when pushing and pulling. --- endpoints/index.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/endpoints/index.py b/endpoints/index.py index 6b0cde6d8..0fb1ad990 100644 --- a/endpoints/index.py +++ b/endpoints/index.py @@ -157,10 +157,15 @@ def create_repository(namespace, repository): response = make_response('Created', 201) + extra_params = { + 'repository': '%s/%s' % (namespace, repository), + } + if get_authenticated_user(): - mixpanel.track(get_authenticated_user().username, 'push_repo') + mixpanel.track(get_authenticated_user().username, 'push_repo', + extra_params) else: - mixpanel.track(get_validated_token().code, 'push_repo') + mixpanel.track(get_validated_token().code, 'push_repo', extra_params) return response @@ -220,7 +225,10 @@ def get_repository_images(namespace, repository): if get_authenticated_user(): pull_username = get_authenticated_user().username - mixpanel.track(pull_username, 'pull_repo') + extra_params = { + 'repository': '%s/%s' % (namespace, repository), + } + mixpanel.track(pull_username, 'pull_repo', extra_params) return resp From 96921c2a29d561bc0895432f2316c3c9139c7c0c Mon Sep 17 00:00:00 2001 From: yackob03 Date: Fri, 15 Nov 2013 12:31:39 -0500 Subject: [PATCH 2/4] Update the username validation to match the Docker CLI rules. --- util/validation.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/util/validation.py b/util/validation.py index bbe02e017..895767d98 100644 --- a/util/validation.py +++ b/util/validation.py @@ -1,5 +1,4 @@ import re -import urllib INVALID_PASSWORD_MESSAGE = 'Invalid password, password must be at least ' + \ '8 characters and contain no whitespace.' @@ -12,9 +11,9 @@ def validate_email(email_address): def validate_username(username): # Minimum length of 2, maximum length of 255, no url unsafe characters - return (urllib.quote(username, safe='') == username and - len(username) > 1 and - len(username) < 256) + return (re.search(r'[^a-z0-9_]', username) is None and + len(username) >= 4 and + len(username) <= 30) def validate_password(password): From deb756ea34de8972ec275d0df4d82161b5f36757 Mon Sep 17 00:00:00 2001 From: yackob03 Date: Fri, 15 Nov 2013 12:32:09 -0500 Subject: [PATCH 3/4] Relax some of the restrictions on file size and timeout for the travis guys. --- README.md | 2 +- nginx.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 818fc5024..5a43f8325 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ running: ``` sudo nginx -c `pwd`/nginx.conf -STACK=prod gunicorn -D --workers 4 -b unix:/tmp/gunicorn.sock --worker-class eventlet -t 500 application:application +STACK=prod gunicorn -D --workers 4 -b unix:/tmp/gunicorn.sock --worker-class eventlet -t 2000 application:application ``` set up the snapshot script: diff --git a/nginx.conf b/nginx.conf index 10d316c44..fca92aefe 100644 --- a/nginx.conf +++ b/nginx.conf @@ -31,7 +31,7 @@ http { server { listen 443 default; - client_max_body_size 4G; + client_max_body_size 8G; server_name _; keepalive_timeout 5; From 605db52c84afd27d1936aad8fbe404926602b208 Mon Sep 17 00:00:00 2001 From: yackob03 Date: Fri, 15 Nov 2013 14:03:26 -0500 Subject: [PATCH 4/4] Update the nginx config to allow for super long pushes. --- nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/nginx.conf b/nginx.conf index fca92aefe..7b1b3074f 100644 --- a/nginx.conf +++ b/nginx.conf @@ -61,6 +61,7 @@ http { proxy_buffering off; proxy_pass http://app_server; + proxy_read_timeout 2000; } } }