Merge lp:~ce-infrastructure/capomastro/capomastro-docs-1391397 into lp:capomastro

Proposed by Caio Begotti
Status: Merged
Approved by: Daniel Manrique
Approved revision: 158
Merged at revision: 146
Proposed branch: lp:~ce-infrastructure/capomastro/capomastro-docs-1391397
Merge into: lp:capomastro
Diff against target: 287 lines (+110/-108)
6 files modified
README.md (+0/-69)
capomastro/templates/base.html (+1/-1)
debian/changelog (+6/-0)
debian/docs (+2/-1)
docs/source/index.rst (+7/-37)
docs/source/setup.rst (+94/-0)
To merge this branch: bzr merge lp:~ce-infrastructure/capomastro/capomastro-docs-1391397
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
James Jesudason (community) Approve
Review via email: mp+243082@code.launchpad.net

Description of the change

A few changes to reflect how things are done now compared to the old README and instructions for local development.

To post a comment you must log in.
Revision history for this message
Caio Begotti (caio1982) wrote :

James, you'll find the last line of the diff the most interesting since the rest of the setup instructions didn't change much.

153. By Caio Begotti

typos

154. By Caio Begotti

no reason not to have it here if the dockerfile was listed before

Revision history for this message
Daniel Manrique (roadmr) wrote :

Some minor nitpicks and one question.

review: Needs Fixing
155. By Caio Begotti

review fixes, thanks roadmr!

156. By Caio Begotti

otherwise people will only find ghosts hanging around on IRC

Revision history for this message
James Jesudason (jamesj) wrote :

The symlink for the scripts file and retaining the standard manage.py file should make the project easier to pick up for someone new.

Moving the docs from the README.md in the root directory to the docs/source/setup.rst makes it harder to find. The symlink seems to be a bit of a compromise. I'd prefer to see the setup instructions in the doc/source/index.rst or at least a link in there to the setup.rst file. The README symlink can then go to the index.rst file.

The setup docs are now more wordy and not as succinct or easy to follow as the previous version. The numbered list of steps in the original made it easier to follow. Also, the database role and database creation should be placed before the setup of the local_settings.py and the syncdb.

review: Needs Fixing
Revision history for this message
Caio Begotti (caio1982) wrote :

James, the symlink is for the packaging, I've actually restored the real manage.py file as you wanted. Perhaps you interpreted the symlink reversed?

Also, the content of setup.rst was in fact inside index.rst before but it was getting way too long and confusing so that's why I split them and symlinked the README file to setup.rst directly. I'm going to link setup.rst inside index.rst as you suggests too.

Perhaps the setup docs are more wordy now because I'm not a native speaker of English I'd say, so I'm totally open to grammar and spelling and phrasing suggestions!

I'll fix up the order of the database setup as you suggests, thanks! I don't get though how the numbered list is worse now. It was just a plain text file before and ReST formatted files can't keep the same formatting I'm afraid.

157. By Caio Begotti

fix the order in which the role/database is created, thanks jamesj

158. By Caio Begotti

link the setup instructions directly in the main documentation file, for clarity

Revision history for this message
Caio Begotti (caio1982) wrote :

Suggestions for checking how the documentation now looks in case the diff is a bit confusing (I think it is):

'less README' -> now points to the real up to date instructions, starting with a note where to find more info and telling developers to follow the next sections as they appear

'./manage.py' -> at the root of the project directory, like expected, works again

'less docs/source/index.rst' -> in case make html wasn't run in the docs directory, points to the setup instructions so nothing is missed at a first glance

Revision history for this message
James Jesudason (jamesj) wrote :

Thanks

review: Approve
Revision history for this message
Daniel Manrique (roadmr) wrote :

+1 from me too, thanks!a

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added symlink 'README'
2=== target is u'docs/source/setup.rst'
3=== removed file 'README.md'
4--- README.md 2014-10-27 12:20:16 +0000
5+++ README.md 1970-01-01 00:00:00 +0000
6@@ -1,69 +0,0 @@
7-capomastro [![Build Status](https://travis-ci.org/capomastro/capomastro.svg)](https://travis-ci.org/capomastro/capomastro)
8-==========
9-Master builder
10-
11-Capomastro manages build dependencies built using Jenkins.
12-
13-Multiple "Projects" can share common dependencies, and the artifact details are
14-pulled into the database where they can easily be download, or archived.
15-
16-To get started...
17-
18-1. `mkvirtualenv <name>`
19-
20-2. `pip install -r requirements.txt` (or dev-requirements.txt if you're going
21- to run the tests)
22-
23-3. Copy the `capomastro/local_settings.py.example` to `capomastro/local_settings.py`
24- and fixup the database entry
25-
26-4. You'll need to setup the database `./manage.py syncdb --migrate` - you'll be
27- prompted to create a superuser.
28-
29-Steps 1 and 2 can be replaced with `tox -e devenv`. Then either activate the
30-virtualenv manually with `source devenv/bin/activate` or explicitly call
31-Python from the virtualenv with `devenv/bin/python`.
32-
33-You can do the next steps through the /admin/ interface, so go to
34-http://localhost:8000/admin/ login and continue.
35-
36-I'd recommend installing gunicorn, but you can use the default ./manage.py
37-runserver.
38-
39-You'll need a celery worker running as well as rabbitmq.
40-
41-```
42-$ gunicorn -b 0.0.0.0:8000 capomastro.wsgi:application
43-$ celery -A capomastro worker -l info
44-```
45-
46-5. You'll need an initial jenkins.JenkinsServer object, with the correct credentials,
47- and the REMOTE_ADDR setup correctly, so that it can receive callbacks.
48-
49-7. Create a DependencyType, and Dependency for that DependencyType, the
50- Dependency should be hooked up to your Job model.
51-
52-
53-You should have...
54-
55-
56- Dependency -> DependencyType
57- |
58- Job
59- |
60- JenkinsServer
61-
62-You can create several dependencies, with different jobs.
63-
64-Your Jenkins Server requires the "notifications" plugin installed.
65-
66-And the jobs that are created must have a parameter "BUILD_ID" and they must
67-have a notification setup, type http/json and with a callback address of
68-http://hostname/jenkins/notifications/.
69-
70-8. Now you can create a Project, associated with your dependencies, at
71- localhost:8000/projects/create/ "auto track" means that the project will use
72- the latest version of any dependencies automatically.
73-
74-9. Now, you can build your project, this will create a project build, and
75- trigger the tasks to build your project.
76
77=== modified file 'capomastro/templates/base.html'
78--- capomastro/templates/base.html 2014-11-27 12:20:47 +0000
79+++ capomastro/templates/base.html 2014-11-28 16:53:08 +0000
80@@ -84,7 +84,7 @@
81 {% block footer %}
82 <div class="container">
83 <hr>
84- <p><a href="https://github.com/capomastro/capomastro">Capomastro</a> is <a href="http://opensource.org/definition">Open Source</a> software, released under an <a href="https://github.com/capomastro/capomastro/blob/master/LICENSE">MIT License</a>.</p>
85+ <p><a href="https://launchpad.net/capomastro">Capomastro</a> is <a href="http://opensource.org/definition">Open Source</a> software, released under an <a href="http://bazaar.launchpad.net/~ce-infrastructure/capomastro/trunk/view/head:/LICENSE">MIT License</a>.</p>
86 </div>
87 {% endblock footer %}
88 </footer>
89
90=== modified file 'debian/changelog'
91--- debian/changelog 2014-11-27 16:02:56 +0000
92+++ debian/changelog 2014-11-28 16:53:08 +0000
93@@ -1,3 +1,9 @@
94+capomastro (20141129) trusty; urgency=high
95+
96+ * Fixes #1391397 (fixing docs for local testing/development)
97+
98+ -- Caio Begotti <caio.begotti@canonical.com> Thu, 27 Nov 2014 16:58:28 -0200
99+
100 capomastro (20141128) trusty; urgency=high
101
102 * Fixes #1391718 (includes a log rotation setup)
103
104=== modified file 'debian/docs'
105--- debian/docs 2014-10-27 12:45:25 +0000
106+++ debian/docs 2014-11-28 16:53:08 +0000
107@@ -1,3 +1,4 @@
108 docs/build/html
109 Dockerfile
110-README.md
111+Vagrantfile
112+README
113
114=== modified file 'docs/source/index.rst'
115--- docs/source/index.rst 2014-10-27 12:40:23 +0000
116+++ docs/source/index.rst 2014-11-28 16:53:08 +0000
117@@ -1,5 +1,6 @@
118 .. Capomastro documentation master file, created by
119 sphinx-quickstart on Mon Oct 20 16:11:51 2014.
120+.. _setup: setup.html
121
122 Capomastro's documentation
123 ==========================
124@@ -15,54 +16,23 @@
125 Introduction
126 ------------
127
128-Capomastro is Jenkins best friend as we call it because it's basically a UI to manage Jenkins builds and archived artifacts of such builds. It uses Jenkins only for that sort of automation, and it does it through Bygmester.
129+Capomastro is Jenkins' best friend as we call it because it's basically a UI to manage Jenkins builds and archived artifacts of such builds. It uses Jenkins only for that sort of automation, and it does it through Bygmester (which is hosted on http://launchpad.net/bygmester). Multiple "projects" can share common dependencies, and the artifact details are pulled into the database where they can easily be downloaded, or archived elsewhere.
130
131 The current use of Capomastro is to build images for the Phablet team but soon it will possibly grow and merge with the other OEM Image Build System we have at Canonical.
132
133 Orinally, Capomastro was developed on Github as an open source side project of Canonical employees, but this is the forked version of it hosted on Launchpad to better reflect the roadmap we have for it.
134
135-Manual setup
136-------------
137-
138-In case you need to manually set up a new Capomastro service, please refer to how its packages do things and also its Juju's charm configuration. They can help you a great deal.
139-
140-You'll need the following services in order to bring it up anyway:
141-
142-* PostgreSQL, default database
143-* Apache with mod WSGI, to expose the UI
144-* RabbitMQ, for message handling
145-* Celery, tasks management
146-
147-All the configurations of Capomastro (messaging, DB, the service etc) are stored via symlinks inside of ``/etc/capomastro/``.
148-
149-Beside a dedicated user creation to run Capomastro (who will actually start the Celery workers through its initscript), you'll need to set up the DB and a role for it::
150-
151- CREATE ROLE capomastro
152- PASSWORD 'capomastro'
153- LOGIN CREATEDB NOSUPERUSER INHERIT NOCREATEROLE NOREPLICATION;
154-
155- CREATE DATABASE capomastro
156- WITH OWNER = capomastro
157- TABLESPACE = pg_default
158- LC_COLLATE = 'en_US.UTF-8'
159- LC_CTYPE = 'en_US.UTF-8'
160- ENCODING = 'UTF8'
161- CONNECTION LIMIT = -1;
162-
163-As for the web server configuration, it all depends on how you want to run it for development and testing. The file ``capomastro.conf`` at the root of its source tree will tell you how to use it with Apache.
164-
165-If you're not using the Capomastro packages via its PPA, remember you'll need to manually create a Django superuser and run its syncdb management command. Refer to Django's documentation about both operations or simply run this::
166-
167- $ ./manage.py syncdb --migrate
168-
169-All that remains now is the first the dependencies setup, then the projects setup, in that particular order. Creating of projects before its dependencies are set is not currently supported.
170+Setting up
171+----------
172+
173+Please refer to the setup_ section for instructions.
174
175 Contact
176 -------
177
178 For bug reports, follow ups, code management etc please refer to our Launchpad project at https://launchpad.net/capomastro.
179
180-You can also send us an e-mail and we'll get back to you as soon as possible, just shoot it one for the PES Certification & Tools team at pes-tools-cert@lists.canonical.com. You'll also find many of us in our IRC channel ``#pes-infrastructure``.
181+You can also send us an e-mail and we'll get back to you as soon as possible, just shoot it one for the PES Certification & Tools team at pes-tools-cert@lists.canonical.com. You'll also find many of us in our IRC channel ``#cert-infra``.
182
183
184 Indices and tables
185
186=== added file 'docs/source/setup.rst'
187--- docs/source/setup.rst 1970-01-01 00:00:00 +0000
188+++ docs/source/setup.rst 2014-11-28 16:53:08 +0000
189@@ -0,0 +1,94 @@
190+=====
191+Setup
192+=====
193+
194+This file was created based on the old historic README file from Capomastro, if anything seems to be missing here please refer to the whole documentation files in the ``docs/`` directory.
195+
196+If you're an old school Django guy, you can get started with local testing and development by following the next sections. You'll need the following services in order to bring the application up anyway, no matter if using the packaged code or not:
197+
198+* PostgreSQL, default database
199+* Apache with mod WSGI, to expose the UI
200+* RabbitMQ, for message handling
201+* Celery, tasks management
202+
203+Environment
204+-----------
205+
206+Create your environment either with ``mkvirtualenv <name>``, if you have virtualenvwrapper installed, or simply ``tox -e devenv`` since it does some extra steps for you. It's recommended to install ``tox`` and go with the latter option.
207+
208+If you decide for using ``mkvirtualenv`` you'll also need to manually install the Python dependencies with ``pip install -r requirements.txt`` or even ``pip install -r dev-requirements.txt`` if you're going to run the code tests.
209+
210+Then either activate the virtual environment manually with ``source devenv/bin/activate`` or explicitly call Python from the virtual environment with ``devenv/bin/python``.
211+
212+Database
213+--------
214+
215+Please set up the Postgres server with this script before continuing:
216+
217+ ::
218+
219+ CREATE ROLE capomastro
220+ PASSWORD 'capomastro'
221+ LOGIN CREATEDB NOSUPERUSER INHERIT NOCREATEROLE NOREPLICATION;
222+
223+ CREATE DATABASE capomastro
224+ WITH OWNER = capomastro
225+ TABLESPACE = pg_default
226+ LC_COLLATE = 'en_US.UTF-8'
227+ LC_CTYPE = 'en_US.UTF-8'
228+ ENCODING = 'UTF8'
229+ CONNECTION LIMIT = -1;
230+
231+If needed, fixup the database entry in ``capomastro/db_settings.py``, but most likely the default values will work okay unless you're testing database changes.
232+
233+You'll need to prepare the database with ``./manage.py syncdb`` (and you'll be prompted to create a superuser at this time).
234+
235+Web server
236+----------
237+
238+Now you can start the local server by executing ``./manage.py runserver`` and do the next steps through the ``/admin/``
239+interface of Capomastro, so go to http://localhost:8000/admin/ then login with the username and password created before and continue.
240+
241+If you prefer to test things with Gunicorn you'll need a Celery worker
242+running as well as RabbitMQ.
243+
244+Now just run ``gunicorn -b 0.0.0.0:8000 capomastro.wsgi:application`` and start the Celery worker that will talk to the Rabbit queue with ``celery -A capomastro worker -l debug``.
245+
246+Django
247+------
248+
249+All that remains now is the first the dependencies setup, then the projects setup, in that particular order. Creating of projects before its dependencies are set is not currently supported.
250+
251+In the ``/admin/`` interface of Capomastro you'll need an initial ``jenkins.JenkinsServer`` object, with the correct credentials and ``REMOTE_ADDR`` set up correctly, so that it can receive callbacks.
252+
253+Create a ``DependencyType`` and ``Dependency`` for that ``DependencyType``. The ``Dependency`` should be hooked up to your ``Job`` model.
254+
255+You should have something like this:
256+::
257+
258+ Dependency - DependencyType
259+ |
260+ Job
261+ |
262+ JenkinsServer
263+
264+You can create several dependencies, with different jobs. Your Jenkins server requires the ``notifications`` plugin installed too, so make sure it's available otherwise you won't get status back from the builds.
265+
266+The jobs that are created must have a parameter ``BUILD_ID`` and they must have a notification setup, type ``http/json`` and with a callback address of ``http://hostname/jenkins/notifications/``.
267+
268+Now you can create a ``Project``, associated with your dependencies, at ``http://localhost:8000/projects/create/``. The option "auto track" means that the project will use the latest version of any dependencies automatically.
269+
270+Now you can build your project. This will create a project build, and trigger the tasks to build your project on the Jenkins server.
271+
272+Packaged setup
273+--------------
274+
275+All the configurations of Capomastro (messaging, DB, the service etc) are stored via symlinks inside of ``/etc/capomastro/`` if you're using the Debian package of the application.
276+
277+Beside a dedicated user creation to run Capomastro (who will actually start the Celery workers through its initscript), you'll need to set up the DB and a role for it. See the previous database section for a SQL script that can be used.
278+
279+As for the web server configuration, it all depends on how you want to run it for development and testing. The file ``capomastro.conf`` at the root of its source tree will tell you how to use it with Apache, the preferred method.
280+
281+By using the Debian package of Capomastro, possibly through its Juju charm as well, things will be much easier to set up initially. Usually you don't have to worry about any of these steps above, plus you'll get a really isolated environment for development and testing.
282+
283+All code is actually validated through the application package, so although you can test and develop things really locally, only code from packages is considered deployable.
284
285=== renamed file 'scripts/capomastro' => 'manage.py'
286=== added symlink 'scripts/capomastro'
287=== target is u'../manage.py'

Subscribers

People subscribed via source and target branches