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

postgresql versions moved to common facts #600

Merged
merged 2 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion ansible/data_quality_filter_service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- common
- java
- {role: db-backup, db: postgres, db_name: "{{ dq_db_name }}", db_user: "{{ dq_db_user }}", db_password: "{{ dq_db_password }}" }
- {role: postgresql, pg_version: "{{ data_quality_pg_version | default('13') }}"}
- postgresql
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of removing, why not just define data_quality_pg_version in the relevant inventory?

- {role: pg_instance, extensions: [], db_name: "{{ dq_db_name }}", db_user: "{{ dq_db_user }}", db_password: "{{ dq_db_password }}" }
- tomcat
- webserver
Expand Down
2 changes: 1 addition & 1 deletion ansible/doi-service-standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- java
- postfix
- {role: db-backup, db: postgres, db_name: "{{ doi_db_name }}", db_user: "{{ doi_db_user }}", db_password: "{{ doi_db_password }}" }
- {role: postgresql, pg_version: "9.6"}
- postgresql
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of removing the version, why not just add doi_service_pg_version with a default and override it in the relevant inventory?

- {role: pg_instance, extensions: ["citext", "pgcrypto"], db_name: "{{ doi_db_name }}", db_user: "{{ doi_db_user }}", db_password: "{{ doi_db_password }}" }
- {role: ansible-elasticsearch, es_templates: false, es_instance_name: 'doi-elasticsearch', es_data_dirs: ['/data/elasticsearch'], tags: ['elasticsearch']}
- webserver
Expand Down
2 changes: 1 addition & 1 deletion ansible/image-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- common
- { role: ansible-elasticsearch, es_templates: false, es_instance_name: 'images', tags: ['elasticsearch']}
- { role: db-backup, db: postgres, db_name: "images", db_user: "{{ image_service_db_username }}", db_password: "{{ image_service_db_password }}" }
- { role: postgresql, pg_version: "{{ image_service_postgresql_version | default('10') }}", postgis_version: "{{ image_service_postgis_version | default('2.4') }}" }
- postgresql
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of removing, why not just define image_service_postgresql_version and image_service_postgis_version in the relevant inventory?

- { role: pg_instance, extensions: ["citext", "pgcrypto"], db_name: "{{ image_service_db_name }}", db_user: "{{ image_service_db_username }}", db_password: "{{ image_service_db_password }}", db_role_attr_flags: "NOSUPERUSER" }
- webserver
- i18n
Expand Down
9 changes: 9 additions & 0 deletions ansible/roles/common/tasks/setfacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
python_software_properties: "python3-software-properties"
tomcat_dir: "/var/lib/{{ tomcat }}"
tomcat_webapps: "/var/lib/{{ tomcat }}/webapps/"
pg_version: '9.6'
Copy link
Contributor

Choose a reason for hiding this comment

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

Some apps will have minimum postgres versions, eg they'll be using jsonb or something introduced in pg10+. Why force 9.6 here?

postgis_version: '2.4'
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems wrong - the postgres role is not supposed to install postgis unless the postgis version is defined. By defining it here, won't postgis always be installed?

postgis_scripts_version: '2.4'
# openjdk-8 will be removed at some point from Ubuntu-18.04, so we will need to switch to Zulu-8 or similar at that point
# openjdk-lts on Ubuntu-18.04 is JDK-11, so will not be directly useful by our applications at this point due to lack of testing
# use_openjdk8: true
Expand Down Expand Up @@ -124,6 +127,9 @@
python_software_properties: "python3-software-properties"
tomcat_dir: "/var/lib/{{ tomcat }}"
tomcat_webapps: "/var/lib/{{ tomcat }}/webapps/"
pg_version: '10'
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto above

postgis_version: '2.5'
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto above

postgis_scripts_version: '2.5'
# openjdk-8 will be removed at some point from Ubuntu-18.04, so we will need to switch to Zulu-8 or similar at that point
# use_openjdk8: true
# use_zulu8: False
Expand Down Expand Up @@ -161,6 +167,9 @@
tomcat_dir: "/var/lib/{{ tomcat }}"
tomcat_webapps: "/var/lib/{{ tomcat }}/webapps/"
psycopg2_package: "python3-psycopg2"
pg_version: '14'
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto above

postgis_version: '3'
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto above

postgis_scripts_version: '3.2'
when: ansible_os_family == "Debian" and ansible_distribution_version == "22.04"
tags:
- setfacts
Expand Down
6 changes: 3 additions & 3 deletions ansible/roles/postgresql/tasks/postgis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
become: yes
become_user: postgres
with_items:
- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_version}}/postgis.sql"
- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_version}}/spatial_ref_sys.sql"
- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_version}}/postgis_comments.sql"
- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_scripts_version}}/postgis.sql"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this action and just add postgis to the extensions list in the corresponding pg_instance calls, since nothing is using postgis < 2.2 and this is only necessary for those postgis versions AFAIK?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok. Pending

- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_scripts_version}}/spatial_ref_sys.sql"
- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_scripts_version}}/postgis_comments.sql"
tags:
- postgresql
- postgis
2 changes: 1 addition & 1 deletion ansible/spatial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- java
- tomcat
- webserver
- {role: postgresql, pg_service: 'postgresql-9.6', pg_version: '9.6', postgis_version: '2.4'}
- postgresql
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of removing the version, why not add spatial_pg_version and sptaial_postgis_version and then override them in the relevant inventory?

- {role: pg_instance, extensions: ['postgis', 'postgis_topology', 'uuid-ossp'], db_name: "{{geonetwork_database}}", db_user: "{{geonetwork_db_username}}", db_password: "{{geonetwork_db_password }}" }
- {role: pg_instance, extensions: ['postgis', 'postgis_topology', 'uuid-ossp'], db_name: "{{layers_db_name}}", db_user: "{{layers_db_username}}", db_password: "{{layers_db_password}}" }
- layers-db
Expand Down