Skip to content

Commit 1e510fd

Browse files
committed
Deploy pg from our repo
1 parent 58bc188 commit 1e510fd

File tree

3 files changed

+65
-74
lines changed

3 files changed

+65
-74
lines changed

tests/deploy/roles/postgres/tasks/main.yml

Lines changed: 51 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -31,79 +31,65 @@
3131
sudo: yes
3232

3333
- name: clone postgres sources
34-
git: repo=git://git.postgresql.org/git/postgresql.git
34+
git: repo={{pg_repo}}
3535
dest={{pg_src}}
3636
version={{pg_version_tag}}
37-
force=yes
38-
update=yes
3937
depth=1
4038
accept_hostkey=True
4139
register: pg_sources
4240

43-
- name: upload patches
44-
get_url: "url={{pg_patch}} dest={{pg_src}}/p1.patch"
45-
# when: pg_sources.before != pg_sources.after
46-
47-
- name: patch postgres
48-
patch: >
49-
src={{pg_src}}/p1.patch
50-
basedir={{pg_src}}
51-
remote_src=True
52-
strip=1
53-
54-
5541
#############################################################################
5642

57-
# - stat: path={{pg_datadir}}/postmaster.pid
58-
# register: pg_pidfile
59-
60-
# - name: stop postgres if it was running
61-
# command: "{{pg_dst}}/bin/pg_ctl stop -w -D {{pg_datadir}}"
62-
# when: pg_pidfile.stat.exists
63-
64-
# - name: force rebuild on changed sources
65-
# command: "rm {{pg_dst}}/bin/postgres"
66-
# when: pg_sources.changed
67-
68-
# - name: build and install
69-
# shell: ./configure --prefix={{pg_dst}} --without-zlib && make clean && make -j {{makejobs}} && make install
70-
# args:
71-
# chdir: "{{pg_src}}"
72-
# creates: "{{pg_dst}}/bin/postgres"
73-
74-
# - name: remove datadirs on datanodes
75-
# command: "rm -rf {{pg_datadir}}"
76-
# when: pg_destroy_and_init
77-
78-
# - name: create datadirs on datanodes
79-
# command: "{{pg_dst}}/bin/initdb {{pg_datadir}}"
80-
# args:
81-
# creates: "{{pg_datadir}}"
82-
83-
# - name: configure postgres on datanodes
84-
# lineinfile:
85-
# dest: "{{pg_datadir}}/postgresql.conf"
86-
# line: "{{item.line}}"
87-
# state: present
88-
# with_items: "{{pg_config}}"
89-
90-
# - name: configure postgres on datanodes -- 2
91-
# lineinfile:
92-
# dest: "{{pg_datadir}}/postgresql.conf"
93-
# line: "{{item.line}}"
94-
# state: present
95-
# with_items: "{{pg_config_role}}"
96-
97-
# - name: enable blind trust on datanodes
98-
# lineinfile:
99-
# dest: "{{pg_datadir}}/pg_hba.conf"
100-
# line: "host all all 0.0.0.0/0 trust"
101-
102-
# # - include: pg_shard.yml
103-
# # when: deploy_pg_shard
104-
105-
# - name: start postgrespro
106-
# command: "{{pg_dst}}/bin/pg_ctl start -w -D {{pg_datadir}} -l {{pg_datadir}}/pg.log"
43+
- stat: path={{pg_datadir}}/postmaster.pid
44+
register: pg_pidfile
45+
46+
- name: stop postgres if it was running
47+
command: "{{pg_dst}}/bin/pg_ctl stop -w -D {{pg_datadir}}"
48+
when: pg_pidfile.stat.exists
49+
50+
- name: force rebuild on changed sources
51+
command: "rm {{pg_dst}}/bin/postgres"
52+
when: pg_sources.changed
53+
54+
- name: build and install
55+
shell: ./configure --prefix={{pg_dst}} --without-zlib && make clean && make -j {{makejobs}} && make install
56+
args:
57+
chdir: "{{pg_src}}"
58+
creates: "{{pg_dst}}/bin/postgres"
59+
60+
- name: remove datadirs on datanodes
61+
command: "rm -rf {{pg_datadir}}"
62+
when: pg_destroy_and_init
63+
64+
- name: create datadirs on datanodes
65+
command: "{{pg_dst}}/bin/initdb {{pg_datadir}}"
66+
args:
67+
creates: "{{pg_datadir}}"
68+
69+
- name: configure postgres on datanodes
70+
lineinfile:
71+
dest: "{{pg_datadir}}/postgresql.conf"
72+
line: "{{item.line}}"
73+
state: present
74+
with_items: "{{pg_config}}"
75+
76+
- name: configure postgres on datanodes -- 2
77+
lineinfile:
78+
dest: "{{pg_datadir}}/postgresql.conf"
79+
line: "{{item.line}}"
80+
state: present
81+
with_items: "{{pg_config_role}}"
82+
83+
- name: enable blind trust on datanodes
84+
lineinfile:
85+
dest: "{{pg_datadir}}/pg_hba.conf"
86+
line: "host all all 0.0.0.0/0 trust"
87+
88+
# - include: pg_shard.yml
89+
# when: deploy_pg_shard
90+
91+
- name: start postgrespro
92+
command: "{{pg_dst}}/bin/pg_ctl start -w -D {{pg_datadir}} -l {{pg_datadir}}/pg.log"
10793

10894

10995

tests/deploy/roles/postgres/vars/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ deploy_postgres: false
66
deploy_dtm: false
77
deploy_pg_shard: false
88

9+
pg_repo: git://git.postgresql.org/git/postgresql.git
10+
pg_version_tag: master
11+
12+
913
pg_destroy_and_init: false
1014

11-
pg_version_tag: master
15+
1216
pg_port: 5432
1317
pg_dtm_enable: false
1418
pg_dtm_host: "127.0.0.1"

tests/deploy/tsdm.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
- role: postgres
88
pg_port: 15432
9-
pg_version_tag: REL9_5_BETA1
9+
pg_repo: https://github.com/kelvich/postgresql.git
10+
pg_version_tag: xtm_patched
1011
pg_destroy_and_init: true
1112
pg_datadir: ./postgrespro-data
12-
pg_patch: https://raw.githubusercontent.com/postgrespro/pg_dtm/master/xtm.patch
1313

1414
- role: postgres
1515
pg_port: 15433
16-
pg_version_tag: REL9_5_BETA1
16+
pg_repo: https://github.com/kelvich/postgresql.git
17+
pg_version_tag: xtm_patched
1718
pg_destroy_and_init: true
1819
pg_datadir: ./postgrespro-data2
19-
pg_patch: https://raw.githubusercontent.com/postgrespro/pg_dtm/master/xtm.patch
2020

2121
tasks:
2222

@@ -28,7 +28,7 @@
2828
register: dtm_sources
2929

3030
- name: build dtm
31-
shell: "PG_CONFIG={{pg_dst}}/bin/pg_config && make clean && make -j {{makejobs}} install"
31+
shell: "PG_CONFIG={{pg_dst}}/bin/pg_config make -j {{makejobs}} install"
3232
args:
3333
chdir: ./pg_tsdtm
3434
when: dtm_sources.changed
@@ -40,7 +40,8 @@
4040
line: "shared_preload_libraries = 'pg_dtm'"
4141
state: present
4242

43-
- name: start postgrespro
44-
command: "{{pg_dst}}/bin/pg_ctl restart -w -D {{pg_datadir}} -l {{pg_datadir}}/pg.log"
45-
43+
- name: restart postgrespro1
44+
command: "{{pg_dst}}/bin/pg_ctl restart -w -D ./postgrespro-data -l ./postgrespro-data/pg.log"
4645

46+
- name: restart postgrespro2
47+
command: "{{pg_dst}}/bin/pg_ctl restart -w -D ./postgrespro-data -l ./postgrespro-data/pg.log"

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