Issue #5147
closedPostgresql version on centos 7 is outdated
Description
ansible-pulp is installing postgresql 9.2 on centos 7 but django 2.1+ requires postgresql 9.4+:
https://docs.djangoproject.com/en/2.1/releases/2.1/#dropped-support-for-postgresql-9-3
We need to install a newer postgresql version via SCL.
If you try to use the pulp_ansible plugin on CentOS 7, you'll hit this error:
fatal: [pulp3-devel]: FAILED! => changed=true
cmd:
- /usr/local/lib/pulp/bin/django-admin
- migrate
- --no-input
delta: '0:00:02.118012'
end: '2019-07-16 18:05:26.170082'
msg: non-zero return code
rc: 1
start: '2019-07-16 18:05:24.052070'
stderr: |-
Traceback (most recent call last):
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.SyntaxError: syntax error at or near "WITH ORDINALITY"
LINE 6: FROM unnest(c.conkey) WITH ORDINALITY co...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/pulp/bin/django-admin", line 11, in <module>
sys.exit(execute_from_command_line())
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/management/commands/migrate.py", line 234, in handle
fake_initial=fake_initial,
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/migrations/operations/models.py", line 372, in database_forwards
to_field,
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/base/schema.py", line 535, in alter_field
old_db_params, new_db_params, strict)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/postgresql/schema.py", line 124, in _alter_field
new_db_params, strict,
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/base/schema.py", line 543, in _alter_field
fk_names = self._constraint_names(model, [old_field.column], foreign_key=True)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/base/schema.py", line 1115, in _constraint_names
constraints = self.connection.introspection.get_constraints(cursor, model._meta.db_table)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/postgresql/introspection.py", line 175, in get_constraints
""", ["public", table_name])
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: syntax error at or near "WITH ORDINALITY"
LINE 6: FROM unnest(c.conkey) WITH ORDINALITY co...
^
stderr_lines: <omitted>
stdout: |-
Operations to perform:
Apply all migrations: admin, ansible, auth, contenttypes, core, docker, file, sessions
Running migrations:
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying core.0001_initial... OK
Applying ansible.0001_initial... OK
Applying ansible.0002_advanced_collections...
stdout_lines: <omitted>
Updated by daviddavis almost 5 years ago
- Description updated (diff)
- Sprint set to Sprint 56
Updated by daviddavis almost 5 years ago
- Subject changed from Error when migrating pulp_ansible plugin on centos 7 to Postgresql version on centos 7 is outdated
Updated by daviddavis almost 5 years ago
Whatever version of postgresql we go with, we should just notify or confirm with Katello since they are on 9.2.
Updated by ttereshc almost 5 years ago
As of now (July 2019), Katello thinks that they'll use PostgreSQL 10.x - whichever has the longest support and whichever is available in SCLs.
Updated by mdepaulo@redhat.com almost 5 years ago
9.4, 9.5, 9.6 and 10.x ["(not 10.0 as the page says)":http://mirror.centos.org/centos/7/sclo/x86_64/rh/rh-postgresql10/\] are available via software collections.
https://www.softwarecollections.org/en/scls/?search=postgres
https://pkgs.org/download/postgresql-server
Updated by ttereshc almost 5 years ago
+1 for Django 2.2 (LTS) and at least Postgresql 9.6
ignore_conflicts
option is very convenient for bulk_create and the migration tool would like to use it:
https://docs.djangoproject.com/en/2.2/ref/models/querysets/#django.db.models.query.QuerySet.bulk_create
Updated by bmbouter almost 5 years ago
ttereshc wrote:
+1 for Django 2.2 (LTS) and at least Postgresql 9.6
+1 I agree
Updated by bmbouter almost 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to bmbouter
I think I can fix this. I'm going to test the fix and post it.
Updated by bmbouter almost 5 years ago
- Status changed from ASSIGNED to POST
PR available at: https://github.com/pulp/ansible-pulp/pull/129
Added by bmbouter over 4 years ago
Added by Brian Bouterse over 4 years ago
Revision 60d4d86c | View on GitHub
Add PostgreSQL 9.6 for CentOS7
Pulp is requiring PostgreSQL 9.6 with Django 2.2 (LTS). This upgrades the version of PostgreSQL on CentOS 7 to 9.6 via software collections.
The systemd files can no longer depend on the postgresql service name to restart them when postgresql restarts. Foremost because we can't be guaranteed postgresql is a systemd unit on this system. Secondly due to this PR that name is now changing on centos7.
This PR removes the systemd dependency on postgresql service units and instead configures all Pulp services to automatically always restart when it exits. Stopping the unit with systemctl still stops it.
Updated by bmbouter over 4 years ago
- Status changed from POST to MODIFIED
Applied in changeset ansible-pulp3|60d4d86c2a42d75cbc69dd3e60812b5363fbb4e4.
Added by bmbouter over 4 years ago
Revision 89975aeb | View on GitHub
Update to Installer that has PostgreSQL 9.6
This includes the update to the installer so that on centos7 PostgreSQL 9.6 is installer via software collections.
Updated by bmbouter over 4 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Updated by ggainey almost 4 years ago
- Tags Katello added
- Tags deleted (
Katello-P1)
Updated by bmbouter almost 4 years ago
- Category set to Installer - Moved to GitHub issues
- Tags deleted (
Pulp 3 installer)
Add PostgreSQL 9.6 for CentOS7
Pulp is requiring PostgreSQL 9.6 with Django 2.2 (LTS). This upgrades the version of PostgreSQL on CentOS 7 to 9.6 via software collections.
The systemd files can no longer depend on the postgresql service name to restart them when postgresql restarts. Foremost because we can't be guaranteed postgresql is a systemd unit on this system. Secondly due to this PR that name is now changing on centos7.
This PR removes the systemd dependency on postgresql service units and instead configures all Pulp services to automatically always restart when it exits. Stopping the unit with systemctl still stops it.
https://pulp.plan.io/issues/5147 closes #5147