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
1=== modified file 'src/mailman/database/alembic/env.py'
2--- src/mailman/database/alembic/env.py 2015-01-05 01:22:39 +0000
3+++ src/mailman/database/alembic/env.py 2015-01-17 17:53:23 +0000
4@@ -25,11 +25,18 @@
5
6 from alembic import context
7 from contextlib import closing
8+from mailman.core.initialize import initialize_1
9 from mailman.config import config
10 from mailman.database.model import Model
11 from mailman.utilities.string import expand
12 from sqlalchemy import create_engine
13
14+try:
15+ url = expand(config.database.url, config.paths)
16+except AttributeError:
17+ # Initialize config object for external alembic calls
18+ initialize_1()
19+ url = expand(config.database.url, config.paths)
20
21
22
23 def run_migrations_offline():
24@@ -42,7 +49,6 @@
25 Calls to context.execute() here emit the given string to the script
26 output.
27 """
28- url = expand(config.database.url, config.paths)
29 context.configure(url=url, target_metadata=Model.metadata)
30 with context.begin_transaction():
31 context.run_migrations()
32@@ -54,7 +60,6 @@
33 In this scenario we need to create an Engine and associate a
34 connection with the context.
35 """
36- url = expand(config.database.url, config.paths)
37 engine = create_engine(url)
38
39 connection = engine.connect()
40
41=== modified file 'src/mailman/docs/DATABASE.rst'
42--- src/mailman/docs/DATABASE.rst 2014-11-09 12:52:58 +0000
43+++ src/mailman/docs/DATABASE.rst 2015-01-17 17:53:23 +0000
44@@ -59,8 +59,31 @@
45 My thanks to Stephen A. Goss for his contribution of PostgreSQL support.
46
47
48+Database Migrations
49+===================
50+
51+Mailman uses `Alembic`_ to manage database migrations. Lets say you change
52+something in the models, what steps are needed to reflect that change in
53+the database schema? All you need to do is run this command::
54+
55+ alembic -c src/mailman/config/alembic.cfg revision --autogenerate
56+
57+This would create a new migration which would automatically be migrated to the
58+database on the next run of mailman. Note that the database needs to be in the
59+older state so that alembic can track the changes in the schema and autogenerate
60+a migration. If you don't have the database in the older state you can remove
61+the `--autogenerate` flag in the above command. It would then create a new empty
62+revision which you can edit manually to reflect your changes in the database
63+schema.
64+
65+People upgrading Mailman from previous versions need not do anything manually,
66+as soon as a new migration is added in the sources, it will be automatically
67+reflected in the schema on first-run post-update.
68+
69+
70 .. _SQLAlchemy: http://www.sqlalchemy.org/
71 .. _SQLite3: http://docs.python.org/library/sqlite3.html
72 .. _PostgreSQL: http://www.postgresql.org/
73 .. _MySQL: http://dev.mysql.com/
74 .. _`Ubuntu article`: https://help.ubuntu.com/community/PostgreSQL
75+.. _`Alembic`: https://alembic.readthedocs.org/en/latest/
76
77=== modified file 'src/mailman/docs/WebUIin5.rst'
78--- src/mailman/docs/WebUIin5.rst 2012-10-31 16:31:12 +0000
79+++ src/mailman/docs/WebUIin5.rst 2015-01-17 17:53:23 +0000
80@@ -7,11 +7,13 @@
81 done within 5 minutes. This has been tested on Ubuntu 11.04.
82
83 In order to download the components necessary you need to have the `Bazaar`_
84-version control system installed on your system. Mailman requires Python 2.7,
85+version control system installed on your system. Mailman requires Python 3.4,
86 while mailman.client needs at least Python version 2.6.
87
88 It's probably a good idea to set up a virtual Python environment using
89-`virtualenv`_. `Here is a brief HOWTO`_.
90+`virtualenv`_. `Here is a brief HOWTO`_. You would need two separate virtual
91+environment one using Python version 2.6 (for Postorius and mailman.client)
92+and other using Python version 3.4 (for Mailman core).
93
94 .. _`virtualenv`: http://pypi.python.org/pypi/virtualenv
95 .. _`Here is a brief HOWTO`: ./ArchiveUIin5.html#get-it-running-under-virtualenv
96@@ -24,19 +26,17 @@
97 First download the latest revision of Mailman 3 from Launchpad.
98 ::
99
100- $ bzr branch lp:mailman
101-
102-Install and test::
103-
104- $ cd mailman
105- $ python bootstrap.py
106- $ bin/buildout
107- $ bin/test
108+ $(py3) bzr branch lp:mailman
109+
110+Install the Core::
111+
112+ $(py3) cd mailman
113+ $(py3) python setup.py develop
114
115 If you get no errors you can now start Mailman::
116
117- $ bin/mailman start
118- $ cd ..
119+ $(py3) mailman start
120+ $(py3) cd ..
121
122 At this point Mailman will not send nor receive any real emails. But that's
123 fine as long as you only want to work on the components related to the REST
124@@ -46,31 +46,18 @@
125 mailman.client (the Python bindings for Mailman's REST API)
126 ===========================================================
127
128+Now you should switch to the virtual environment running Python version 2.6
129 Download from Launchpad::
130
131- $ bzr branch lp:mailman.client
132+ $(py2) bzr branch lp:mailman.client
133
134 Install in development mode to be able to change the code without working
135 directly on the PYTHONPATH.
136 ::
137
138- $ cd mailman.client
139- $ sudo python setup.py develop
140- $ cd ..
141-
142-
143-Django >= 1.3
144-=============
145-
146-Postorius is a pluggable Django application. Therefore you need to have
147-Django (at least version 1.3) installed.
148-::
149-
150- $ wget http://www.djangoproject.com/download/1.3.1/tarball/ -O Django-1.3.1.tar.gz
151- $ tar xzf Django-1.3.1.tar.gz
152- $ cd Django-1.3.1
153- $ sudo python setup.py install
154- $ cd ..
155+ $(py2) cd mailman.client
156+ $(py2) sudo python setup.py develop
157+ $(py2) cd ..
158
159
160 Postorius
161@@ -78,19 +65,21 @@
162
163 ::
164
165- $ bzr branch lp:postorius
166- $ cd postorius
167- $ sudo python setup.py develop
168+ $(py2) bzr branch lp:postorius
169+ $(py2) cd postorius
170+ $(py2) sudo python setup.py develop
171
172
173 Start the development server
174 ============================
175
176-::
177+Since postorius is a django app which can be used with any django project. We
178+have an project already developed which you can setup like this::
179
180- $ cd dev_setup
181- $ python manage.py syncdb
182- $ python manage.py runserver
183+ $(py2) bzr branch lp:~mailman-coders/postorius/postorius_standalone
184+ $(py2) cd postorius_standalone
185+ $(py2) python manage.py syncdb
186+ $(py2) python manage.py runserver
187
188 The last command will start the dev server on http://localhost:8000.
189