Skip to content

Commit 11456b2

Browse files
committed
Farm deploy stuff. WIP
1 parent d6559e2 commit 11456b2

File tree

19 files changed

+556
-1809
lines changed

19 files changed

+556
-1809
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
- hosts: master-workers
3+
roles:
4+
5+
- role: postgrespro
6+
deploy_postgres: true
7+
ppg_usedtm: false
8+
ppg_dtmhost: "158.250.29.10"
9+
ppg:
10+
version: xtm
11+
src: ./postgrespro
12+
dst: "/tmp/postgrespro-build"
13+
log: ./ppg1.log
14+
datadir: ./postgrespro-data1
15+
usedtm: false
16+
node_id: 1
17+
ppg_configfile:
18+
# we should so delete/reinit on playbook, after that drop rexeps here
19+
- line: "shared_buffers = 1024MB" # 1/4 RAM
20+
regexp: "^shared_buffers "
21+
- line: "wal_keep_segments = 128"
22+
regexp: "^wal_keep_segments "
23+
- line: "fsync = off"
24+
regexp: "^fsync "
25+
- line: "autovacuum = off"
26+
regexp: "^autovacuum "
27+
- line: "listen_addresses = '*'"
28+
regexp: "^listen_addresses "
29+
- line: "port = 5432"
30+
regexp: "^port "
31+
- line: "max_connections = 1024"
32+
regexp: "^max_connections "
33+
34+
- hosts: workers
35+
roles:
36+
37+
- role: postgrespro
38+
deploy_postgres: true
39+
ppg_usedtm: false
40+
ppg_dtmhost: "158.250.29.10"
41+
ppg:
42+
version: xtm
43+
src: ./postgrespro
44+
dst: "/tmp/postgrespro-build"
45+
log: ./ppg1.log
46+
datadir: ./postgrespro-data1
47+
usedtm: false
48+
node_id: 1
49+
ppg_configfile:
50+
# we should so delete/reinit on playbook, after that drop rexeps here
51+
- line: "shared_buffers = 1024MB" # 1/4 RAM
52+
regexp: "^shared_buffers "
53+
- line: "wal_keep_segments = 128"
54+
regexp: "^wal_keep_segments "
55+
- line: "fsync = off"
56+
regexp: "^fsync "
57+
- line: "autovacuum = off"
58+
regexp: "^autovacuum "
59+
- line: "listen_addresses = '*'"
60+
regexp: "^listen_addresses "
61+
- line: "port = 5432"
62+
regexp: "^port "
63+
- line: "max_connections = 1024"
64+
regexp: "^max_connections "
65+

contrib/pg_dtm/tests/deploy_layouts/cluster_pg_shard.yml

Whitespace-only changes.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
- hosts: dtm
3+
gather_facts: no
4+
roles:
5+
- role: postgrespro
6+
deploy_dtm: true
7+
8+
- hosts: master-workers
9+
gather_facts: no
10+
roles:
11+
12+
- role: postgrespro
13+
deploy_postgres: true
14+
deploy_pg_shard: true
15+
ppg_usedtm: true
16+
ppg_dtmhost: "blade8" #!!!
17+
ppg:
18+
version: xtm_pgshard
19+
src: /home/stas/postgrespro
20+
dst: /home/stas/postgrespro-build
21+
log: /home/stas/ppg.log
22+
datadir: /home/stas/postgrespro-data
23+
usedtm: true
24+
node_id: 1
25+
ppg_configfile:
26+
# we should so delete/reinit on playbook, after that drop rexeps here
27+
- line: "shared_buffers = 1024MB" # 1/4 RAM
28+
regexp: "^shared_buffers "
29+
- line: "wal_keep_segments = 128"
30+
regexp: "^wal_keep_segments "
31+
- line: "fsync = off"
32+
regexp: "^fsync "
33+
- line: "autovacuum = off"
34+
regexp: "^autovacuum "
35+
- line: "listen_addresses = '*'"
36+
regexp: "^listen_addresses "
37+
- line: "port = 5432"
38+
regexp: "^port "
39+
40+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
- hosts: master-workers
3+
# gather_facts: no
4+
roles:
5+
6+
- role: postgrespro
7+
deploy_dtm: true
8+
9+
- role: postgrespro
10+
deploy_postgres: true
11+
ppg_usedtm: true
12+
ppg_dtmhost: "158.250.29.10"
13+
ppg:
14+
version: xtm
15+
src: ./postgrespro
16+
dst: "/tmp/postgrespro-build"
17+
log: ./ppg1.log
18+
datadir: ./postgrespro-data1
19+
usedtm: true
20+
node_id: 1
21+
ppg_configfile:
22+
# we should so delete/reinit on playbook, after that drop rexeps here
23+
- line: "shared_buffers = 1024MB" # 1/4 RAM
24+
regexp: "^shared_buffers "
25+
- line: "wal_keep_segments = 128"
26+
regexp: "^wal_keep_segments "
27+
- line: "fsync = off"
28+
regexp: "^fsync "
29+
- line: "autovacuum = off"
30+
regexp: "^autovacuum "
31+
- line: "listen_addresses = '*'"
32+
regexp: "^listen_addresses "
33+
- line: "port = 5432"
34+
regexp: "^port "
35+
- line: "max_connections = 1024"
36+
regexp: "^max_connections "
37+
38+
- hosts: workers
39+
# gather_facts: no
40+
roles:
41+
42+
- role: postgrespro
43+
deploy_postgres: true
44+
ppg_usedtm: true
45+
ppg_dtmhost: "158.250.29.10"
46+
ppg:
47+
version: xtm
48+
src: ./postgrespro
49+
dst: "/tmp/postgrespro-build"
50+
log: ./ppg1.log
51+
datadir: ./postgrespro-data1
52+
usedtm: true
53+
node_id: 1
54+
ppg_configfile:
55+
# we should so delete/reinit on playbook, after that drop rexeps here
56+
- line: "shared_buffers = 1024MB" # 1/4 RAM
57+
regexp: "^shared_buffers "
58+
- line: "wal_keep_segments = 128"
59+
regexp: "^wal_keep_segments "
60+
- line: "fsync = off"
61+
regexp: "^fsync "
62+
- line: "autovacuum = off"
63+
regexp: "^autovacuum "
64+
- line: "listen_addresses = '*'"
65+
regexp: "^listen_addresses "
66+
- line: "port = 5432"
67+
regexp: "^port "
68+
- line: "max_connections = 1024"
69+
regexp: "^max_connections "
70+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-----BEGIN RSA PRIVATE KEY-----
2+
MIIEpAIBAAKCAQEAx2a2Rhzv9lQvufzq3UGgLhdwQJL3eyBTaJ+5HNWrmLHrXsti
3+
QDKFSPhLavZzfIodZUYA0KHjk4RIfXwCpdEPGiOoiK0Kcrr1mSEASuSfITea9/i9
4+
Q+0TR9xQErmjK9JKRqJcKD7G/ow/pszc29Lr97/lEk7eZ91ISveS50P9zefCFDNJ
5+
Hdl38Qr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
21+
ysSS0hv7RJME8/YVYRSWcQKBgQCnK1FQKwzBrpWbmh7LIeqlmCyzOhGucVtSQUTw
22+
Abbm4Cz7xfR0oeYZvFRXg7Mt9+ozLfrsndaDOovx13K2lNUmj47vpMarKhqC8SlU
23+
6+y9NLghCM0IwULygmKupkRYIM/agW5LGw5OcxaoydpftY0s+mOtQu+IJuVlpUed
24+
tT2bCQKBgQDHXhA1+y1bpaxAahqDKGq7fiwjBSIgJiHcN46ku1Dm+rFBJAhERDC0
25+
4uyAcap1Z+FFMp3U8qkY1ut4HsBtDWT4QiPyglDLs38/OTPuf9Q6R91AEoKGaS/V
26+
d76uZD3elYG0CqOK+9eE1eqbALDFnJ7KRLtVRD8nYtgSc/lIAAh1Xw==
27+
-----END RSA PRIVATE KEY-----
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
3+
- name: ensure we have checked out libuv-1.7.5
4+
git: repo=https://github.com/libuv/libuv.git
5+
dest={{libuv.src}}
6+
version={{libuv.version}}
7+
update=no
8+
9+
- name: build libuv
10+
shell: ./autogen.sh && ./configure --disable-shared --prefix={{libuv.dst}} && make && make install
11+
args:
12+
chdir: "{{libuv.src}}"
13+
creates: "{{libuv.dst}}/lib/libuv.a"
14+
15+
- name: compile dtmd
16+
shell: make "LIBUV_PREFIX={{libuv.dst}}"
17+
args:
18+
chdir: "{{ppg.src}}/contrib/pg_dtm/dtmd"
19+
creates: "{{ppg.src}}/contrib/pg_dtm/dtmd/bin/dtmd"
20+
21+
- name: install dtmd
22+
command: cp "{{ppg.src}}/contrib/pg_dtm/dtmd/bin/dtmd" "{{dtmd.dst}}"
23+
args:
24+
creates: "{{dtmd.dst}}"
25+
26+
- name: ensure datadir for dtm exists
27+
file: dest={{dtmd.datadir}} state=directory
28+
29+
- name: start dtm
30+
shell: nohup {{dtmd.dst}} -d {{dtmd.datadir}} -a 0.0.0.0 -p 5431 > dtmd.log &
31+
32+
- name: wait until dtm is available
33+
wait_for: port=5431 delay=1
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
3+
- name: ensure dependencies (Debian)
4+
apt: pkg={{item}} state=installed
5+
with_items:
6+
- git
7+
- automake
8+
- libtool
9+
- build-essential
10+
- bison
11+
- flex
12+
- libreadline-dev
13+
when: ansible_os_family == "Debian"
14+
15+
- name: ensure dependencies (RedHat)
16+
yum: name="@Development tools" state=present
17+
when: ansible_os_family == "RedHat"
18+
sudo: yes
19+
20+
- name: ensure dependencies (RedHat)
21+
yum: name={{item}} state=installed
22+
with_items:
23+
- git
24+
- automake
25+
- libtool
26+
- bison
27+
- flex
28+
- readline-devel
29+
when: ansible_os_family == "RedHat"
30+
sudo: yes
31+
32+
- name: setup the private key for postgrespro git access
33+
copy: dest=.ssh/ppg-deploy src=ppg-deploy.key mode=0600
34+
35+
- name: ensure we have checked out postgrespro (xtm)
36+
git: repo=git@gitlab.postgrespro.ru:pgpro-dev/postgrespro.git
37+
dest={{ppg.src}}
38+
version={{ppg.version}}
39+
force=yes
40+
update=yes
41+
key_file=.ssh/ppg-deploy
42+
accept_hostkey=yes
43+
depth=1
44+
register: ppgsources
45+
46+
- include: postgres.yml
47+
when: deploy_postgres
48+
49+
- include: dtm.yml
50+
when: deploy_dtm
51+
52+
# - include: pg_shard.yml
53+
# when: deploy_pg_shard == true
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
- name: checkout pg_shard
2+
git: repo=git@gitlab.postgrespro.ru:s.kelvich/pg_shard.git
3+
dest=./pg_shard
4+
version=transaction_manager_integration
5+
force=yes
6+
update=yes
7+
key_file=.ssh/banktest
8+
accept_hostkey=yes
9+
depth=1
10+
register: pg_shard_source
11+
12+
- name: build pg_shard extension
13+
shell: "PATH={{ppg.dst}}/bin:$PATH make clean && PATH={{ppg.dst}}/bin:$PATH make && PATH={{ppg.dst}}/bin:$PATH make install"
14+
args:
15+
chdir: "~/pg_shard"
16+
creates: "{{ppg.dst}}/lib/pg_shard.so"
17+
18+
- name: enable pg_shard extension in postgresql.conf with dtm
19+
lineinfile:
20+
dest: "{{ppg.datadir}}/postgresql.conf"
21+
regexp: "{{item.regexp}}"
22+
line: "{{item.line}}"
23+
state: present
24+
with_items:
25+
- line: "shared_preload_libraries = 'pg_dtm, pg_shard'"
26+
regexp: "^shared_preload_libraries "
27+
when: ppg.usedtm
28+
29+
- name: enable pg_shard extension in postgresql.conf without dtm
30+
lineinfile:
31+
dest: "{{ppg.datadir}}/postgresql.conf"
32+
regexp: "{{item.regexp}}"
33+
line: "{{item.line}}"
34+
state: present
35+
with_items:
36+
- line: "shared_preload_libraries = 'pg_shard'"
37+
regexp: "^shared_preload_libraries "
38+
when: not ppg.usedtm
39+
40+
41+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy