Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended and adapted to install PostgreSQL 10 for CentOS and Ubuntu #267

Merged
merged 19 commits into from
Mar 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
93b7143
Extended and adapted to install PostgreSQL 10 for CentOS and Ubuntu
Nov 24, 2017
b6b12a7
Removed tabs from defaults/main.yml.
Feb 7, 2018
430bb1e
Adapted .travis.yml and yml files to run tests successfully for all g…
Feb 9, 2018
fd9b231
Bug fix. Removed remains for my local teste in test/playbook.yml.
Feb 9, 2018
5a02391
Bug fix and refinement for postgresql.conf-10.* .
Feb 16, 2018
3dec063
Merge current project master branch (remote-tracking branch 'project/…
Mar 26, 2018
db0e837
Merge remote-tracking branch 'project/master' into wp-update-to-postg…
Mar 26, 2018
fec5895
Added suggestions from gclough.
Mar 27, 2018
59c1ccc
Replaced vagrant setup by project's master branch.
Mar 27, 2018
82140ca
Updated tests/docker/group_vars/all.yml to include version 10.
Mar 28, 2018
9cdd7ae
Uncommented 'no_log: true' in users.yml.
Mar 28, 2018
61b63c5
Uncommented user baz in tests/docker/group_vars/postgresql.yml.
Mar 28, 2018
996d471
Recreated user baz but without passwd. We need him as database owner …
Mar 28, 2018
53c7d5b
Added encrypted passwd for user baz.
Mar 28, 2018
511f5b0
Commented need for encrypted password if version >= 10.
Mar 28, 2018
dec9295
Merge branch 'fix-no-log' into wp-update-to-postgres-10
Mar 28, 2018
7ae272f
Reenabled no_log: true for task PostgreSQL | Make sure the PostgreSQ…
Mar 29, 2018
bf33550
Just to trigger a new build on github. Added blank in README.md.
Mar 29, 2018
38b8851
Second try to trigger a rebuild. Blank in README.md deleted.
Mar 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ postgresql_ssl_ciphers:
- "@STRENGTH"
postgresql_ssl_prefer_server_ciphers: on
postgresql_ssl_ecdh_curve: "prime256v1"
postgresal_ssl_dh_params_file: "" # (>= 10)
postgresql_ssl_renegotiation_limit: 512MB # amount of data between renegotiations
postgresql_ssl_cert_file: "/etc/ssl/certs/ssl-cert-snakeoil.pem" # (>= 9.2)
postgresql_ssl_key_file: "/etc/ssl/private/ssl-cert-snakeoil.key" # (>= 9.2)
Expand Down Expand Up @@ -199,6 +200,7 @@ postgresql_bgwriter_flush_after: 0 # (>= 9.6) 0 disables,
postgresql_effective_io_concurrency: 1 # 1-1000; 0 disables prefetching
postgresql_max_worker_processes: 8 # (change requires restart)
postgresql_max_parallel_workers_per_gather: 0 # (>= 9.6) taken from max_worker_processes
postgresql_max_parallel_workers: 8 # (>= 10)
postgresql_old_snapshot_threshold: -1 # (>= 9.6) 1min-60d; -1 disables; 0 is immediate
# (change requires restart)
postgresql_backend_flush_after: 0 # (>= 9.6) 0 disables, default is 0
Expand Down Expand Up @@ -319,6 +321,15 @@ postgresql_wal_receiver_timeout: 60s
# time to wait before retrying to retrieve WAL after a failed attempt
postgresql_wal_retrieve_retry_interval: 5s # (>= 9.5)

# - Subscribers - (>= 10)

# These settings are ignored on a publisher.

postgresql_max_logical_replication_workers: 4 # (>= 10) taken from max_worker_processes
# (change requires restart)
postgresql_max_sync_workers_per_subscription: 2 # (>= 10) taken from max_logical_replication_workers


#------------------------------------------------------------------------------
# QUERY TUNING
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -347,7 +358,9 @@ postgresql_cpu_index_tuple_cost: 0.005 # same scale as above
postgresql_cpu_operator_cost: 0.0025 # same scale as above
postgresql_parallel_tuple_cost: 0.1 # same scale as above (>= 9.6)
postgresql_parallel_setup_cost: 1000.0 # same scale as above (>= 9.6)
postgresql_min_parallel_relation_size: 8MB # (>= 9.6)
postgresql_min_parallel_relation_size: 8MB # (= 9.6) replaced by below two parameters in 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the comment about "replaced below"? I'm not sure if that matches the style of the others, which normally just list > < = and the version, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be helpful as a reminder if transitioning from 9.6 to 10.

postgresql_min_parallel_table_scan_size: 8MB # (>= 10)
postgresql_min_parallel_index_scan_size: 512kB # (>= 10)
postgresql_effective_cache_size: 128MB


Expand Down Expand Up @@ -499,11 +512,13 @@ postgresql_log_line_prefix: "%t "
# log lock waits >= deadlock_timeout
postgresql_log_lock_waits: off
postgresql_log_statement: "none" # none, ddl, mod, all
postgresql_log_replication_commands: off
# log temporary files equal or larger
postgresql_log_temp_files: -1
postgresql_log_timezone: "UTC"



#------------------------------------------------------------------------------
# RUNTIME STATISTICS
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -588,6 +603,7 @@ postgresql_bytea_output: "hex" # hex, escape
postgresql_xmlbinary: "base64"
postgresql_xmloption: "content"
postgresql_gin_fuzzy_search_limit: 0 # (<= 9.2)
postgresql_gin_pending_list_limit: 4MB # (>= 9.5)


# - Locale and Formatting -
Expand Down Expand Up @@ -639,6 +655,11 @@ postgresql_max_locks_per_transaction: 64 # min 10
# lock table slots.
postgresql_max_pred_locks_per_transaction: 64 # min 10

postgresql_max_pred_locks_per_relation: -2 # (>= 10) negative values mean
# (max_pred_locks_per_transaction
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these comments in this file? If someone wants to know what it does, then they can check the doco, or the postresql.conf itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Same for other comments taken from the original config file. May be for less exerienced people like me helpful to read it here too :-).

# / -max_pred_locks_per_relation) - 1
postgresql_max_pred_locks_per_page: 2 # (>= 10) min 0


#------------------------------------------------------------------------------
# VERSION/PLATFORM COMPATIBILITY
Expand Down Expand Up @@ -713,6 +734,7 @@ postgresql_pgdg_releases:
9.4: 3,
9.5: 3,
9.6: 3,
10: 2,
}
centos: {
9.1: 7,
Expand All @@ -721,6 +743,7 @@ postgresql_pgdg_releases:
9.4: 3,
9.5: 3,
9.6: 3,
10: 2,
}
sl: {
9.1: 8,
Expand All @@ -729,6 +752,7 @@ postgresql_pgdg_releases:
9.4: 3,
9.5: 3,
9.6: 3,
10: 2,
}
oraclelinux: {
9.1: 8,
Expand All @@ -737,6 +761,7 @@ postgresql_pgdg_releases:
9.4: 3,
9.5: 3,
9.6: 3,
10: 2,
}
postgresql_version_terse: "{{ postgresql_version | replace('.', '') }}"
postgresql_yum_repository_base_url: "http://yum.postgresql.org"
Expand Down
35 changes: 24 additions & 11 deletions templates/HOWTO.postgresql.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,34 @@
How to add a new PostgreSQL version
===================================

1) Download the Debian package 'postgresql-9.X_[...].deb' from
http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-9.X/
Note: (https://www.postgresql.org/support/versioning)

2) Extract the 'usr/share/postgresql/9.1/postgresql.conf.sample' file
and save it under the 'templates' role directory
=> templates/postgresql.conf.9.{X}.orig
Beginning with version 10, a major release is indicated by increasing the first part of the version,
e.g. 10 to 11. Before version 10, a major release was indicated by increasing either the first or second
part of the version number, e.g. 9.5 to 9.6.

3) Check the difference between another version:
=> vimdiff postgresql.conf.9.{X-1}.orig postgresql.conf.9.{X}.orig
Do the following steps: ( versions mentioned for transitioninng from version 9.6 to 10 )

4) Copy an existing template:
=> cp postgresql.conf.9.{X-1}.j2 postgresql.conf.9.{X}.j2
1) Download the Debian package 'postgresql-<major_version>_[...].deb' from
http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-<major_version>, e.g. for new version 10 from
http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-10

2) Extract the 'usr/share/postgresql/<major-version>/postgresql.conf.sample' file with
dpkg-deb -x postgresql-<major_version>_[...].deb dir/to/extract/to/

and save it under the 'templates' role directory
=> templates/postgresql.conf.<major_version>.orig

3) Check the difference between another version, e.g. for 9.6 -> 10:
=> vimdiff postgresql.conf.10.orig postgresql.conf.9.6.orig

4) Copy an existing template, e.g.:
=> cp postgresql.conf.9.6.j2 postgresql.conf.10.j2

5) Update the new template following the major differences.

5) If there are new options or some of them removed, update the 'default/main.yml' file and add a "(>= 9.X)" or "(<= 9.X)" comment to them.
6) If there are new options or some of them removed, update the 'default/main.yml' file and add a "(>= 10)" or "(<= 10)" comment to them.

7) For yum based installation add version and minor version of postgresql in 'default/main.yml' under '# YUM settings' at end of file

6) Update the '.travis.yml' file to test its new version.
8) Update the '.travis.yml' file to test its new version.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ User={{ postgresql_service_user }}
Group={{ postgresql_service_group }}

Environment=PGDATA={{ postgresql_conf_directory }}

ExecStartPre=
{% if postgresql_version | version_compare('10', '>=') %}
ExecStartPre={{ postgresql_bin_directory }}/postgresql-{{ postgresql_version_terse }}-check-db-dir {{ postgresql_data_directory }}
{% else %}
ExecStartPre={{ postgresql_bin_directory }}/postgresql{{ postgresql_version_terse }}-check-db-dir {{ postgresql_data_directory }}
{% endif %}
Loading