Skip to content

Commit

Permalink
Use :atc-postgres-version: role in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
zrhoffman committed Sep 27, 2024
1 parent b7c576a commit ab8d0ae
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ATS_VERSION=9.2.4
GO_VERSION=1.23.1
POSTGRES_VERSION=13.2
TOMCAT_VERSION=9.0.91
28 changes: 28 additions & 0 deletions docs/source/_ext/atc.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,33 @@ def atc_go_version(
strong_node = nodes.strong(major_minor_version, major_minor_version)
return [strong_node], []

def atc_postgres_version(
unused_typ: None,
unused_rawtext: None,
unused_text: None,
lineno: int,
unused_inliner: None,
unused_options: None=None,
unused_content: None=None
) -> Tuple[List[nodes.Node], List[nodes.Node]]:
"""
A role that inserts the Postgres version used/required by this version of ATC.
Example:
:atc-postgres-version:_
"""
env_file = os.path.join(os.path.dirname(__file__), "../../../.env")
with open(file=env_file, encoding="utf-8") as env_file:
env_file_contents = env_file.read()

matches = re.search(pattern=r"^POSTGRES_VERSION=(\d+\.\d+)$", string=env_file_contents, flags=re.MULTILINE)
if matches is None:
raise ValueError(f"Postgres version found that could not be parsed: '{env_file_contents}' (from line {lineno})")
major_minor_version = matches.group(1)
strong_node = nodes.strong(major_minor_version, major_minor_version)
return [strong_node], []

# -- Issue role --------------------------------------------------------------

ISSUE_URI: Final = REPO_URI + "issues/%s"
Expand Down Expand Up @@ -330,6 +357,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
app.add_directive("impl-detail", ImplementationDetail)
app.add_directive("versionremoved", VersionRemoved)
app.add_role("atc-go-version", atc_go_version)
app.add_role("atc-postgres-version", atc_postgres_version)
app.add_role("issue", issue_role)
app.add_role("pr", pr_role)
app.add_role("pull-request", pr_role)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/admin/traffic_ops.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Guide
to-# psql -h pg -U postgres
Password for user postgres:
psql (13.2)
psql (13.16)
Type "help" for help.
postgres=#
Expand Down
5 changes: 4 additions & 1 deletion docs/source/development/traffic_ops.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ Software Requirements
=====================
Traffic Ops is only supported on CentOS 7+ systems (although many developers do use Mac OS with some success). Here are the requirements:

- `PostgreSQL 13.2 <https://www.postgresql.org/download/>`_ - the machine where Traffic Ops is running must have the client tool set (e.g. :manpage:`psql(1)`), but the actual database can be run anywhere so long as it is accessible.
- |install-postgres-link|_ - the machine where Traffic Ops is running must have the client tool set (e.g. :manpage:`psql(1)`), but the actual database can be run anywhere so long as it is accessible.

.. |install-postgres-link| replace:: PostgreSQL :atc-postgres-version:`_`
.. _install-postgres-link: https://www.postgresql.org/download/

.. note:: Prior to version 13.2, Traffic Ops used version 9.6. For upgrading an existing Mac OS Homebrew-based PostgreSQL instance, you can use `Homebrew <https://brew.sh/>`_ to easily upgrade from 9.6 to 13.2:

Expand Down

0 comments on commit ab8d0ae

Please sign in to comment.