Merge lp:~raj-abhilash1/mailman/docs into lp:mailman

Proposed by Abhilash Raj
Status: Merged
Approved by: Barry Warsaw
Approved revision: no longer in the source branch.
Merged at revision: 7291
Proposed branch: lp:~raj-abhilash1/mailman/docs
Merge into: lp:mailman
Diff against target: 187 lines (+56/-39)
3 files modified
src/mailman/database/alembic/env.py (+7/-2)
src/mailman/docs/DATABASE.rst (+23/-0)
src/mailman/docs/WebUIin5.rst (+26/-37)
To merge this branch: bzr merge lp:~raj-abhilash1/mailman/docs
Reviewer Review Type Date Requested Status
Barry Warsaw Approve
Review via email: mp+246822@code.launchpad.net

Description of the change

Update the documentation for Setting up postorius(WebUIin5.rst)

To post a comment you must log in.
lp:~raj-abhilash1/mailman/docs updated
7289. By Barry Warsaw

 * Fix calculation of default configuration file to use when the ``$var_dir``
   is created by ``mailman start``. (LP: #1411435)

7290. By Barry Warsaw

Fix autonumbering in style guide.

Revision history for this message
Barry Warsaw (barry) wrote :

Thanks! I made a few stylistic and typo modifications, and I found that I had to be in a built virtualenv in order to run the alembic command. I updated the documentation to reflect that and will commit this change. Then I'll commit a schema migration if I can get that working. Thanks for the added docs!

review: Approve
lp:~raj-abhilash1/mailman/docs updated
7291. By Barry Warsaw

 * Improve the documentation describing how to run Alembic to add new schema
   migrations. Given by Abhilash Raj.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/mailman/database/alembic/env.py'
--- src/mailman/database/alembic/env.py 2015-01-05 01:22:39 +0000
+++ src/mailman/database/alembic/env.py 2015-01-17 17:53:23 +0000
@@ -25,11 +25,18 @@
2525
26from alembic import context26from alembic import context
27from contextlib import closing27from contextlib import closing
28from mailman.core.initialize import initialize_1
28from mailman.config import config29from mailman.config import config
29from mailman.database.model import Model30from mailman.database.model import Model
30from mailman.utilities.string import expand31from mailman.utilities.string import expand
31from sqlalchemy import create_engine32from sqlalchemy import create_engine
3233
34try:
35 url = expand(config.database.url, config.paths)
36except AttributeError:
37 # Initialize config object for external alembic calls
38 initialize_1()
39 url = expand(config.database.url, config.paths)
3340
3441
3542
36def run_migrations_offline():43def run_migrations_offline():
@@ -42,7 +49,6 @@
42 Calls to context.execute() here emit the given string to the script49 Calls to context.execute() here emit the given string to the script
43 output.50 output.
44 """51 """
45 url = expand(config.database.url, config.paths)
46 context.configure(url=url, target_metadata=Model.metadata)52 context.configure(url=url, target_metadata=Model.metadata)
47 with context.begin_transaction():53 with context.begin_transaction():
48 context.run_migrations()54 context.run_migrations()
@@ -54,7 +60,6 @@
54 In this scenario we need to create an Engine and associate a60 In this scenario we need to create an Engine and associate a
55 connection with the context.61 connection with the context.
56 """62 """
57 url = expand(config.database.url, config.paths)
58 engine = create_engine(url)63 engine = create_engine(url)
5964
60 connection = engine.connect()65 connection = engine.connect()
6166
=== modified file 'src/mailman/docs/DATABASE.rst'
--- src/mailman/docs/DATABASE.rst 2014-11-09 12:52:58 +0000
+++ src/mailman/docs/DATABASE.rst 2015-01-17 17:53:23 +0000
@@ -59,8 +59,31 @@
59My thanks to Stephen A. Goss for his contribution of PostgreSQL support.59My thanks to Stephen A. Goss for his contribution of PostgreSQL support.
6060
6161
62Database Migrations
63===================
64
65Mailman uses `Alembic`_ to manage database migrations. Lets say you change
66something in the models, what steps are needed to reflect that change in
67the database schema? All you need to do is run this command::
68
69 alembic -c src/mailman/config/alembic.cfg revision --autogenerate
70
71This would create a new migration which would automatically be migrated to the
72database on the next run of mailman. Note that the database needs to be in the
73older state so that alembic can track the changes in the schema and autogenerate
74a migration. If you don't have the database in the older state you can remove
75the `--autogenerate` flag in the above command. It would then create a new empty
76revision which you can edit manually to reflect your changes in the database
77schema.
78
79People upgrading Mailman from previous versions need not do anything manually,
80as soon as a new migration is added in the sources, it will be automatically
81reflected in the schema on first-run post-update.
82
83
62.. _SQLAlchemy: http://www.sqlalchemy.org/84.. _SQLAlchemy: http://www.sqlalchemy.org/
63.. _SQLite3: http://docs.python.org/library/sqlite3.html85.. _SQLite3: http://docs.python.org/library/sqlite3.html
64.. _PostgreSQL: http://www.postgresql.org/86.. _PostgreSQL: http://www.postgresql.org/
65.. _MySQL: http://dev.mysql.com/87.. _MySQL: http://dev.mysql.com/
66.. _`Ubuntu article`: https://help.ubuntu.com/community/PostgreSQL88.. _`Ubuntu article`: https://help.ubuntu.com/community/PostgreSQL
89.. _`Alembic`: https://alembic.readthedocs.org/en/latest/
6790
=== modified file 'src/mailman/docs/WebUIin5.rst'
--- src/mailman/docs/WebUIin5.rst 2012-10-31 16:31:12 +0000
+++ src/mailman/docs/WebUIin5.rst 2015-01-17 17:53:23 +0000
@@ -7,11 +7,13 @@
7done within 5 minutes. This has been tested on Ubuntu 11.04.7done within 5 minutes. This has been tested on Ubuntu 11.04.
88
9In order to download the components necessary you need to have the `Bazaar`_9In order to download the components necessary you need to have the `Bazaar`_
10version control system installed on your system. Mailman requires Python 2.7,10version control system installed on your system. Mailman requires Python 3.4,
11while mailman.client needs at least Python version 2.6.11while mailman.client needs at least Python version 2.6.
1212
13It's probably a good idea to set up a virtual Python environment using13It's probably a good idea to set up a virtual Python environment using
14`virtualenv`_. `Here is a brief HOWTO`_.14`virtualenv`_. `Here is a brief HOWTO`_. You would need two separate virtual
15environment one using Python version 2.6 (for Postorius and mailman.client)
16and other using Python version 3.4 (for Mailman core).
1517
16.. _`virtualenv`: http://pypi.python.org/pypi/virtualenv18.. _`virtualenv`: http://pypi.python.org/pypi/virtualenv
17.. _`Here is a brief HOWTO`: ./ArchiveUIin5.html#get-it-running-under-virtualenv19.. _`Here is a brief HOWTO`: ./ArchiveUIin5.html#get-it-running-under-virtualenv
@@ -24,19 +26,17 @@
24First download the latest revision of Mailman 3 from Launchpad.26First download the latest revision of Mailman 3 from Launchpad.
25::27::
2628
27 $ bzr branch lp:mailman29 $(py3) bzr branch lp:mailman
2830
29Install and test::31Install the Core::
3032
31 $ cd mailman33 $(py3) cd mailman
32 $ python bootstrap.py34 $(py3) python setup.py develop
33 $ bin/buildout
34 $ bin/test
3535
36If you get no errors you can now start Mailman::36If you get no errors you can now start Mailman::
3737
38 $ bin/mailman start38 $(py3) mailman start
39 $ cd ..39 $(py3) cd ..
4040
41At this point Mailman will not send nor receive any real emails. But that's41At this point Mailman will not send nor receive any real emails. But that's
42fine as long as you only want to work on the components related to the REST42fine as long as you only want to work on the components related to the REST
@@ -46,31 +46,18 @@
46mailman.client (the Python bindings for Mailman's REST API)46mailman.client (the Python bindings for Mailman's REST API)
47===========================================================47===========================================================
4848
49Now you should switch to the virtual environment running Python version 2.6
49Download from Launchpad::50Download from Launchpad::
5051
51 $ bzr branch lp:mailman.client52 $(py2) bzr branch lp:mailman.client
5253
53Install in development mode to be able to change the code without working54Install in development mode to be able to change the code without working
54directly on the PYTHONPATH.55directly on the PYTHONPATH.
55::56::
5657
57 $ cd mailman.client58 $(py2) cd mailman.client
58 $ sudo python setup.py develop59 $(py2) sudo python setup.py develop
59 $ cd ..60 $(py2) cd ..
60
61
62Django >= 1.3
63=============
64
65Postorius is a pluggable Django application. Therefore you need to have
66Django (at least version 1.3) installed.
67::
68
69 $ wget http://www.djangoproject.com/download/1.3.1/tarball/ -O Django-1.3.1.tar.gz
70 $ tar xzf Django-1.3.1.tar.gz
71 $ cd Django-1.3.1
72 $ sudo python setup.py install
73 $ cd ..
7461
7562
76Postorius63Postorius
@@ -78,19 +65,21 @@
7865
79::66::
8067
81 $ bzr branch lp:postorius68 $(py2) bzr branch lp:postorius
82 $ cd postorius69 $(py2) cd postorius
83 $ sudo python setup.py develop70 $(py2) sudo python setup.py develop
8471
8572
86Start the development server73Start the development server
87============================74============================
8875
89::76Since postorius is a django app which can be used with any django project. We
77have an project already developed which you can setup like this::
9078
91 $ cd dev_setup79 $(py2) bzr branch lp:~mailman-coders/postorius/postorius_standalone
92 $ python manage.py syncdb80 $(py2) cd postorius_standalone
93 $ python manage.py runserver81 $(py2) python manage.py syncdb
82 $(py2) python manage.py runserver
9483
95The last command will start the dev server on http://localhost:8000.84The last command will start the dev server on http://localhost:8000.
9685