Skip to content

Commit 98529f2

Browse files
authored
Update pgMonitor path in pgo-deployer
This allows for the successful installation of the Postgres Operator Monitoring stack in a variety of environments due to the various permission considerations.
1 parent b0395a5 commit 98529f2

File tree

5 files changed

+32
-10
lines changed

5 files changed

+32
-10
lines changed

build/pgo-deployer/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fi
7070

7171
COPY installers/ansible /ansible/postgres-operator
7272
COPY installers/metrics/ansible /ansible/metrics
73-
ADD tools/pgmonitor /tmp/.pgo/metrics/pgmonitor
73+
ADD tools/pgmonitor /opt/crunchy/pgmonitor
7474
COPY installers/image/bin/pgo-deploy.sh /pgo-deploy.sh
7575
COPY bin/uid_daemon.sh /uid_daemon.sh
7676

@@ -79,7 +79,6 @@ ENV HOME="/tmp"
7979

8080
RUN chmod g=u /etc/passwd
8181
RUN chmod g=u /uid_daemon.sh
82-
RUN chown -R 2:2 /tmp/.pgo
8382

8483
ENTRYPOINT ["/uid_daemon.sh"]
8584

installers/metrics/ansible/roles/pgo-metrics/tasks/alertmanager.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
- name: Set pgmonitor Prometheus Directory Fact
1818
set_fact:
19-
pgmonitor_prometheus_dir: "{{ metrics_dir }}/pgmonitor/prometheus"
19+
pgmonitor_prometheus_dir: "{{ pgmonitor_dir }}/prometheus"
2020

2121
- name: Copy Alertmanger Config to Output Directory
2222
command: "cp {{ pgmonitor_prometheus_dir }}/{{ item.src }} {{ alertmanager_output_dir }}/{{ item.dst }}"

installers/metrics/ansible/roles/pgo-metrics/tasks/grafana.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
- name: Set pgmonitor Grafana Directory Fact
5050
set_fact:
51-
pgmonitor_grafana_dir: "{{ metrics_dir }}/pgmonitor/grafana"
51+
pgmonitor_grafana_dir: "{{ pgmonitor_dir }}/grafana"
5252

5353
- name: Copy Grafana Config to Output Directory
5454
command: "cp {{ pgmonitor_grafana_dir }}/{{ item }} {{ grafana_output_dir }}"

installers/metrics/ansible/roles/pgo-metrics/tasks/main.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,44 @@
5656
block:
5757
- name: Check for pgmonitor
5858
stat:
59-
path: "{{ metrics_dir }}/pgmonitor"
60-
register: pgmonitor_dir
59+
path: "/opt/crunchy/pgmonitor"
60+
register: pgmonitor_dir_embed
61+
62+
- name: Set pgMonitor Directory Fact
63+
block:
64+
- name: Embeded Path
65+
set_fact:
66+
pgmonitor_dir: "/opt/crunchy/pgmonitor"
67+
when: pgmonitor_dir_embed.stat.exists
68+
69+
- name: Downloaded Path
70+
set_fact:
71+
pgmonitor_dir: "{{ metrics_dir }}/pgmonitor"
72+
when: not pgmonitor_dir_embed.stat.exists
73+
74+
- name: Ensure pgMonitor Output Directory Exists
75+
file:
76+
path: "{{ pgmonitor_dir }}"
77+
state: directory
78+
mode: 0700
79+
when: not pgmonitor_dir_embed.stat.exists
6180

6281
- name: Download pgmonitor {{ pgmonitor_version }}
6382
get_url:
6483
url: https://github.com/CrunchyData/pgmonitor/archive/{{ pgmonitor_version }}.tar.gz
6584
dest: "{{ metrics_dir }}"
6685
mode: "0600"
67-
when: not pgmonitor_dir.stat.exists
86+
when: not pgmonitor_dir_embed.stat.exists
6887

6988
- name: Extract pgmonitor
7089
unarchive:
7190
src: "{{ metrics_dir }}/pgmonitor-{{ pgmonitor_version | replace('v','') }}.tar.gz"
72-
dest: "{{ metrics_dir }}/pgmonitor"
73-
when: not pgmonitor_dir.stat.exists
91+
dest: "{{ metrics_dir }}"
92+
when: not pgmonitor_dir_embed.stat.exists
93+
94+
- name: Copy pgmonitor to correct directory
95+
command: "cp -R {{ metrics_dir }}/pgmonitor-{{ pgmonitor_version | replace('v','') }}/. {{ pgmonitor_dir }}"
96+
when: not pgmonitor_dir_embed.stat.exists
7497

7598
- name: Create Metrics Image Pull Secret
7699
shell: >

installers/metrics/ansible/roles/pgo-metrics/tasks/prometheus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
- name: Set pgmonitor Prometheus Directory Fact
3737
set_fact:
38-
pgmonitor_prometheus_dir: "{{ metrics_dir }}/pgmonitor/prometheus"
38+
pgmonitor_prometheus_dir: "{{ pgmonitor_dir }}/prometheus"
3939

4040
- name: Copy Prometheus Config to Output Directory
4141
command: "cp {{ pgmonitor_prometheus_dir }}/{{ item.src }} {{ prom_output_dir }}/{{ item.dst }}"

0 commit comments

Comments
 (0)