Skip to content

Commit e4423f2

Browse files
authored
[FIX] Revert postgres update (#3443)
* Revert postgres update * un-revert migration fix
1 parent be7c01b commit e4423f2

12 files changed

+310
-491
lines changed

Makefile

-21
Original file line numberDiff line numberDiff line change
@@ -110,27 +110,6 @@ cleandb:
110110
@docker volume rm mds_postgres_data -f
111111
@docker compose $(DC_FILE) up -d postgres flyway
112112

113-
updatedb:
114-
@echo "+\n++ Updating database from postgres 13 to 16"
115-
@echo "+\n++ Stopping postgres"
116-
@docker compose $(DC_FILE) stop postgres flyway
117-
@if docker volume ls -q | grep -q "mds_postgres_data_bkp"; then \
118-
echo "+\n++ Backup volume 'mds_postgres_data_bkp' already exists"; \
119-
else \
120-
echo "+\n++ Creating a backup volume"; \
121-
docker volume create --name mds_postgres_data_bkp --label com.docker.compose.project=mds --label com.docker.compose.volume=postgres_data_bkp; \
122-
docker run --rm -it -v mds_postgres_data:/from -v mds_postgres_data_bkp:/to alpine ash -c 'cd /from ; cp -av . /to'; \
123-
fi
124-
@echo "+\n++ Backup complete, wiping mds_postgres_data volume"
125-
@docker run --rm -v mds_postgres_data:/tmp alpine sh -c "rm -rf /tmp/*"
126-
@echo "+\n++ Updating postgres and copying result to the mds_postgres_data volume"
127-
@docker compose $(DC_FILE) up postgres_update
128-
@echo "+\n++ Deleting old postgres image & update image"
129-
@docker compose $(DC_FILE) rm -f -v -s postgres postgres_update
130-
@docker rmi -f mds-postgres
131-
@echo "+\n++ Starting new postgres image"
132-
@docker compose $(DC_FILE) up -d postgres flyway
133-
134113
reglogin:
135114
@echo "+\n++ Initiating Openshift registry login...\n+"
136115
@./bin/registry-login.sh

docker-compose.M1.yaml

-21
Original file line numberDiff line numberDiff line change
@@ -64,32 +64,12 @@ services:
6464
ports:
6565
- "5432:5432"
6666
volumes:
67-
- ./services/postgres/postgresql.conf:/config/postgresql.conf
68-
- ./services/postgres/pg_hba.conf:/config/pg_hba.conf
6967
- postgres_data:/var/lib/postgresql/data
70-
command:
71-
postgres -c 'config_file=/config/postgresql.conf' -c 'hba_file=/config/pg_hba.conf'
7268
healthcheck:
7369
test: [ "CMD", "pg_isready" ]
7470
interval: 5s
7571
timeout: 5s
7672
retries: 5
77-
stop_grace_period: 30s
78-
79-
postgres_update:
80-
platform: linux/amd64
81-
container_name: mds_postgres_update
82-
user: postgres
83-
build:
84-
context: services/postgres
85-
dockerfile: Dockerfile_update
86-
environment:
87-
- PGUSER=mds
88-
- POSTGRES_PASSWORD=test
89-
- POSTGRES_INITDB_ARGS=-U mds
90-
volumes:
91-
- postgres_data_bkp:/var/lib/postgresql/13/data
92-
- postgres_data:/var/lib/postgresql/16/data
9373

9474
####################### Flyway Migration Definition #######################
9575
flyway:
@@ -346,7 +326,6 @@ networks:
346326
####################### Volumes Definition #######################
347327
volumes:
348328
postgres_data: {}
349-
postgres_data_bkp: {}
350329
core_api_logs: {}
351330
core_web_logs: {}
352331
document_manager_logs: {}

docker-compose.ci.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ services:
6363
interval: 5s
6464
timeout: 5s
6565
retries: 10
66-
stop_grace_period: 30s
6766

6867
####################### Flyway Migration Definition #######################
6968
flyway:

docker-compose.yaml

-19
Original file line numberDiff line numberDiff line change
@@ -63,30 +63,12 @@ services:
6363
ports:
6464
- "5432:5432"
6565
volumes:
66-
- ./services/postgres/postgresql.conf:/config/postgresql.conf
67-
- ./services/postgres/pg_hba.conf:/config/pg_hba.conf
6866
- postgres_data:/var/lib/postgresql/data
69-
command:
70-
postgres -c 'config_file=/config/postgresql.conf' -c 'hba_file=/config/pg_hba.conf'
7167
healthcheck:
7268
test: [ "CMD", "pg_isready" ]
7369
interval: 5s
7470
timeout: 5s
7571
retries: 5
76-
77-
postgres_update:
78-
container_name: mds_postgres_update
79-
user: postgres
80-
build:
81-
context: services/postgres
82-
dockerfile: Dockerfile_update
83-
environment:
84-
- PGUSER=mds
85-
- POSTGRES_PASSWORD=test
86-
- POSTGRES_INITDB_ARGS=-U mds
87-
volumes:
88-
- postgres_data_bkp:/var/lib/postgresql/13/data
89-
- postgres_data:/var/lib/postgresql/16/data
9072

9173
####################### Flyway Migration Definition #######################
9274
flyway:
@@ -350,7 +332,6 @@ networks:
350332
####################### Volumes Definition #######################
351333
volumes:
352334
postgres_data: {}
353-
postgres_data_bkp: {}
354335
core_api_logs: {}
355336
core_web_logs: {}
356337
document_manager_logs: {}

migrations/Dockerfile.flyway.ci

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM flyway/flyway:11.1-alpine
1+
FROM flyway/flyway:7.14-alpine
22
ENV FLYWAY_HOME=/flyway
33

44
USER 0
@@ -10,7 +10,7 @@ COPY sql-prod/* /flyway/sql-prod/
1010
COPY scripts/* /flyway/scripts/
1111

1212

13-
ENV FLYWAY_VERSION=11.1
13+
ENV FLYWAY_VERSION=5.2.4
1414

1515
# Copy over the SQL files and scripts
1616
COPY sql/* $FLYWAY_HOME/sql/

migrations/Dockerfile.flyway.dev

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM flyway/flyway:11.1-alpine
1+
FROM flyway/flyway:7.14-alpine
22

33
USER root
44

services/postgres/Dockerfile

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
FROM postgis/postgis:16-3.5
1+
FROM postgis/postgis:13-3.4
22

33
# The Git ref (branch/tag) specifying the version of oracle-fdw to use
44
# This is referencing a specific revision (master as of 2021.06.01)
55
# because there is not a tagged version that works with the
66
# Oracle 21.x client libraries yet
77

8-
ARG ORACLE_FDW_VERSION=ORACLE_FDW_2_6_0
9-
ARG oracle_fdw_version=2_6_0
8+
ARG ORACLE_FDW_VERSION=3035e4453404a143b8154d7b77c6db793fad0e06
9+
ARG oracle_fdw_version=2_1_0
1010
ARG instantclient_version=21_6
1111

1212
# =================================== #
@@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3030
unzip \
3131
wget \
3232
ca-certificates \
33-
postgresql-server-dev-16 \
33+
postgresql-server-dev-13 \
3434
libaio1 \
3535
libaio-dev
3636

@@ -55,7 +55,7 @@ ENV LD_LIBRARY_PATH /pgexts/oraclelibs/instantclient_${instantclient_version}
5555
# =================================== #
5656

5757
RUN cd /pgexts && \
58-
wget -nv https://github.com/laurenz/oracle_fdw/archive/refs/tags/${ORACLE_FDW_VERSION}.tar.gz && \
58+
wget -nv https://github.com/laurenz/oracle_fdw/archive/${ORACLE_FDW_VERSION}.tar.gz && \
5959
tar -xzf ${ORACLE_FDW_VERSION}.tar.gz && \
6060
cd oracle_fdw-${ORACLE_FDW_VERSION} && \
6161
make && \
@@ -70,8 +70,8 @@ RUN rm -rf /pgexts/oraclelibs/*.zip /pgexts/${ORACLE_FDW_VERSION}.tar.gz /tmp/or
7070
# Init Scripts
7171

7272
COPY init.sql /docker-entrypoint-initdb.d/init.sql
73+
COPY postgresql.conf /tmp/postgresql.conf
74+
COPY updateConfig.sh /docker-entrypoint-initdb.d/_updateConfig.sh
7375

74-
RUN mkdir -p /pg_log
75-
RUN chown -R postgres:postgres /pg_log
76-
77-
WORKDIR /docker-entrypoint-initdb.d
76+
# Set the working directory to container entrypoint
77+
WORKDIR /docker-entrypoint-initdb.d

services/postgres/Dockerfile_update

-30
This file was deleted.

services/postgres/docker-upgrade.sh

-22
This file was deleted.

services/postgres/pg_hba.conf

-15
This file was deleted.

0 commit comments

Comments
 (0)