Skip to content

Commit 20c1264

Browse files
authored
Add chapters to the docs navigation, allow building docs in docker. (#954)
We have lots of documentation and the main navigation is crowded, so split it in several chapters with clear names. Also, allow to build (and serve) the docs from a docker image to make it easy for contributors to check their work. This also makes it possible to build the docs in the CI.
1 parent 5a99c5a commit 20c1264

8 files changed

Lines changed: 99 additions & 14 deletions

File tree

.dockerignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
.git
22
src/bin/pg_autoctl/pg_autoctl
3-
docs
43
Dockerfile
54

5+
docs/tutorial/monitor
6+
docs/tutorial/node1
7+
docs/tutorial/node2
8+
docs/tikz/*svg
9+
docs/tikz/*pdf
10+
docs/tikz/*png
11+
612
# Global excludes across all subdirectories
713
*.o
814
*.bc

.github/workflows/run-tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
TEST: linting
3737
steps:
3838
- name: Checkout repository
39-
uses: actions/checkout@v2
39+
uses: actions/checkout@v3
4040

4141
- name: Set environment variables
4242
run: |
@@ -62,6 +62,11 @@ jobs:
6262
run: |
6363
make lint
6464
65+
- name: Build documentation
66+
if: ${{ env.TEST == 'linting' }}
67+
run: |
68+
make build-docs
69+
6570
- name: Build Docker Test Image
6671
if: ${{ env.TEST != 'linting' }}
6772
run: |

Dockerfile.docs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM debian:bullseye-slim
2+
3+
RUN apt-get update \
4+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
5+
curl \
6+
git \
7+
gawk \
8+
make \
9+
python3 \
10+
python3-sphinx \
11+
python3-pip \
12+
sudo \
13+
texlive \
14+
texlive-luatex \
15+
texlive-latex-extra \
16+
texlive-fonts-extra \
17+
latexmk \
18+
poppler-utils \
19+
&& rm -rf /var/lib/apt/lists/*
20+
21+
RUN pip3 install sphinx_rtd_theme
22+
23+
WORKDIR /usr/src/pg_auto_failover
24+
25+
COPY Makefile ./
26+
COPY ./src ./src
27+
COPY ./docs ./docs
28+
29+
# avoid building the main binary to generate the FSM graphics
30+
RUN touch docs/fsm.png
31+
RUN touch src/bin/pg_autoctl/git-version.h
32+
33+
# still make sure we can produce the tikz graphics (pdf, svg)
34+
# use TERM=dumb to avoid tput error messages when we don't have a terminal
35+
RUN make TERM=dumb -C docs/tikz clean all
36+
37+
# and finally use python-sphinx to produce the docs in html
38+
RUN make -C docs html
39+
40+
RUN find docs
41+
42+
EXPOSE 8000/tcp
43+
CMD ["python3", "-m", "http.server", "--directory", "docs/_build/html"]

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ BUILD_CONTAINER_NAME = pg_auto_failover_build
2020
TEST_CONTAINER_NAME = pg_auto_failover_test
2121
DOCKER_RUN_OPTS = --privileged --rm
2222

23+
# make serve-docs uses this port on localhost to expose the web server
24+
DOCS_PORT = 8000
25+
2326
PGVERSION ?= 14
2427

2528
BUILD_ARGS_PG11 = --build-arg PGVERSION=11 --build-arg CITUSTAG=v9.5.10
@@ -243,6 +246,12 @@ spellcheck:
243246
docs: $(FSM) tikz
244247
$(MAKE) -C docs html
245248

249+
build-docs:
250+
docker build -t pg_auto_failover:docs -f Dockerfile.docs .
251+
252+
serve-docs: build-docs
253+
docker run --rm -it -p $(DOCS_PORT):8000 pg_auto_failover:docs
254+
246255
tikz:
247256
$(MAKE) -C docs/tikz all
248257

docs/citus-quickstart.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _citus_quickstart:
22

3-
Citus Cluster Quick Start
4-
=========================
3+
Citus Tutorial
4+
==============
55

66
In this guide we’ll create a Citus cluster with a coordinator node and three
77
workers. Every node will have a secondary for failover. We’ll simulate

docs/how-to.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _how-to:
22

3-
Main pg_autoctl commands
4-
========================
3+
Quick Start
4+
===========
55

66
pg_auto_failover includes the command line tool ``pg_autoctl`` that
77
implements many commands to manage your Postgres nodes. To implement the
@@ -19,7 +19,9 @@ To understand which replication settings to use in your case, see
1919

2020
To follow a step by step guide that you can reproduce on your own Azure
2121
subscription and create a production Postgres setup from VMs, see the
22-
:ref:`tutorial` section.
22+
:ref:`azure_tutorial` section. To get started with a local setup using
23+
docker-compose to run multiple Postgres nodes, see the :ref:`tutorial`
24+
section.
2325

2426
To understand how to setup pg_auto_failover in a way that is compliant with
2527
your internal security guide lines, read the :ref:`security` section.

docs/index.rst

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,43 @@ __ https://github.com/citusdata
3737
level of free guidance.
3838

3939
.. toctree::
40-
:maxdepth: 4
41-
:caption: Contents:
40+
:hidden:
41+
:caption: Getting Started
4242

4343
intro
4444
how-to
4545
tutorial
4646
azure-tutorial
47+
install
48+
49+
.. toctree::
50+
:hidden:
51+
:caption: Architecture
52+
4753
architecture
4854
architecture-multi-standby
49-
citus
50-
citus-quickstart
5155
failover-state-machine
5256
fault-tolerance
53-
install
5457
security
58+
59+
.. toctree::
60+
:hidden:
61+
:caption: Citus
62+
63+
citus
64+
citus-quickstart
65+
66+
.. toctree::
67+
:hidden:
68+
:caption: Manual Pages
69+
5570
ref/manual
5671
ref/configuration
72+
73+
.. toctree::
74+
:hidden:
75+
:caption: Operations
76+
5777
operations
5878
faq
5979

docs/tutorial.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _tutorial:
22

3-
pg_auto_failover Tutorial
4-
=========================
3+
Tutorial
4+
========
55

66
In this guide we’ll create a Postgres setup with two nodes, a primary and a
77
standby. Then we'll add a second standby node. We’ll simulate failure in the

0 commit comments

Comments
 (0)