Jump to: navigation, search

Difference between revisions of "Documentation/HowTo"

(Tools and Content Overview)
(Doc Comments Guidelines)
Line 274: Line 274:
  
 
The release notes are available on Github.
 
The release notes are available on Github.
 
== Doc Comments Guidelines ==
 
 
A released set of documents has Disqus comments enabled, but the docs.openstack.org/trunk site does not have Disqus comments enabled. The Disqus identifiers are mapped to particular documents. If you would like to be a moderator on particular Disqus topics, first sign up for Disqus, then send an email to [mailto:openstack-docs@lists.openstack.org openstack-docs@openstack.org] with your Disqus email address and which topics from the list below you would like to moderate and respond to questions.
 
 
* Keystone Developer Guide (os-identitydevguide)
 
* OpenStack API Quick Start (os-apiquickstart)
 
* OpenStack Command Line Interface Clients Guide (os-cliguide)
 
* OpenStack High Availability Guide (openstack-ha-guide)
 
* OpenStack Install and Deploy Manual - Fedora/RHEL/CentOS (os-install-yum)
 
* OpenStack Install and Deploy Manual - Ubuntu/Debian (os-install-apt)
 
* OpenStack Compute API Programmer Guide (os-computeapiprogrammer)
 
* OpenStack Networking (os-neutron-guides)
 
* OpenStack Documentation includes Compute Admin Guide, Object Storage admin guide, Compute API v2, Object Storage API v1.0 (openstackdocs)
 
* OpenStack Basic Installation Guide - Fedora/RHEL/CentOS (os-yum-basic-install)
 
* OpenStack Basic Installation Guide - openSUSE (os-zypper-basic-install)
 
* OpenStack Basic Installation Guide - Ubuntu/Debian (os-apt-basic-install)
 
 
Note: We should probably have separate Disqus topics for each book. Plus the image API doesn't have Disqus comments enabled currently. Tracking with this doc bug: [https://bugs.launchpad.net/openstack-api-site/+bug/1067208 1067208]
 
 
When a doc comment comes in that shows there's a doc bug, log the doc bug, then paste the link to the bug back into the comment thread so the reporter can track. Then once the bug is fixed, indicate that in the comment also, closing the loop on the doc bug (that was basically submitted through the commenting system.)
 
  
 
== Doc Bug Triaging Guidelines ==
 
== Doc Bug Triaging Guidelines ==

Revision as of 22:31, 9 September 2013

How to Work on OpenStack Documentation

At the core of OpenStack is the community and collaboration that we do - the same rules for the code apply to documentation too. Ideally any code contribution that is merged into the base has documentation to go with it. Anne Gentle is the coordinator for all documentation efforts, both community-based and "official" docs. This page describes the methods we use to create the basis for world-class documentation for OpenStack developers and users.

Tools and Content Overview

The tool used for the documentation depends on the audience for the docs.

We use DocBook to create OpenStack's web documentation for deployers, admins, and CLI and API users. We use ReStructured Text (RST) files stored in source code for developer docs.

To work on the RST source files, find the /doc/source/ directory in a given OpenStack project to work on the source .rst files. These are built to http://docs.openstack.org/developer/<project>, for example, http://docs.openstack.org/developer/nova.

To work on the DocBook source files for admin guides, a working project exists in Github in the http://github.com/openstack/openstack-manuals project since DocBook documentation encompasses all OpenStack projects.

To work on the DocBook and WADL source files for http://api.openstack.org, look for the openstack/api-site project on Github and use the same GerritWorkflow.

All API spec documentation that builds to http://docs.openstack.org/api is housed in image-api, identity-api, compute-api, netconn-api, and object-api repositories. Changes to these are approved by the core development team because they are specifications.

The DocBook builds are listed in the Documentation/Builds page, showing what source files are built from.

Here's a walk through of the contribution process showing how to pick up a doc bug and submit a patch for it.

First-time Contributors

First, thanks for contributing to docs! Secondly, you're just like a developer. In order to get started you need to follow the same steps followed by any other OpenStack developer:

1. Create a Launchpad account and 2. Join the OpenStack Foundation. Then you can 3. 'Sign the Contributor License Agreement: All these steps are fully documented on the CLA page on this wiki. 4. Setup git review and get familiar with the GerritWorkflow

Once you're done withe these preliminary steps you can proceed to

6. Clone the openstack-manuals repository with:


git clone http://github.com/openstack/openstack-manuals.git
cd openstack-manuals


7. Enter your Launchpad account information after testing for ssh key setup with git review -s.


git review -s

Note: If you see any "Permission denied" errors at this step, go to review.openstack.org, log in, and check through all the items in your Settings link to ensure that everything matches. You may need to enter your SSH key in the Gerrit site (review.openstack.org).

Note: If you get the error "We don't know where your gerrit is.", you will need to add a new git remote. The url should be in the error message. Copy that and create the new remote with this command:


git remote add gerrit ssh://<username>@review.openstack.org:29418/openstack/openstack-manuals.git

8. Now you can work on the openstack-manuals locally and submit patches. Refer to the GerritWorkflow steps to contribute your changes.

That should get you started contributing to docs just like code. <section end=first-time-contrib /> Read more for the details of what types of documentation go where.

Building Output Locally

The Clouddocs Maven Plugin and a pom.xml configuration file in combination enable the builds to docs.openstack.org and api.openstack.org.

Here are the quick steps for getting started on the openstack-manuals project once you have acquired the source files:

1. First install the Apache Maven project, and Git

With Macports:


sudo port install maven3
#Install Git by referring to: https://help.github.com/articles/set-up-git#platform-mac

With Homebrew:


brew install maven
#Install Git by referring to: https://help.github.com/articles/set-up-git#platform-mac

on Ubuntu:


sudo apt-get install maven git

on Fedora:


sudo yum install maven git


2. Get a copy of the docs source files.


git clone https://github.com/openstack/openstack-manuals.git


The different manuals are in subdirectories of the openstack-manuals/doc directory.

For example, the root directory of the OpenStack Compute Administration Guide is openstack-manuals/doc/openstack-compute-admin.

To build a specific guide, look for a pom.xml file within a subdirectory, switch to that directory, then run the mvn command in that directory. For example::

cd openstack-manuals/doc/openstack-compute-admin
mvn clean generate-sources

The generated PDF documentation file is::

openstack-manuals/doc/openstack-compute-admin/target/docbkx/webhelp/trunk/openstack-compute/admin/os-compute-adminguide-trunk.pdf

The root of the generated HTML documentation is::

openstack-manuals/doc/openstack-compute-admin/target/docbkx/webhelp/os-compute-adminguide/content/index.html


For the install guides, there's a section in the pom.xml that tells the build whether to create the ubuntu version of the guide or the RHEL/CentOS/Fedora version of the guide. Right now, the master branch pom.xml file defaults to ubuntu with this section:


<!-- This is set by Jenkins according to the branch. -->
        <release.path.name>local</release.path.name>
        <comments.enabled>1</comments.enabled>
        <operating.system>apt</operating.system>
        <!-- This is set by Jenkins to run twice for each similar operating system group -->
        <profile.os>ubuntu</profile.os>


If you want to build the RHEL/CentOS/Fedora version of the install guide, change that section to this instead:


<!-- This is set by Jenkins according to the branch. -->
        <release.path.name>local</release.path.name>
        <comments.enabled>1</comments.enabled>
        <operating.system>yum</operating.system>
        <!-- This is set by Jenkins to run twice for each similar operating system group -->
        <profile.os>rhel;centos;fedora</profile.os>


And then re-run the mvn clean generate-sources command to get the RHEL output.

The RST source is built into html using Sphinx so that it gets displayed on Nova developer site, Swift developer site, Glance developer site, and Keystone developer site.

The DocBook source is built into html (webhelp) and PDF using XSLT transforms included with the DocBook project.

You can find tips for troubleshooting the build at: Documentation/Troubleshooting

Reviewing Documentation

To see what documentation changes are ready for review, go to http://review.openstack.org and search for project:openstack/openstack-manuals. Or go to this page with the search already completed.

Who can Review Documentation?

All community members can review doc patches and give them +1 or -1. Documentation Core members can give +2 or -2 votes and also click Approve so that the doc goes live, published to docs.openstack.org or api.openstack.org, based on the branch the patch is applied to. Docs core members should only click Approve if they've given a +2, otherwise the Jenkins build jobs are not triggered.

Because the Docs team is small, core members have the choice when reviewing and must use best judgement before publishing. Generally speaking, core members will wait for one other core member to +2 a doc patch. However if the change is small and the build works, a doc core member can +2 and Approve a change without waiting for another reviewer. This is a judgement call so docs core people should exercise caution when using this option.

There is a core training team being established, and they can +2 and Approve content in the openstack-manuals repo in the openstack-training folder only.

Once two community members approve a doc patch, a doc core member can also review it and push it through without waiting for a second core member.

How to Review a Documentation Patch

Click a patch set.

Click a file that has changed to view the changes side by side.

Click the Review button and vote, then enter any comments about your review.

Usually small changes are easy to review online. For larger changes, you want to bring the changes locally to ensure they build correctly and to review the output as well as the source. Here's how:


git review -d <nnnnn>


Where the value of nnnnn comes from the review.openstack.org URL, such as 11215 from the URL https://review.openstack.org/#/c/11215/.

The git review tool creates a new branch locally with the patch set. Change directories to the one containing the pom.xml for the deliverable you want to build and run:


mvn clean generate-sources


Review the source and the output, and feel free to edit and patch it as well. When you're sure the build and output are good, run:


git commit -a --amend


When the editor opens, write a new line telling the reason for the patch set.

Enter colon + w + q to save and exit the editor with the amended commit message. You can change the commit message to be more descriptive or to match the guidelines in GitCommitMessages, but you do not need to add what your specific patchset changes. A reviewer can use the Gerrit interface to see the difference between patches.

Next, run:


git review


To send your patch to patch the existing review.

Documentation Checklist

After you create or revise a doc, use the Documentation/Checklist to ensure consistency.

What Docs Go Where?

wiki RST
Use for project docs, blueprint specs. Use for Python developer documentation and quick starts.
The audience is any project team member of OpenStack. The audience is Python developers who want to work on the project.
Output is per-page at wiki.openstack.org Output goes to docs.openstack.org/developer/nova.

wiki.openstack.org (wikitext or RST)

The OpenStack wiki contains project docs, specs for blueprints, and meeting information and minutes. If there's a page you want to keep an eye on (like Nova installations for example), add it to your Notifications list (under User > Settings > Notifications in the wiki).

docs.openstack.org/developer/<projectname> (RST)

The RST pages stored with the project code should be written with a developer audience in mind, although many times you'll find there is overlap in what an admin needs to know and what a developer needs to know. High priorities for those sites are wider coverage of doc strings, API doc, i18N methodology, and architecture concepts that'll help developers.

docs.openstack.org (DocBook 5)

As mentioned above, the source for this site is housed in Github in the http://github.com/openstack/openstack-manuals project, the Launchpad page for this project is https://launchpad.net/openstack-manuals. You can either build the output locally if you want, or just submit changes to the source XML through merge proposals. The OpenStack Jenkins build server builds the doc and copies the output to docs.openstack.org/trunk automatically thanks to the pom.xml files included in the source files.

  • doc/$BOOK contains the DocBook XML source files and images

When editing DocBook documentation, please adhere to the DocBook 5 syntax. If you've used DocBook version 4 or earlier before, and you're not familiar with the changes that DocBook saw in V5.0, the Transition Guide is a helpful read.

Maven Plugin

The Cloud Doc Tools Maven plugin provides a build tool that Jenkins can use to build PDF and HTML from DocBook and WADL source files. It's maintained at https://github.com/rackerlabs/clouddocs-maven-plugin and we track bugs against the output in the openstack-manuals launchpad project.

The release notes are available on Github.

Doc Bug Triaging Guidelines

Doc bugs are logged and triaged at http://bugs.launchpad.net/openstack-manuals. You can see how well we're doing with bugs at this webnumbr. Here are some definitions for Status and Importance so you can triage incoming doc bugs.

Status:

New - Recently logged by a non-triaging person

Incomplete - Needs additional information before it can be triaged

Opinion - (not sure what to do with this one)

Invalid - Not an issue for docs

Won't Fix - Doc fixes won't fix the issue

Confirmed - Acknowledged that it's a doc bug

Triaged - Comments in the bug indicate its scope and amount of work to be done

In Progress - Someone is working on it

Fix Committed - A fix is in the repository; Gerrit sets this automatically

Fix Released - A fix is published to the site; would like the CI team to set this automatically, bug filed bug 943413

Importance:

Critical - data will be lost if this bug stays in; or it's so bad that we're better off fixing it than dealing with all the incoming questions about it. Also items on the website itself that prevent access are Critical doc bugs.

High - Definitely need docs about this or a fix to current docs; docs are incomplete without this. Work on these first if possible.

Medium - Need docs about this within a six-month release timeframe.

Low - Docs are fine without this but could be enhanced by fixing this bug.

Wishlist - Would like this doc task done "some day" Would prefer to use this for "tasks" instead of "bugs" - mark a bug as low rather than putting it on the wishlist. When something is wrong with the doc, mark it as Low rather than Wishlist.

Undecided - Recently logged by a non-triaging person or requires more research before deciding its importance.

Doc Bug Categories

If you want to help with bug fixing, here are some quick ways to select a certain subset of them

Audiences and Targets

OpenStack has three main projects - Compute (nova), Object Storage (swift), and now an imaging service (glance). While the goals you'd achieve using each project vary, the three projects can also be used together. Those three projects have two basic audiences - developers and sysadmins (think operations or dev-ops). The RST-based documentation, because it automatically generates doc from docstrings in the code, is much more for a developer audience. There are two types of developers that the developer documentation serves - Python developers who want to work on OpenStack code, and web developers who work with the OpenStack API.

Workflow

The workflow for documentation matches the workflow for code - you download a branch, work on it locally, then commit the changes and propose a merge. Members of the openstack-doc-core team and others review your changes and after receiving enough +1 votes, an openstack-doc-core member can push +1 Approved. Once approved, your changes are merged into the main, published doc base, and the doc is built to its varying outputs with the Jenkins server.

Detailed Workflow with Github and Gerrit

The page I always refer to for using Git and Gerrit for daily tasks is http://wiki.openstack.org/GerritWorkflow.

The workflow takes some startup work to get the accounts you need. First, you make a Launchpad account, and upload a public key. Then, you identify your Launchpad account to the git command line and away you go. You also need a Github account. The Launchpad account contains the signon and permissions information for the Gerrit workflow that we use for reviews.

Here's a sample for the documentation project specifically, once you get your Launchpad and Github accounts set up.

Create the directory where you want to store the doc source files, then switch to it.


mkdir ~/src/docs

cd ~/src/docs

Follow the steps in GerritWorkflow, using a doc repo to get the source:

openstack-manuals api-site compute-api identity-api image-api object-api netconn-api volume-api

As an example, here's how you check out all the files for the admin docs in openstack-manuals:


git clone git://github.com/openstack/openstack-manuals.git

Set up the Gerrit Change-Id hook, which is used for reviews, and run git review to run a script in the /tools directory which sets up the remote repository correctly:


cd $PROJECT
git review

Now make sure you have the latest from Github (docs move more slowly than code, but this is a good practice).


git checkout master
git pull origin master

Lastly, create a branch to do your work in that you'll do commits from:


git checkout -b TOPIC-BRANCH

Edit happily! You can use Oxygen since you're working on an open source project and we acknowledge their support.

When you're done with edits, if you've added any files do this in the working directory:


git add .

Next, you commit your changes with a message that'll be displayed in review.openstack.org, creating a change set:


git commit -a -m 'bug xxxxxxx Here's what I did in this set of changes'

Next, push your changes for review with:


git review

Go to the review site itself to see the review votes for the openstack-manuals project, at review.openstack.org. One of the core doc team members will review your edits and let you know if any changes are needed prior to merging them in.

How to amend a review-in-progress

Within the repository for which you have a patch, make sure you don't have any work-in-progress changes that you have not committed yet. If needed, commit those changes and then restart your work by working in another branch as shown below.

Then do these steps:

git checkout master
git remote update
git pull origin master
git review -d 38710

where 38710 is the identifier found in the review.openstack.org URL for the patch set, such as https://review.openstack.org/#/c/38710/.

A new branch is created and checked out that you'll work within.

Then make your edits in the new branch that is created. Once edits are complete, do:

git commit -a --amend

and in the vi editor, add more lines to your commit message to explain the reasons for the patch set.

Press Esc :wq to save the message and quit the VI editor.

Then do:

git review -v

How to a make changes to a stable branch

Let's say you have a docfix specific to the Grizzly documentation, which is closed. You can check out the stable/grizzly branch and make changes. 
Be very considerate of what you are documenting specifically for the stable release and why. If it applies to the stable release and ongoing releases, you have to make your edits twice. 

1. Create a bug if one does not exist. Otherwise, note the bug number for your change.

2. Make sure your repository is up to date:

git fetch origin

3. Create a topic branch by branching from grizzly, where 1234567 is the bug number:

git checkout -b grizzly-bug/1234567 remotes/origin/stable/grizzly

4. Make changes to your documents.

5. Commit your changes:

git add .
git commit -a 

5. In the commit message, add the bug #, like this:

Updated xxx

bug: #1234567

author: diane fleming

6. Submit your commit for review:

git review stable/grizzly

How to a cherry-pick a change to a stable branch

Let's say a docfix was submitted to the master openstack-manuals branch, and you want this change to be reflected in the Grizzly documentation, which is closed. You can cherry pick the change and submit it.

Let's say we want to cherry-pick bug/948242 (review 7480) into grizzly.

1. Make sure your repository is up to date:

git fetch origin

2. Create a topic branch by branching from grizzly:

git checkout -b grizzly-bug/948242 remotes/origin/stable/grizzly

3. On the Gerrit web page that contains the review you want to backport, click "cherry-pick"
It's under Patch Set N, in the Download row.
Copy the text, and then paste it into your terminal.
For example, for review 7480, it looks like this:

git fetch https://review.openstack.org/openstack/openstack-manuals refs/changes/80/7480/2 && git cherry-pick FETCH_HEAD

4. Amend the commit log and submit for review. Add something like Cherry picked from http://review.openstack.org/7480:

git commit --amend -m ''Cherry picked from http://review.openstack.org/7480''
git review stable/grizzly

Editor Options

We encourage the use of Oxygen XML Author for editing XML - it offers consistency in white space which makes diffs in review.openstack.org easier. If you prefer a text-based editor but with validation, you can use Emacs. Here are some great resources on DocBook and Emacs' NXML mode:

If you prefer vi, there are ways to make DocBook editing easier:

Oxygen XML Acknowledgment

Thanks to the generosity of Oxygen in supporting open source projects, you can edit DocBook XML within the Oxygen Author or Editor by downloading a copy of the software from http://www.oxygenxml.com/. Send an email to anne at openstack dot org to request the license extension beyond the 30-day trial. As we have 10 floating licenses, you're encouraged to procure it through other channels if you work for a member OpenStack company.

Oxygen and the Rackbook Framework

Thanks to Rackspace maintaining Oxygen tools that make authoring DocBook and WADL, we can offer a Rackbook framework. You can run directly from http://docs.rackspace.com/oxygen/. You will need to add a valid Oxygen license to use the application.

Alternatively, download the oxygen-frameworks.zip file. Next, download the following file to your system: defaults.xpr. Extract the oxygen-frameworks.zip file to ~/Library/Preferences (i.e. so you end up with /Users/your.username/Library/Preferences/com.oxygenxml.author). In Oxygen, go to Options->Import Global Options. Navigate to the downloaded defaults.xpr file and click Open.You should see a new bar of buttons and a Rackbook menu item.

Translation

Translation efforts occur in the Transifex web site. Review the Documentation/Translation for all the technical details.

Markup Conventions

See Documentation/Conventions for markup information.