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

Block when cP accts have DBs on distro PgSQL #327

Merged

Conversation

sloanebernstein
Copy link
Contributor

This patch is requested by cPanel Support to try to prevent users of PostgreSQL on cPanel from being surprised that their databases are unavailable once the ELevate process completes; see CPANEL-43203 for previous discussion.


Modify the Databases blocker to add a condition which checks for the following three conditions:

  1. a postgresql-server package is installed;
  2. the file /var/cpanel/acknowledge_postgresql_for_elevate does not exist;
  3. one or more cPanel users have a PostgreSQL database mapped to them.

If all three are true, issue a blocker. In the blocker message, indicate which cPanel accounts have relevant databases, point the admin to resources which explain how to update the PostgreSQL data directory, and instruct the admin on how to acknowledge the blocking warning using the touch file. Additionally, modify the "Blockers" documentation page with the same resources as well as a potential way to use distro-provided tools to perform the update of the data directory and resolve the issue.

By submitting pull requests to this repo, I agree to the Contributor License Agreement which can be found at: https://github.com/cpanel/elevate/blob/main/docs/cPanel-CLA.pdf

elevate-cpanel Outdated Show resolved Hide resolved
elevate-cpanel Outdated Show resolved Hide resolved
elevate-cpanel Outdated Show resolved Hide resolved
elevate-cpanel Outdated Show resolved Hide resolved
@sloanebernstein sloanebernstein force-pushed the block-on-unacknowledged-postgresql-dbs branch from b54960b to 69b622a Compare December 15, 2023 20:33
@sloanebernstein sloanebernstein force-pushed the block-on-unacknowledged-postgresql-dbs branch from 69b622a to 5f1ac8b Compare December 20, 2023 18:00
One or more users on your system have associated PostgreSQL databases.
ELevate may upgrade the software packages associated with PostgreSQL
automatically, but if it does, it will *NOT* automatically update the
PostgreSQL data directory to work with the new version. Without an update
Copy link
Member

Choose a reason for hiding this comment

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

Can't we run the script to upgrade them? Why can't we use the psql channel to switch them to 8.3 instead of 10?

Copy link
Contributor Author

@sloanebernstein sloanebernstein Dec 20, 2023

Choose a reason for hiding this comment

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

It can't be 8.3 because downgrades are not possible.

We can upgrade them. It could be a candidate for a leapp actor, even, though that assumes that AlmaLinux wants something like that in their fork. (I'm assuming that there's a reason Red Hat never did something similar for their original version of leapp, in favor of producing documentation instead.)

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I meant 9.6 See these old instructions:

-    You have postgresql-server version 9.2 installed.
-    This is upgraded irreversably to version 10.0 when you switch to AlmaLinux 8
-    We recommend data backup and removal of all postgresql packages before upgrade to AlmaLinux 8.
-    To re-install postgresql 9 on AlmaLinux 8, you can run: `dnf -y module enable postgresql:9.6; dnf -y install postgresql-server`

Copy link
Member

Choose a reason for hiding this comment

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

In theory we could do this for them...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but we would still need to perform the data directory update, because prior to PostgreSQL 10, the first two elements of the version number are considered the "major" version: 9.2.x to 9.6.x is a major upgrade.

@toddr toddr marked this pull request as draft January 9, 2024 17:21
@toddr
Copy link
Member

toddr commented Jan 9, 2024

converting to draft while we discuss this further internally.

@sloanebernstein sloanebernstein force-pushed the block-on-unacknowledged-postgresql-dbs branch from 5f1ac8b to 36fbb86 Compare January 11, 2024 22:24
@toddr toddr marked this pull request as ready for review January 18, 2024 06:05
@toddr toddr requested review from timmullin and cPholloway and removed request for atoomic January 18, 2024 06:05
@cPholloway
Copy link
Contributor

This just needs a rebase before I approve it

@sloanebernstein sloanebernstein force-pushed the block-on-unacknowledged-postgresql-dbs branch from 36fbb86 to 0a41bce Compare January 18, 2024 20:05
Modify the Databases blocker to add a condition which checks for the
following three conditions:

1. a `postgresql-server` package is installed;
2. the file `/var/cpanel/acknowledge_postgresql_for_elevate` does not
   exist;
3. one or more cPanel users have a PostgreSQL database mapped to them.

If all three are true, issue a blocker. In the blocker message, indicate
which cPanel accounts have relevant databases, point the admin to
resources which explain how to update the PostgreSQL data directory, and
instruct the admin on how to acknowledge the blocking warning using the
touch file. Additionally, modify the "Blockers" documentation page with
the same resources as well as a potential way to use distro-provided
tools to perform the update of the data directory and resolve the issue.
@sloanebernstein sloanebernstein force-pushed the block-on-unacknowledged-postgresql-dbs branch from 0a41bce to 8cec4fc Compare January 18, 2024 20:09
@toddr toddr merged commit a239e8e into cpanel:main Jan 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants