Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Postgres version to 13.16 #8079

Merged
merged 4 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.16
TOMCAT_VERSION=9.0.91
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- [#7846](https://github.com/apache/trafficcontrol/pull/7846) *Traffic Portal* Increase State character limit
- [#8010](https://github.com/apache/trafficcontrol/pull/8010) *Traffic Stats* Omit NPM dev dependencies from Traffic Stats RPM
- [#8071](https://github.com/apache/trafficcontrol/pull/8071) *Traffic Ops* Improve validation for the `id` field of the `PUT /deliveryservice_request_comments` endpoint.
- [#8078](https://github.com/apache/trafficcontrol/pull/8078) *Traffic Ops DB* Update Postgres version to 13.16.

### Removed
- [#7832](https://github.com/apache/trafficcontrol/pull/7832) *t3c* Removed Perl dependency
Expand Down
1 change: 1 addition & 0 deletions cache-config/testing/docker/.env
3 changes: 2 additions & 1 deletion cache-config/testing/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ volumes:

services:
db:
image: postgres:13.2
image: postgres:${POSTGRES_VERSION}
env_file:
- variables.env
ports:
Expand All @@ -50,6 +50,7 @@ services:
args:
- OS_DISTRO=${OS_DISTRO:-rockylinux}
- OS_VERSION=${OS_VERSION:-8}
- POSTGRES_VERSION=${POSTGRES_VERSION}
context: ../../..
dockerfile: cache-config/testing/docker/traffic_ops/Dockerfile
volumes:
Expand Down
2 changes: 1 addition & 1 deletion cache-config/testing/docker/traffic_ops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RUN set -o nounset -o errexit && \
if [[ "${OS_VERSION%%.*}" -eq 7 ]]; then \
use_repo=''; \
enable_repo=''; \
# needed for llvm-toolset-7-clang, which is needed for postgresql13-devel-13.2-1PGDG, required by TO rpm
# needed for llvm-toolset-7-clang, which is needed for postgresql13-devel-13.X-1PGDG, required by TO rpm
dnf -y install gcc centos-release-scl-rh; \
else \
use_repo='--repo=pgdg13'; \
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:
- .:/go/src/github.com/apache/trafficcontrol

db:
image: postgres:13.2-alpine
image: postgres:${POSTGRES_VERSION}-alpine
ports:
- 5432:5432
environment:
Expand Down
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
2 changes: 2 additions & 0 deletions infrastructure/cdn-in-a-box/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ services:
# All other components access the database thru the Traffic Ops API
db:
build:
args:
POSTGRES_VERSION: ${POSTGRES_VERSION}
context: .
dockerfile: traffic_ops/Dockerfile-db
hostname: db
Expand Down
3 changes: 2 additions & 1 deletion infrastructure/cdn-in-a-box/traffic_ops/Dockerfile-db
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
# Dockerfile for trafficops db
############################################################

FROM postgres:13.2-alpine
ARG POSTGRES_VERSION
FROM postgres:${POSTGRES_VERSION}-alpine

ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD
RUN apk add bind-tools \
Expand Down
1 change: 1 addition & 0 deletions tc-health-client/testing/docker/.env
2 changes: 1 addition & 1 deletion tc-health-client/testing/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ volumes:

services:
db:
image: postgres:13.2
image: postgres:${POSTGRES_VERSION}
env_file:
- variables.env
ports:
Expand Down
2 changes: 1 addition & 1 deletion tc-health-client/testing/docker/traffic_ops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN set -o nounset -o errexit && \
if [[ "${OS_VERSION%%.*}" -eq 7 ]]; then \
use_repo=''; \
enable_repo=''; \
# needed for llvm-toolset-7-clang, which is needed for postgresql13-devel-13.2-1PGDG, required by TO rpm
# needed for llvm-toolset-7-clang, which is needed for postgresql13-devel-13.x-1PGDG, required by TO rpm
dnf -y install gcc centos-release-scl-rh; \
else \
use_repo='--repo=pgdg13'; \
Expand Down
2 changes: 1 addition & 1 deletion traffic_ops/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Instructions are here: https://yum.postgresql.org/

`$ sudo yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm`

## Install Postgres 13.2 server (in a container or on the host)
## Install Postgres 13.16 server (in a container or on the host)

### on the host:

Expand Down
1 change: 1 addition & 0 deletions traffic_ops/app/db/trafficvault/test/.env
2 changes: 1 addition & 1 deletion traffic_ops/app/db/trafficvault/test/Dockerfile-db-admin
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
############################################################

FROM rockylinux:8
ARG POSTGRES_VERSION=13.2
ARG POSTGRES_VERSION
ENV POSTGRES_VERSION=$POSTGRES_VERSION

# NOTE: temporary workaround for removal of golang packages from CentOS 7 base repo
Expand Down
4 changes: 2 additions & 2 deletions traffic_ops/app/db/trafficvault/test/Dockerfile-tvdb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
# Dockerfile for traffic vault db
############################################################

ARG POSTGRES_VERSION=13.2
ARG POSTGRES_VERSION
FROM postgres:${POSTGRES_VERSION}
ARG POSTGRES_VERSION=13.2
ARG POSTGRES_VERSION
ENV POSTGRES_VERSION=$POSTGRES_VERSION

ENV POSTGRES_PASSWORD=twelve
Expand Down
4 changes: 2 additions & 2 deletions traffic_ops/app/db/trafficvault/test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
context: .
dockerfile: Dockerfile-tvdb
args:
POSTGRES_VERSION: ${POSTGRES_VERSION:-13.2}
POSTGRES_VERSION: ${POSTGRES_VERSION}
ports:
- 5432

Expand All @@ -41,7 +41,7 @@ services:
context: .
dockerfile: Dockerfile-db-admin
args:
POSTGRES_VERSION: ${POSTGRES_VERSION:-13.2}
POSTGRES_VERSION: ${POSTGRES_VERSION}
TRAFFIC_OPS_RPM: traffic_ops.rpm
depends_on:
- tvdb
Expand Down
3 changes: 2 additions & 1 deletion traffic_ops/build/build_rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ initBuildArea() {
cp "$TO_DIR"/build/traffic_ops.spec "$RPMBUILD"/SPECS/. || \
{ echo "Could not copy spec files: $?"; return 1; }

source "${TC_DIR}/.env"
PLUGINS="$(grep -l 'AddPlugin(' "${TO_DIR}/traffic_ops_golang/plugin/"*.go | grep -v 'func AddPlugin(' | xargs -I '{}' basename {} '.go')"
export PLUGINS
export POSTGRES_VERSION PLUGINS

echo "The build area has been initialized."
}
Expand Down
3 changes: 2 additions & 1 deletion traffic_ops/build/traffic_ops.spec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
%define TRAFFIC_OPS_LOG_DIR /var/log/traffic_ops
%define TRAFFIC_OPS_ROOT_CERTIFICATES_DIR /var/log/traffic_ops
%define debug_package %{nil}
%define postgres_version %{getenv:POSTGRES_VERSION}

Summary: Traffic Ops
Name: traffic_ops
Expand All @@ -36,7 +37,7 @@ AutoReqProv: no
Requires: cpanminus, expat-devel, libcurl, libpcap-devel, mkisofs, tar
Requires: openssl-devel, perl, perl-core, perl-DBD-Pg, perl-DBI, perl-Digest-SHA1
Requires: libidn-devel, libcurl-devel, libcap
Requires: postgresql13 >= 13.2
Requires: postgresql13 >= %{postgres_version}
Requires: perl-JSON, perl-libwww-perl, perl-Test-CPAN-Meta, perl-WWW-Curl, perl-TermReadKey, perl-Crypt-ScryptKDF
Requires: python3
Requires(pre): /usr/sbin/useradd, /usr/bin/getent
Expand Down
2 changes: 1 addition & 1 deletion traffic_ops/traffic_ops_golang/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
To run `traffic_ops_golang` proxy locally the following prerequisites are needed:

* Golang version greater or equal to the Go version found in the `GO_VERSION` file at the base of this repository. See: [https://golang.org/doc/install](https://golang.org/doc/install)
* Postgres 13.2 or greater
* Postgres 13 or greater


## Vendoring and Building
Expand Down
1 change: 1 addition & 0 deletions traffic_ops_db/docker/.env
3 changes: 2 additions & 1 deletion traffic_ops_db/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM postgres:13.2
ARG POSTGRES_VERSION
FROM postgres:${POSTGRES_VERSION}

MAINTAINER dev@trafficcontrol.apache.org

Expand Down
2 changes: 2 additions & 0 deletions traffic_ops_db/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ services:
build:
context: ..
dockerfile: /opt/traffic_ops_db/docker/Dockerfile
args:
POSTGRES_VERSION: ${POSTGRES_VERSION}
env_file:
- /opt/traffic_ops_db/docker/docker-compose.env
ports:
Expand Down
1 change: 1 addition & 0 deletions traffic_ops_db/test/docker/.env
4 changes: 2 additions & 2 deletions traffic_ops_db/test/docker/Dockerfile-db
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
# Dockerfile for trafficops db
############################################################

ARG POSTGRES_VERSION=13.2
ARG POSTGRES_VERSION
FROM postgres:${POSTGRES_VERSION}
ARG POSTGRES_VERSION=13.2
ARG POSTGRES_VERSION
ENV POSTGRES_VERSION=$POSTGRES_VERSION

ENV POSTGRES_PASSWORD=twelve
Expand Down
2 changes: 1 addition & 1 deletion traffic_ops_db/test/docker/Dockerfile-db-admin
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
############################################################

FROM rockylinux:8
ARG POSTGRES_VERSION=13.2
ARG POSTGRES_VERSION
ENV POSTGRES_VERSION=$POSTGRES_VERSION

RUN dnf install -y \
Expand Down
4 changes: 2 additions & 2 deletions traffic_ops_db/test/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
context: .
dockerfile: Dockerfile-db
args:
POSTGRES_VERSION: ${POSTGRES_VERSION:-13.2}
POSTGRES_VERSION: ${POSTGRES_VERSION}
ports:
- 5432

Expand All @@ -41,7 +41,7 @@ services:
context: .
dockerfile: Dockerfile-db-admin
args:
POSTGRES_VERSION: ${POSTGRES_VERSION:-13.2}
POSTGRES_VERSION: ${POSTGRES_VERSION}
TRAFFIC_OPS_RPM: traffic_ops.rpm
depends_on:
- db
Expand Down
Loading