From 9cc4e798f5f32a5eafa96ef3f0e94f42b8eb9100 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Fri, 6 Jun 2014 09:15:37 +0200 Subject: [PATCH 1/7] Force django-reversion version to 1.8.0. fix #558 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f7521f053..9c7b48790 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ django>=1.5,<1.6 -django-reversion>=1.8.0 +django-reversion==1.8.0 dj-database-url south lxml From 381bf1d19190552c650d170a5d9e099feaa78c5d Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Fri, 6 Jun 2014 09:25:07 +0200 Subject: [PATCH 2/7] Manually close db connections inside management scripts. fix #557 --- modoboa/core/management/commands/cleanlogs.py | 2 ++ .../admin/management/commands/handle_mailbox_operations.py | 2 ++ modoboa/extensions/amavis/management/commands/amnotify.py | 2 ++ modoboa/extensions/amavis/management/commands/qcleanup.py | 2 ++ .../postfix_autoreply/management/commands/autoreply.py | 2 ++ modoboa/extensions/stats/management/commands/logparser.py | 4 +++- 6 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modoboa/core/management/commands/cleanlogs.py b/modoboa/core/management/commands/cleanlogs.py index 0cf1c8aac..59f3859d9 100644 --- a/modoboa/core/management/commands/cleanlogs.py +++ b/modoboa/core/management/commands/cleanlogs.py @@ -2,6 +2,7 @@ # coding: utf-8 import datetime from optparse import make_option +from django import db from django.core.management.base import BaseCommand from django.utils import timezone from modoboa.core import load_core_settings @@ -42,4 +43,5 @@ class Command(BaseCommand): self.__vprint("Deleting logs older than %d days..." % log_maximum_age) limit = timezone.now() - datetime.timedelta(log_maximum_age) Log.objects.filter(date_created__lt=limit).delete() + db.close_connection() self.__vprint("Done.") diff --git a/modoboa/extensions/admin/management/commands/handle_mailbox_operations.py b/modoboa/extensions/admin/management/commands/handle_mailbox_operations.py index 056b4a55e..e282fb1c6 100644 --- a/modoboa/extensions/admin/management/commands/handle_mailbox_operations.py +++ b/modoboa/extensions/admin/management/commands/handle_mailbox_operations.py @@ -1,6 +1,7 @@ import os import logging from optparse import make_option +from django import db from django.core.management.base import BaseCommand from modoboa.lib import parameters from modoboa.lib.sysutils import exec_cmd @@ -90,3 +91,4 @@ class Command(BaseCommand): self.logger.info('%s succeed', ope) ope.delete() os.unlink(options['pidfile']) + db.close_connection() diff --git a/modoboa/extensions/amavis/management/commands/amnotify.py b/modoboa/extensions/amavis/management/commands/amnotify.py index 1ede77c6e..54846b12e 100644 --- a/modoboa/extensions/amavis/management/commands/amnotify.py +++ b/modoboa/extensions/amavis/management/commands/amnotify.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # coding: utf-8 from optparse import make_option +from django import db from django.core.management.base import BaseCommand, CommandError from django.template.loader import render_to_string from django.core.urlresolvers import reverse @@ -90,3 +91,4 @@ class Command(BaseCommand): continue rcpt = su.mailbox_set.all()[0].full_address self.send_pr_notification(rcpt, reqs) + db.close_connection() diff --git a/modoboa/extensions/amavis/management/commands/qcleanup.py b/modoboa/extensions/amavis/management/commands/qcleanup.py index c31d348f5..a1be4a32d 100644 --- a/modoboa/extensions/amavis/management/commands/qcleanup.py +++ b/modoboa/extensions/amavis/management/commands/qcleanup.py @@ -3,6 +3,7 @@ import time from optparse import make_option +from django import db from django.core.management.base import BaseCommand from modoboa.lib import parameters from modoboa.extensions.amavis import Amavis @@ -63,5 +64,6 @@ class Command(BaseCommand): for maddr in Maddr.objects.all(): if not maddr.msgs_set.count() and not maddr.msgrcpt_set.count(): maddr.delete() + db.close_connection() self.__vprint("Done.") diff --git a/modoboa/extensions/postfix_autoreply/management/commands/autoreply.py b/modoboa/extensions/postfix_autoreply/management/commands/autoreply.py index 3118f6cc9..f91645a4e 100644 --- a/modoboa/extensions/postfix_autoreply/management/commands/autoreply.py +++ b/modoboa/extensions/postfix_autoreply/management/commands/autoreply.py @@ -2,6 +2,7 @@ # coding: utf-8 import sys import datetime +from django import db from django.core.management.base import BaseCommand, CommandError from django.utils import timezone from modoboa.lib import parameters @@ -64,3 +65,4 @@ class Command(BaseCommand): continue send_autoreply(sender, mbox, armessage) + db.close_connection() diff --git a/modoboa/extensions/stats/management/commands/logparser.py b/modoboa/extensions/stats/management/commands/logparser.py index cbcfcb03e..8f00ed9a9 100644 --- a/modoboa/extensions/stats/management/commands/logparser.py +++ b/modoboa/extensions/stats/management/commands/logparser.py @@ -23,8 +23,9 @@ import os import re import rrdtool import string -from django.core.management.base import BaseCommand from optparse import make_option +from django import db +from django.core.management.base import BaseCommand from modoboa.lib import parameters from modoboa.extensions.admin.models import Domain from modoboa.extensions.stats import Stats @@ -357,3 +358,4 @@ class Command(BaseCommand): options["logfile"] = parameters.get_admin("LOGFILE", app="stats") p = LogParser(options, parameters.get_admin("RRD_ROOTDIR", app="stats")) p.process() + db.close_connection() From 3c617e10c73a3093e5f7d21820fbc07cda69af29 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Fri, 6 Jun 2014 09:35:41 +0200 Subject: [PATCH 3/7] Documentation update. fix #555 --- doc/integration/web_servers.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/integration/web_servers.rst b/doc/integration/web_servers.rst index 2c2d11185..f284f3079 100644 --- a/doc/integration/web_servers.rst +++ b/doc/integration/web_servers.rst @@ -107,14 +107,14 @@ Nginx possible that **your** installation of uwsgi or nginx or Apache or what-have-you works differently. Keep this in mind. +This section covers two different ways of running Modoboa behind +`Nginx `_ using a WSGI application server. Choose +the one you prefer between `Green Unicorn `_ or +`uWSGI `_. + Green Unicorn ============= -`Nginx `_ is a really fast HTTP server. Associated -with `Green Unicorn `_, it gives you one of the -best setups to serve python/Django applications. Modoboa's -performance is really good with this configuration. - To use this setup, first download and install `nginx `__ and `gunicorn `_. Then, use the following sample @@ -191,7 +191,7 @@ Paste this content to your configuration (replace values between ``<>`` with yours), restart nginx and enjoy a really fast application! -uwsgi +uWSGI ===== The following setup is meant to get you started quickly. You should From f116d3e966d452c64b2092ca20445c035a1992e4 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Fri, 6 Jun 2014 09:46:06 +0200 Subject: [PATCH 4/7] Documentation update. fix #555 --- doc/integration/web_servers.rst | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/integration/web_servers.rst b/doc/integration/web_servers.rst index f284f3079..eef79b526 100644 --- a/doc/integration/web_servers.rst +++ b/doc/integration/web_servers.rst @@ -112,14 +112,16 @@ This section covers two different ways of running Modoboa behind the one you prefer between `Green Unicorn `_ or `uWSGI `_. +In both cases, you'll need to download and `install nginx +`_. + Green Unicorn ============= -To use this setup, first download and install `nginx -`__ and `gunicorn +Firstly, `Download and install gunicorn `_. Then, use the following sample -gunicorn configuration (create a new file named :file:`gunicorn.conf.py` -inside Modoboa's root dir):: +gunicorn configuration (create a new file named +:file:`gunicorn.conf.py` inside Modoboa's root dir):: backlog = 2048 bind = "unix:/var/run/gunicorn/modoboa.sock" @@ -213,8 +215,7 @@ uwsgi: Use uwsgi 1.2.6 or newer. If you do not, you *will* run into problems. Modoboa will fail in obscure ways. -To use this setup, first download and install `nginx -`__ and `uwsgi +To use this setup, first `download and install uwsgi `_. Here is a sample nginx configuration:: @@ -256,11 +257,14 @@ Here is a sample nginx configuration:: location / { include uwsgi_params; uwsgi_pass ; - uwsgi_param UWSGI_SCRIPT modoboa_server.wsgi:application + uwsgi_param UWSGI_SCRIPT .wsgi:application uwsgi_param UWSGI_SCHEME https; } } +```` must be replaced by the value you used +when :ref:`you deployed your instance `. + If you do not plan to use SSL then change the listen directive to ``listen 80;`` and delete each of the following directives:: @@ -272,7 +276,7 @@ If you do not plan to use SSL then change the listen directive to If you do plan to use SSL, you'll have to generate a certificate and a key. `This article -`__ +`_ contains information about how to do it. Make sure to replace the ``<...>`` in the sample configuration with From 8979ec96d66378119deda966a234d3ede79f4876 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Fri, 6 Jun 2014 10:01:48 +0200 Subject: [PATCH 5/7] 1.1.3 release. --- doc/conf.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index e807a8b4b..0d3218816 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -50,7 +50,7 @@ copyright = u'2014, Antoine Nguyen' # The short X.Y version. version = '1.1' # The full version, including alpha/beta/rc tags. -release = '1.1.2' +release = '1.1.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 993a9ecc5..61db2365c 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ def read(fname): setup( name="modoboa", - version='1.1.2', + version='1.1.3', url='http://modoboa.org/', license='MIT', description="Mail hosting made simple", From c1243d8860d90efadca8f8f81e6615fce939645f Mon Sep 17 00:00:00 2001 From: gt2a Date: Sun, 8 Jun 2014 14:04:17 +0200 Subject: [PATCH 6/7] Update web_servers.rst --- doc/integration/web_servers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/integration/web_servers.rst b/doc/integration/web_servers.rst index eef79b526..e3f2f52b1 100644 --- a/doc/integration/web_servers.rst +++ b/doc/integration/web_servers.rst @@ -19,7 +19,7 @@ Apache2 possible that **your** installation of uwsgi or nginx or Apache or what-have-you works differently. Keep this in mind. -mod_wgsi +mod_wsgi ======== First, make sure that mod_wsgi is installed on your server. From feb81655e5426ca761cf6df372e9958b7f12ac43 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Wed, 11 Jun 2014 11:04:14 +0200 Subject: [PATCH 7/7] Release 1.1.4 --- doc/conf.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 0d3218816..75b698213 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -50,7 +50,7 @@ copyright = u'2014, Antoine Nguyen' # The short X.Y version. version = '1.1' # The full version, including alpha/beta/rc tags. -release = '1.1.3' +release = '1.1.4' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 61db2365c..97c97c2ec 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ def read(fname): setup( name="modoboa", - version='1.1.3', + version='1.1.4', url='http://modoboa.org/', license='MIT', description="Mail hosting made simple",