Skip to content

Commit d980ac1

Browse files
committed
deploy postgres and dtm from separate repos
1 parent e1d6dd3 commit d980ac1

File tree

1 file changed

+59
-12
lines changed

1 file changed

+59
-12
lines changed

tests/deploy_layouts/cluster.yml

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,64 @@
11
---
2-
- hosts: nodes[1]
3-
roles:
4-
- role: postgrespro
5-
deploy_dtm: true
6-
72
- hosts: nodes
3+
84
roles:
9-
- role: postgrespro
5+
- role: postgres
106
pg_port: 15432
11-
deploy_postgres: true
12-
pg_dtm_enable: true
13-
pg_dtm_enable: false
14-
# pg_config_role:
15-
# - line: "dtm.buffer_size = 65536"
16-
pg_dtm_host: "{{ groups['nodes'][0] }}"
7+
pg_repo: https://github.com/kelvich/postgresql.git
8+
pg_version_tag: xtm_patched
9+
pg_destroy_and_init: true
10+
pg_config_role:
11+
- line: "dtm.buffer_size = 65536"
12+
13+
tasks:
14+
- name: clone dtm sources
15+
git: repo=https://github.com/postgrespro/pg_dtm.git
16+
dest={{pg_prefix}}/pg_dtm
17+
accept_hostkey=yes
18+
update=yes
19+
force=yes
20+
register: dtm_sources
21+
22+
- name: build dtm
23+
shell: "make clean && make -j {{makejobs}} install"
24+
args:
25+
chdir: "{{pg_prefix}}/pg_dtm"
26+
environment:
27+
PG_CONFIG: "{{pg_dst}}/bin/pg_config"
28+
# when: dtm_sources.changed
29+
30+
- name: enable dtm extension on datanodes
31+
lineinfile:
32+
dest: "{{pg_datadir}}/postgresql.conf"
33+
regexp: "^shared_preload_libraries"
34+
line: "shared_preload_libraries = 'pg_dtm'"
35+
state: present
36+
37+
- name: restart postgrespro
38+
command: "{{pg_dst}}/bin/pg_ctl restart -w -D {{pg_datadir}} -l {{pg_datadir}}/pg.log"
39+
environment:
40+
LD_LIBRARY_PATH: "{{pg_dst}}/lib/"
41+
42+
- hosts: nodes[0]
43+
tasks:
44+
- name: build dtmd
45+
shell: "make clean && make -j 4"
46+
args:
47+
chdir: "~/pg_cluster/pg_dtm/dtmd"
48+
environment:
49+
PG_CONFIG: "~/pg_cluster/install/bin/pg_config"
50+
51+
- name: kill dtmd
52+
shell: kill -9 `cat ~/pg_cluster/dtm_data/arbiter.pid` || true
53+
54+
- name: ensure datadir for dtm exists
55+
shell: "rm -rf ~/pg_cluster/dtm_data && mkdir ~/pg_cluster/dtm_data"
56+
57+
- name: start dtm
58+
shell: >
59+
nohup ~/pg_cluster/pg_dtm/dtmd/bin/dtmd
60+
-d ~/pg_cluster/dtm_data -a 0.0.0.0 -p 5431 > ~/pg_cluster/dtm_data/log &
61+
62+
- name: wait until dtm is available
63+
wait_for: port=5431 delay=1
1764

0 commit comments

Comments
 (0)