Skip to content

Commit

Permalink
Get POSTGRES_VERSION from .env in Dockerfiles and docker-compose files
Browse files Browse the repository at this point in the history
  • Loading branch information
zrhoffman committed Sep 27, 2024
1 parent 7ff96e4 commit b3e3e01
Show file tree
Hide file tree
Showing 22 changed files with 31 additions and 19 deletions.
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
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
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 [email protected]

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

0 comments on commit b3e3e01

Please sign in to comment.