|
| 1 | +# Contributing Guide |
| 2 | + |
| 3 | +Thank you for deciding to contribute and help us improve Percona Distribution for PostgreSQL documentation! |
| 4 | + |
| 5 | +We welcome contributors from all users and community. By contributing, you agree to the [Percona Community code of conduct](https://github.com/percona/community/blob/main/content/contribute/coc.md). |
| 6 | + |
| 7 | +You can contribute to documentation in the following ways: |
| 8 | + |
| 9 | +1. **Request a doc change through a Jira issue**. If you’ve spotted a doc issue (a typo, broken links, inaccurate instructions, etc.) but don’t have time nor desire to fix it yourself - let us know about it. |
| 10 | + |
| 11 | + - Click the **Submit DOC bug** link on the sidebar. This opens the [Jira issue tracker](https://jira.percona.com/projects/DISTPG/issues) for the doc project. |
| 12 | + - Sign in (create a Jira account if you don’t have one) and click **Create** to create an issue. |
| 13 | + - Describe the issue you have detected in the Summary, Description, Steps To Reproduce, Affects Version fields. |
| 14 | + |
| 15 | +2. **[Contribute to documentation yourself](#contribute-to-documentation-yourself)**. There is the **Edit this page** link that leads you to the source file of the page on GitHub. There you make changes, create a pull request that we review and add to the doc project. For details how to do it, read on. |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +## Contribute to documentation yourself |
| 20 | + |
| 21 | +To contribute to the documentation, you should be familiar with the following technologies: |
| 22 | +- [reStructured text](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html) markup language. It is used to write the documentation. |
| 23 | +- [Sphinx](https://www.sphinx-doc.org/en/master/usage/quickstart.html) documentation generator. We use it to convert source ``.rst`` files to html and PDF documents. |
| 24 | +- [git](https://git-scm.com/) and [GitHub](https://guides.github.com/activities/hello-world/) |
| 25 | +- [Docker](https://docs.docker.com/get-docker/). It allows you to run Sphinx in a virtual environment instead of installing it and its dependencies on your machine. |
| 26 | + |
| 27 | +There are several active versions of the documentation. Each version derives from the major version of PostgreSQL, included in the distribution. |
| 28 | + |
| 29 | +Each version has a branch in the repository named accordingly: |
| 30 | + |
| 31 | +- 11 |
| 32 | +- 12 |
| 33 | +- 13 |
| 34 | + |
| 35 | +The .rst files are in the ``source`` directory. |
| 36 | + |
| 37 | +### Edit documentation online via GitHub |
| 38 | + |
| 39 | +1. Click the **Edit this page** link on the sidebar. The source ``.rst`` file of the page opens in GitHub editor in your browser. If you haven’t worked with the repository before, GitHub creates a [fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) of it for you. |
| 40 | + |
| 41 | +2. Edit the page. You can check your changes on the **Preview** tab. |
| 42 | + |
| 43 | + **NOTE**: GitHub’s native markup language is [Markdown](https://daringfireball.net/projects/markdown/) which differs from the reStructured text. Therefore, though GitHub renders titles, headings and lists properly, some rst-specific elements like variables, directives, internal links will not be rendered. |
| 44 | + |
| 45 | +3. Commit your changes. |
| 46 | + |
| 47 | + - In the *Commit changes* section, describe your changes. |
| 48 | + - Select the **Create a new branch for this commit and start a pull request** option |
| 49 | + - Click **Propose changes**. |
| 50 | + |
| 51 | +4. GitHub creates a branch and a commit for your changes. It loads a new page on which you can open a pull request to Percona. The page shows the base branch - the one you offer your changes for, your commit message and a diff - a visual representation of your changes against the original page. This allows you to make a last-minute review. When you are ready, click the **Create pull request** button. |
| 52 | +5. Someone from our team reviews the pull request and if everything is correct, merges it into the documentation. Then it gets published on the site. |
| 53 | + |
| 54 | +### Edit documentation locally |
| 55 | + |
| 56 | +This option is for users who prefer to work from their computer and / or have the full control over the documentation process. |
| 57 | + |
| 58 | +The steps are the following: |
| 59 | + |
| 60 | +1. Fork this repository |
| 61 | +2. Clone the repository on your machine: |
| 62 | + |
| 63 | +```sh |
| 64 | +git clone git@github.com:<your_name>/postgresql-docs.git |
| 65 | +``` |
| 66 | + |
| 67 | +3. Change the directory to ``postgresql-docs`` and add the remote upstream repository: |
| 68 | + |
| 69 | +```sh |
| 70 | +git remote add upstream git@github.com:percona/postgresql-docs.git |
| 71 | +``` |
| 72 | + |
| 73 | +4. Pull the latest changes from upstream |
| 74 | + |
| 75 | +```sh |
| 76 | +git fetch upstream |
| 77 | +git merge upstream/<branch> |
| 78 | +``` |
| 79 | +Make sure that your local branch and the branch you merge changes from are the same. So if you are on ``11`` branch, merge changes from ``upstream/11``. |
| 80 | + |
| 81 | +5. Create a separate branch for your changes |
| 82 | + |
| 83 | +```sh |
| 84 | +git checkout -b <my_changes> |
| 85 | +``` |
| 86 | + |
| 87 | +6. Make changes |
| 88 | +7. Commit your changes |
| 89 | +8. Open a pull request to Percona |
| 90 | + |
| 91 | +### Building the documentation |
| 92 | + |
| 93 | +To verify how your changes look, generate the static site with the documentation. This process is called *building*. You can do it in these ways: |
| 94 | +- [use Docker](#use-docker) |
| 95 | +- [install Sphinx and build locally](#install-sphinx-and-build-locally) |
| 96 | + |
| 97 | +#### Use Docker |
| 98 | + |
| 99 | +1. [Get Docker](https://docs.docker.com/get-docker/) |
| 100 | +2. We use [this Docker image](https://hub.docker.com/r/ddidier/sphinx-doc) to build documentation. Run the following command: |
| 101 | + |
| 102 | +```sh |
| 103 | +docker run --rm -i -v `pwd`:/doc -e USER_ID=$UID ddidier/sphinx-doc:0.9.0 make clean html |
| 104 | +``` |
| 105 | + If Docker can't find the image locally, it first downloads the image, and then runs it to build the documentation. |
| 106 | + |
| 107 | +3. Go to the ``build/html`` directory and open the ``index.html`` file to see the documentation. |
| 108 | +4. Your static site will look different from the one on the web site. This is because we use a Percona theme that is rendered when the documentation is published on the web. To view the documentation with Alabaster theme, run the following command: |
| 109 | + |
| 110 | +```sh |
| 111 | +docker run --rm -i -v `pwd`:/doc -e USER_ID=$UID ddidier/sphinx-doc:0.9.0 make clean thtml |
| 112 | +``` |
| 113 | + |
| 114 | +5. To create a PDF version of the documentation, run the following command: |
| 115 | + |
| 116 | +```sh |
| 117 | +docker run -i -v `pwd`:/doc -e USER_ID=$UID ddidier/sphinx-doc:0.9.0 make clean latex && docker run -i -v `pwd`:/doc -e USER_ID=$UID ddidier/sphinx-doc:0.9.0 make clean latexpdf |
| 118 | +``` |
| 119 | + |
| 120 | +The PDF document is in the ``build/latex`` folder. |
| 121 | + |
| 122 | +#### Install Sphinx and build locally |
| 123 | + |
| 124 | +1. Install [pip](https://pip.pypa.io/en/stable/installing/) |
| 125 | +2. Install [Sphinx](https://www.sphinx-doc.org/en/master/usage/installation.html). |
| 126 | +3. While in the root directory of the doc project, run the following command to build the documentation: |
| 127 | + |
| 128 | +```sh |
| 129 | +make clean html |
| 130 | +``` |
| 131 | +4. Go to the ``build/html`` directory and open the ``index.html`` file in your web browser to see the documentation. |
| 132 | +5. Your static site will look different from the one on the web site. This is because we use a Percona theme that is rendered when the documentation is published on the web. To view the documentation with Alabaster theme, run the following command: |
| 133 | + |
| 134 | +```sh |
| 135 | +make clean thtml |
| 136 | +``` |
| 137 | +6. To automatically rebuild the documentation and reload the browser as you make changes, do the following: |
| 138 | + - Install [sphinx-autobuild extension](https://pypi.org/project/sphinx-autobuild/) |
| 139 | + - Run the following command |
| 140 | + |
| 141 | + ```sh |
| 142 | + make livehtml |
| 143 | + ``` |
| 144 | + |
| 145 | +7. To create a PDF version of the documentation, run the following command: |
| 146 | + |
| 147 | +```sh |
| 148 | +make clean latexpdf |
| 149 | +``` |
| 150 | + |
| 151 | +The PDF document is in the ``build/latex`` folder. |
0 commit comments