|
1 | | -# Contributing Guide |
| 1 | +# Documentation contributing guide |
2 | 2 |
|
3 | | -Thank you for deciding to contribute and help us improve Percona Distribution for PostgreSQL documentation! |
| 3 | +This guide explains how to contribute to the Percona Distribution for PostgreSQL documentation. |
4 | 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). |
| 5 | +We welcome contributors from all users and the community. By contributing, you agree to the [Percona Community code of conduct](https://github.com/percona/community/blob/main/content/contribute/coc.md). |
6 | 6 |
|
7 | | -You can contribute to documentation in the following ways: |
| 7 | +If you want to contribute code, see the [Code contribution guide](https://github.com/percona/postgres/blob/PSP_REL_18_STABLE/.github/CONTRIBUTING.md). |
8 | 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. |
| 9 | +You can contribute to documentation in the following ways: |
10 | 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. |
| 11 | +1. Request documentation changes through Jira: |
14 | 12 |
|
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. |
| 13 | +- Open the [Jira issue tracker](https://jira.percona.com/projects/PG/issues) for the project. |
| 14 | +- Sign in (create a Jira account if you don’t have one). |
| 15 | +- Click **Create** to create an issue. |
| 16 | +- (Optional but recommended) Search if the issue you want to report is already reported. |
| 17 | +- Select **PostgreSQL PG** in the Project dropdown and the work type. |
| 18 | +- Describe the issue in the Summary and Description fields. Optionally, you can also fill in the Steps To Reproduce and Affects Version fields. |
16 | 19 |
|
17 | | - |
| 20 | +2. [Contribute to documentation on GitHub](#contribute-directly-on-github). |
18 | 21 |
|
19 | | -## Contribute to documentation yourself |
| 22 | +To contribute to the documentation, basic familiarity with the following tools is useful: |
20 | 23 |
|
21 | | -To contribute to the documentation, you should be familiar with the following technologies: |
22 | | -- [Markdown](https://www.markdownguide.org/basic-syntax/) markup language. It is used to write the documentation. |
| 24 | +- [Markdown](https://www.markdownguide.org/basic-syntax/). The documentation is written in Markdown. |
23 | 25 | - [MkDocs](https://www.mkdocs.org/getting-started/) documentation generator. We use it to convert source ``.md`` files to html and PDF documents. |
24 | 26 | - [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 MkDocs in a virtual environment instead of installing it and its dependencies on your machine. |
26 | 27 |
|
27 | | -There are several active versions of the documentation. Each version derives from the major version of PostgreSQL, included in the distribution. |
| 28 | +## Contribute directly on GitHub |
| 29 | + |
| 30 | +There are several active versions of the documentation. Each version derives from the major version of PostgreSQL, included in the distribution. |
28 | 31 |
|
29 | | -Each version has a branch in the repository named accordingly: |
| 32 | +Each documentation branch is named after the PostgreSQL major version (for example: `11`(EOL), `12`(EOL), `13`(EOL), `14`, `15`, `16`, `17`, `18`). |
30 | 33 |
|
31 | | -- 11 (EOL) |
32 | | -- 12 (EOL) |
33 | | -- 13 |
34 | | -- 14 |
35 | | -- 15 |
36 | | -- 16 |
37 | | -- 17 |
| 34 | +The source .md files are in the ``postgresql-docs/docs`` directory. |
38 | 35 |
|
39 | | -The source .md files are in the ``docs`` directory. |
| 36 | +To start contributing: |
40 | 37 |
|
41 | | -### Edit documentation online via GitHub |
| 38 | +1. Select **Edit this file**. |
42 | 39 |
|
43 | | -1. Click the **Edit this page** link on the sidebar. The Markdown 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 | +> **NOTE** |
| 41 | +> 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. |
44 | 42 |
|
45 | | -2. Edit the page. You can check your changes on the **Preview** tab. |
| 43 | +2. Add your changes. You can see how your edit looks in the **Preview** tab. |
46 | 44 |
|
47 | 45 | 3. Commit your changes. |
48 | 46 |
|
49 | | - - In the *Commit changes* section, describe your changes. |
50 | | - - Select the **Create a new branch for this commit and start a pull request** option |
51 | | - - Click **Propose changes**. |
| 47 | +- Describe the changes you have made |
| 48 | +- Select the **Create a new branch for this commit** and name your branch |
| 49 | +- Click **Propose changes** to create the pull request |
52 | 50 |
|
53 | | -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. |
54 | | -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. |
| 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 last-minute changes. When you are ready, click the **Create pull request** button. |
55 | 52 |
|
56 | | -### Edit documentation locally |
| 53 | +5. Your changes will be reviewed and merged into the documentation. |
57 | 54 |
|
58 | | -This option is for users who prefer to work from their computer and / or have the full control over the documentation process. |
| 55 | +### Edit documentation locally |
59 | 56 |
|
60 | | -The steps are the following: |
| 57 | +If you want to work on your computer locally, follow these steps: |
61 | 58 |
|
62 | 59 | 1. Fork this repository |
63 | 60 | 2. Clone the repository on your machine: |
64 | 61 |
|
65 | 62 | ```sh |
66 | | -git clone git@github.com:percona/postgresql-docs.git |
| 63 | +git clone git@github.com:<my_name>/postgresql-docs.git |
| 64 | +cd postgresql-docs |
67 | 65 | ``` |
68 | 66 |
|
69 | | -3. Change the directory to ``postgresql-docs`` and add your local repository: |
| 67 | +3. Add the upstream (Percona) repository as a remote: |
70 | 68 |
|
71 | 69 | ```sh |
72 | | -git remote add <your-repo-name> git@github.com:<your_name>/postgresql-docs.git |
| 70 | +git remote add upstream git@github.com:percona/postgresql-docs.git |
73 | 71 | ``` |
74 | 72 |
|
75 | | -4. Pull the latest changes |
| 73 | +4. Pull the latest changes |
76 | 74 |
|
77 | 75 | ```sh |
78 | | -git fetch origin |
79 | | -git merge origin/<branch> |
| 76 | +git fetch upstream |
| 77 | +git merge upstream/<branch> |
80 | 78 | ``` |
81 | 79 |
|
82 | | -Make sure that your local branch and the branch you merge changes from are the same. So if you are on ``15`` branch, merge changes from ``origin/15``. |
| 80 | +Make sure you merge changes from the same documentation branch you are working on. For example, if you are on branch ``15``, merge from ``upstream/15``. |
83 | 81 |
|
84 | | -5. Create a separate branch for your changes |
| 82 | +5. Create a separate branch for your changes. If you work on a Jira issue, please follow this pattern for a branch name: `<PG-123>-short-description`: |
85 | 83 |
|
86 | 84 | ```sh |
87 | | -git checkout -b <my_changes> |
| 85 | +git checkout -b <PG-123>-short-description upstream/<target-branch> |
88 | 86 | ``` |
89 | 87 |
|
90 | | -6. Make changes |
91 | | -7. Commit your changes |
92 | | -8. Open a pull request to Percona |
93 | | - |
94 | | -### Building the documentation |
95 | | - |
96 | | -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: |
97 | | -- [use Docker](#use-docker) |
98 | | -- [install MkDocs and build locally](#install-mkdocs-and-build-locally) |
99 | | - |
100 | | -Learn more about the documentation structure in the [Repository structure](#repository-stucture) section. |
101 | | - |
102 | | - |
103 | | -#### Use Docker |
104 | | - |
105 | | -1. [Get Docker](https://docs.docker.com/get-docker/) |
106 | | -2. We use [this Docker image](https://github.com/Percona-Lab/percona-doc-docker) to build documentation. Run the following command: |
| 88 | +6. Make a commit mentioning the Jira issue in the commit message if any: |
107 | 89 |
|
108 | 90 | ```sh |
109 | | -docker run --rm -v $(pwd):/docs perconalab/pmm-doc-md mkdocs build |
| 91 | +git add . |
| 92 | +git commit -m "PG-123-<my_fixes>" |
| 93 | +git push -u origin <my_branch_name> |
110 | 94 | ``` |
111 | | - If Docker can't find the image locally, it first downloads the image, and then runs it to build the documentation. |
112 | 95 |
|
113 | | -3. Go to the ``site`` directory and open the ``index.html`` file to see the documentation. |
114 | | -4. To view your changes as you make them, run the following command: |
| 96 | +7. Open a pull request to Percona |
115 | 97 |
|
116 | | -``` sh |
117 | | -docker run --rm -p 8000:8000 -v $(pwd):/docs perconalab/pmm-doc-md mkdocs serve -a 0.0.0.0:8000 |
118 | | -``` |
| 98 | +### Building the documentation using MkDocs |
119 | 99 |
|
120 | | -5. To create a PDF version of the documentation, run the following command: |
| 100 | +To verify how your changes look, generate the static site with the documentation. This process is called *building*. |
121 | 101 |
|
122 | | -```sh |
123 | | -docker run --rm -v $(pwd):/docs perconalab/pmm-doc-md -f mkdocs-pdf.yml |
124 | | -``` |
125 | | - |
126 | | -The PDF document is in the ``site/pdf`` folder. |
| 102 | +> **NOTE** |
| 103 | +> Learn more about the documentation structure in the [Repository structure](#repository-structure) section. |
127 | 104 |
|
128 | | -#### Install MkDocs and build locally |
| 105 | +To verify how your changes look, you can generate a static site locally: |
129 | 106 |
|
130 | 107 | 1. Install [pip](https://pip.pypa.io/en/stable/installing/) |
131 | 108 | 2. Install [MkDocs](https://www.mkdocs.org/getting-started/#installation). |
132 | | -3. While in the root directory of the doc project, run the following command to build the documentation: |
| 109 | +3. Install all the required dependencies: |
| 110 | + |
| 111 | +```sh |
| 112 | +pip install -r requirements.txt |
| 113 | +``` |
| 114 | + |
| 115 | +4. While in the root directory of the documentation project, run the following command to build the documentation: |
133 | 116 |
|
134 | 117 | ```sh |
135 | 118 | mkdocs build |
136 | 119 | ``` |
137 | | -4. Go to the ``site`` directory and open the ``index.html`` file in your web browser to see the documentation. |
138 | | -5. To automatically rebuild the documentation and reload the browser as you make changes, run the following command: |
| 120 | + |
| 121 | +5. Go to the ``site`` directory and open the ``index.html`` file in your web browser to see the documentation. |
| 122 | +6. To automatically rebuild the documentation and reload the browser as you make changes, run the following command: |
139 | 123 |
|
140 | 124 | ```sh |
141 | 125 | mkdocs serve |
142 | 126 | ``` |
143 | 127 |
|
144 | | -6. To build the PDF documentation, do the following: |
| 128 | +You can also view the site at <http://127.0.0.1:8000>. |
| 129 | + |
| 130 | +7. To build the PDF documentation, do the following: |
145 | 131 | - Install [mkdocs-print-site-plugin](https://timvink.github.io/mkdocs-print-site-plugin/index.html) |
146 | 132 | - Run the following command |
147 | 133 |
|
148 | 134 | ```sh |
149 | | - mkdocs build |
| 135 | + mkdocs build |
150 | 136 | ``` |
151 | 137 |
|
152 | | - This creates a single HTML page for the whole doc project. You can find the page at `site/print_page.html`. |
153 | | - |
154 | | -7. Open the `site/print_page.html` in your browser and save as PDF. Depending on the browser, you may need to select the Export to PDF, Print - Save as PDF or just Save and select PDF as the output format. |
155 | | - |
| 138 | +This creates a single HTML page for the whole doc project. You can find the page at `site/print_page.html`. |
156 | 139 |
|
| 140 | +8. Open the `site/print_page.html` in your browser and save as PDF. Depending on the browser, you may need to select the Export to PDF, Print - Save as PDF or just Save and select PDF as the output format. |
157 | 141 |
|
158 | 142 | ## Repository structure |
159 | 143 |
|
160 | 144 | The repository includes the following directories and files: |
161 | 145 |
|
162 | 146 | - `mkdocs-base.yml` - the base configuration file. It includes general settings and documentation structure. |
163 | | -- `mkdocs.yml` - configuration file. Contains the settings for building the docs on Percona website |
| 147 | +- `mkdocs.yml` - configuration file. Contains the settings for building the documentation on Percona website |
164 | 148 | - `docs`: |
165 | 149 | - `*.md` - Source markdown files. |
166 | 150 | - `_images` - Images, logos and favicons |
167 | 151 | - `css` - Styles |
168 | 152 | - `js` - Javascript files |
169 | | - - `templates` - the PDF cover page template |
170 | | -- `_resource`: |
171 | | - - `overrides` - The directory with customized templates for HTML output |
172 | | - - `main.html` - The layout template for hosting the documentation on Percona website |
| 153 | + - `templates`: |
| 154 | + - `pdf_cover_page.tpl` - The PDF cover page template |
173 | 155 | - `_resourcepdf`: |
174 | 156 | - `overrides` - The directory with customized layout templates for PDF |
175 | 157 | - `.github`: |
176 | 158 | - `workflows`: |
177 | 159 | - `main.yml` - The workflow configuration for building documentation with a GitHub action. (The documentation is built with `mike` tool to a dedicated `publish` branch) |
| 160 | +- `snippets` - The folder with pieces of documentation used in multiple places |
178 | 161 | - `site` - This is where the output HTML files are put after the build |
179 | | -- `snippets` - The folder with pieces of documentation used in multiple places |
0 commit comments