Denis Darii avatar Denis Darii committed 4578241

added nginx_client_max_body_size and additional_packages parameters

Comments (0)

Files changed (4)

 Changelog
 =============================================================
 
+Version DEVEL
+-------------------------------------------------------------
+
+* Added client_max_body_size nginx server configuration
+
 Version 0.0.10
 -------------------------------------------------------------
 

fagungis/conf/nginx.conf

         }
 
         location / {
+                client_max_body_size %(nginx_client_max_body_size)iM;
                 proxy_pass   http://%(gunicorn_bind)s;
         }
 

fagungis/example_fabfile.py

     env.repository = 'https://bitbucket.org/DNX/example'
     #  hosts to deploy your project, users must be sudoers
     env.hosts = ['root@192.168.1.1', ]
+    # additional packages to be installed on the server
+    env.additional_packages = [
+        'mercurial',
+    ]
     #  system user, owner of the processes and code on your server
     #  the user and it's home dir will be created if not present
     env.django_user = 'django'
 
     ### START nginx settings ###
     env.nginx_server_name = 'example.com'  # Only domain name, without 'www' or 'http://'
+    env.nginx_client_max_body_size = 10  # Maximum accepted body size of client request, in MB
     ### END nginx settings ###
 
     ### START supervisor settings ###

fagungis/tasks.py

         errors.append('"nginx_server_name" configuration missing')
     elif verbose:
         parameters_info.append(('nginx_server_name', env.nginx_server_name))
+    if 'nginx_client_max_body_size' not in env or not env.nginx_client_max_body_size:
+        errors.append('"nginx_client_max_body_size" configuration missing')
+    elif not isinstance(env.nginx_client_max_body_size, int):
+        errors.append('"nginx_client_max_body_size" must be an integer value')
+    elif verbose:
+        parameters_info.append(('nginx_client_max_body_size', env.nginx_client_max_body_size))
     if 'supervisorctl' not in env or not env.supervisorctl:
         errors.append('"supervisorctl" configuration missing')
     elif verbose:
 def _install_dependencies():
     ''' Ensure those Debian/Ubuntu packages are installed '''
     packages = [
-        'mercurial',
         'python-pip',
         'supervisor',
     ]
     sudo('apt-get install %s' % ' '.join(packages))
+    if 'additional_packages' in env and env.additional_packages:
+        sudo('apt-get install %s' % ' '.join(env.additional_packages))
     _install_nginx()
     sudo('pip install --upgrade pip')
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.