diff --git a/pmm_qa/percona-distribution-postgresql/percona-distribution-postgres-setup.yml b/pmm_qa/percona-distribution-postgresql/percona-distribution-postgres-setup.yml index e9de8de3..ae6f9321 100644 --- a/pmm_qa/percona-distribution-postgresql/percona-distribution-postgres-setup.yml +++ b/pmm_qa/percona-distribution-postgresql/percona-distribution-postgres-setup.yml @@ -22,6 +22,7 @@ random_service_name_value: "" docker_repo: "percona/percona-distribution-postgresql" container_prefix: "pdpgsql_pmm{{ (setup_type|default('')) and '_' ~ setup_type }}_{{ pdpgsql_version }}_" + pgsm_branch: "{{ lookup('env', 'PGSM_BRANCH') }}" tasks: - name: Display setup type selected diff --git a/pmm_qa/percona-distribution-postgresql/tasks/install-pdpgsql.yml b/pmm_qa/percona-distribution-postgresql/tasks/install-pdpgsql.yml index 8f00c735..067cf297 100644 --- a/pmm_qa/percona-distribution-postgresql/tasks/install-pdpgsql.yml +++ b/pmm_qa/percona-distribution-postgresql/tasks/install-pdpgsql.yml @@ -30,10 +30,40 @@ - name: Install Percona Distribution for PostgreSQL shell: | - docker exec -u root {{ container_prefix }}{{ item }} apt-get install -y percona-postgresql-{{ pdpgsql_version }} percona-pgbackrest percona-pg-stat-monitor{{ pdpgsql_version }} + docker exec -u root {{ container_prefix }}{{ item }} apt-get install -y percona-postgresql-{{ pdpgsql_version }} percona-pgbackrest become: true loop: "{{ range(1, nodes_count | int + 1) | list }}" +- name: Install PG Stat Monitor + shell: docker exec -u root {{ container_prefix }}{{ item }} apt-get install -y percona-pg-stat-monitor{{ pdpgsql_version }} + become: true + loop: "{{ range(1, nodes_count | int + 1) | list }}" + when: pgsm_branch | length == 0 + +- name: Prepare installation of PG Stat Monitor from sources + shell: | + docker exec -u root {{ container_prefix }}{{ item }} sh -c ' + wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && + echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && + apt-get update && + apt-get -y install git clang-18 llvm-18 build-essential percona-postgresql-server-dev-{{ pdpgsql_version }} + ' + become: true + loop: "{{ range(1, nodes_count | int + 1) | list }}" + when: pgsm_branch | length > 0 + +- name: Install PG Stat Monitor from sources + shell: | + docker exec -u root {{ container_prefix }}{{ item }} sh -c ' + git clone --branch {{ pgsm_branch }} https://github.com/percona/pg_stat_monitor.git && + cd pg_stat_monitor && + make USE_PGXS=1 && + make USE_PGXS=1 install + ' + become: true + loop: "{{ range(1, nodes_count | int + 1) | list }}" + when: pgsm_branch | length > 0 + - name: Start Percona distribution for Postgresql shell: docker exec -u root {{ container_prefix }}{{ item }} systemctl start postgresql become: true diff --git a/pmm_qa/pmm-framework.py b/pmm_qa/pmm-framework.py index a244be96..74d6253a 100755 --- a/pmm_qa/pmm-framework.py +++ b/pmm_qa/pmm-framework.py @@ -159,6 +159,7 @@ def setup_pdpgsql(db_type, db_version=None, db_config=None, args=None): # Gather Version details pdpgsql_version = os.getenv('PDPGSQL_VERSION') or db_version or database_configs[db_type]["versions"][-1] setup_type_value = get_value('SETUP_TYPE', db_type, args, db_config).lower() + pgsm_branch = get_value('PGSM_BRANCH', db_type, args, db_config).lower() # Define environment variables for playbook env_vars = { @@ -172,7 +173,8 @@ def setup_pdpgsql(db_type, db_version=None, db_config=None, args=None): 'PDPGSQL_PGSM_PORT': 5447, 'DISTRIBUTION': '', 'PMM_QA_GIT_BRANCH': os.getenv('PMM_QA_GIT_BRANCH') or 'v3', - 'SETUP_TYPE': setup_type_value + 'SETUP_TYPE': setup_type_value, + 'PGSM_BRANCH': pgsm_branch } # Ansible playbook filename diff --git a/pmm_qa/scripts/database_options.py b/pmm_qa/scripts/database_options.py index ef65b555..c84436be 100644 --- a/pmm_qa/scripts/database_options.py +++ b/pmm_qa/scripts/database_options.py @@ -44,7 +44,7 @@ }, "PDPGSQL": { "versions": ["11", "12", "13", "14", "15", "16", "18", "17"], - "configurations": {"CLIENT_VERSION": "3-dev-latest", "USE_SOCKET": "", "SETUP_TYPE": ""} + "configurations": {"CLIENT_VERSION": "3-dev-latest", "USE_SOCKET": "", "SETUP_TYPE": "", "PGSM_BRANCH": ""} }, "SSL_PDPGSQL": { "versions": ["11", "12", "13", "14", "15", "16", "17"],