Skip to content

Commit

Permalink
Upgrade to postgres:15
Browse files Browse the repository at this point in the history
  • Loading branch information
john-westcott-iv committed Jul 12, 2023
1 parent 07e30a3 commit 98c0e5a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,6 @@ clean-elk:
docker rm tools_elasticsearch_1
docker rm tools_kibana_1

psql-container:
docker run -it --net tools_default --rm postgres:12 sh -c 'exec psql -h "postgres" -p "5432" -U postgres'

VERSION:
@echo "awx: $(VERSION)"

Expand Down
7 changes: 4 additions & 3 deletions awx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,11 @@ def manage():
from django.conf import settings
from django.core.management import execute_from_command_line

# enforce the postgres version is equal to 12. if not, then terminate program with exit code of 1
# enforce the postgres version is equal to 15. if not, then terminate program with exit code of 1
# The return of connection.pg_version is something like 12013
if not os.getenv('SKIP_PG_VERSION_CHECK', False) and not MODE == 'development':
if (connection.pg_version // 10000) < 12:
sys.stderr.write("Postgres version 12 is required\n")
if (connection.pg_version // 10000) < 15:
sys.stderr.write("Postgres version 15 is required\n")
sys.exit(1)

if len(sys.argv) >= 2 and sys.argv[1] in ('version', '--version'): # pragma: no cover
Expand Down
2 changes: 1 addition & 1 deletion awx/main/analytics/collectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def query(event_data):
resolved_action,
resolved_role,
-- '-' operator listed here:
-- https://www.postgresql.org/docs/12/functions-json.html
-- https://www.postgresql.org/docs/15/functions-json.html
-- note that operator is only supported by jsonb objects
-- https://www.postgresql.org/docs/current/datatype-json.html
(CASE WHEN event = 'playbook_on_stats' THEN {event_data} - 'artifact_data' END) as playbook_on_stats,
Expand Down
1 change: 0 additions & 1 deletion tools/ansible/roles/dockerfile/templates/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ RUN ln -sf /dev/stdout /var/log/nginx/access.log && \
{% endif %}

ENV HOME="/var/lib/awx"
ENV PATH="/usr/pgsql-12/bin:${PATH}"

{% if build_dev|bool %}
ENV PATH="/var/lib/awx/venv/awx/bin/:${PATH}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ services:
# context: ./docker-compose
# dockerfile: Dockerfile-logstash
postgres:
image: postgres:12
image: postgres:15
container_name: tools_postgres_1
# additional logging settings for postgres can be found https://www.postgresql.org/docs/current/runtime-config-logging.html
command: postgres -c log_destination=stderr -c log_min_messages=info -c log_min_duration_statement={{ pg_log_min_duration_statement|default(1000) }} -c max_connections={{ pg_max_connections|default(1024) }}
Expand All @@ -200,7 +200,7 @@ services:
POSTGRES_DB: {{ pg_database }}
POSTGRES_PASSWORD: {{ pg_password }}
volumes:
- "awx_db:/var/lib/postgresql/data"
- "awx_db_15:/var/lib/postgresql/data"
{% if enable_pgbouncer|bool %}
pgbouncer:
image: bitnami/pgbouncer:latest
Expand Down Expand Up @@ -269,8 +269,9 @@ services:
{% endif %}

volumes:
awx_db:
name: tools_awx_db
{# For the postgres 15 db upgrade we changed the mount name because 15 can't load a 12 DB #}
awx_db_15:
name: tools_awx_db_15
{% for i in range(control_plane_node_count|int) -%}
{% set container_postfix = loop.index %}
redis_socket_{{ container_postfix }}:
Expand Down

0 comments on commit 98c0e5a

Please sign in to comment.