Skip to content

Commit 74a224b

Browse files
PMM-7: Add support for pgsm custom install (#187)
1 parent bc7939a commit 74a224b

4 files changed

Lines changed: 36 additions & 3 deletions

File tree

pmm_qa/percona-distribution-postgresql/percona-distribution-postgres-setup.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
random_service_name_value: ""
2323
docker_repo: "percona/percona-distribution-postgresql"
2424
container_prefix: "pdpgsql_pmm{{ (setup_type|default('')) and '_' ~ setup_type }}_{{ pdpgsql_version }}_"
25+
pgsm_branch: "{{ lookup('env', 'PGSM_BRANCH') }}"
2526

2627
tasks:
2728
- name: Display setup type selected

pmm_qa/percona-distribution-postgresql/tasks/install-pdpgsql.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,40 @@
3030

3131
- name: Install Percona Distribution for PostgreSQL
3232
shell: |
33-
docker exec -u root {{ container_prefix }}{{ item }} apt-get install -y percona-postgresql-{{ pdpgsql_version }} percona-pgbackrest percona-pg-stat-monitor{{ pdpgsql_version }}
33+
docker exec -u root {{ container_prefix }}{{ item }} apt-get install -y percona-postgresql-{{ pdpgsql_version }} percona-pgbackrest
3434
become: true
3535
loop: "{{ range(1, nodes_count | int + 1) | list }}"
3636

37+
- name: Install PG Stat Monitor
38+
shell: docker exec -u root {{ container_prefix }}{{ item }} apt-get install -y percona-pg-stat-monitor{{ pdpgsql_version }}
39+
become: true
40+
loop: "{{ range(1, nodes_count | int + 1) | list }}"
41+
when: pgsm_branch | length == 0
42+
43+
- name: Prepare installation of PG Stat Monitor from sources
44+
shell: |
45+
docker exec -u root {{ container_prefix }}{{ item }} sh -c '
46+
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - &&
47+
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list &&
48+
apt-get update &&
49+
apt-get -y install git clang-18 llvm-18 build-essential percona-postgresql-server-dev-{{ pdpgsql_version }}
50+
'
51+
become: true
52+
loop: "{{ range(1, nodes_count | int + 1) | list }}"
53+
when: pgsm_branch | length > 0
54+
55+
- name: Install PG Stat Monitor from sources
56+
shell: |
57+
docker exec -u root {{ container_prefix }}{{ item }} sh -c '
58+
git clone --branch {{ pgsm_branch }} https://github.com/percona/pg_stat_monitor.git &&
59+
cd pg_stat_monitor &&
60+
make USE_PGXS=1 &&
61+
make USE_PGXS=1 install
62+
'
63+
become: true
64+
loop: "{{ range(1, nodes_count | int + 1) | list }}"
65+
when: pgsm_branch | length > 0
66+
3767
- name: Start Percona distribution for Postgresql
3868
shell: docker exec -u root {{ container_prefix }}{{ item }} systemctl start postgresql
3969
become: true

pmm_qa/pmm-framework.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def setup_pdpgsql(db_type, db_version=None, db_config=None, args=None):
159159
# Gather Version details
160160
pdpgsql_version = os.getenv('PDPGSQL_VERSION') or db_version or database_configs[db_type]["versions"][-1]
161161
setup_type_value = get_value('SETUP_TYPE', db_type, args, db_config).lower()
162+
pgsm_branch = get_value('PGSM_BRANCH', db_type, args, db_config).lower()
162163

163164
# Define environment variables for playbook
164165
env_vars = {
@@ -172,7 +173,8 @@ def setup_pdpgsql(db_type, db_version=None, db_config=None, args=None):
172173
'PDPGSQL_PGSM_PORT': 5447,
173174
'DISTRIBUTION': '',
174175
'PMM_QA_GIT_BRANCH': os.getenv('PMM_QA_GIT_BRANCH') or 'v3',
175-
'SETUP_TYPE': setup_type_value
176+
'SETUP_TYPE': setup_type_value,
177+
'PGSM_BRANCH': pgsm_branch
176178
}
177179

178180
# Ansible playbook filename

pmm_qa/scripts/database_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"PDPGSQL": {
4646
"versions": ["11", "12", "13", "14", "15", "16", "18", "17"],
47-
"configurations": {"CLIENT_VERSION": "3-dev-latest", "USE_SOCKET": "", "SETUP_TYPE": ""}
47+
"configurations": {"CLIENT_VERSION": "3-dev-latest", "USE_SOCKET": "", "SETUP_TYPE": "", "PGSM_BRANCH": ""}
4848
},
4949
"SSL_PDPGSQL": {
5050
"versions": ["11", "12", "13", "14", "15", "16", "17"],

0 commit comments

Comments
 (0)