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

Add upgrade helper #246

Closed
wants to merge 1 commit into from
Closed

Add upgrade helper #246

wants to merge 1 commit into from

Conversation

lucernae
Copy link
Contributor

For #243
At the moment the unittest checks:

old version new version
postgresql-11-postgis-2.5 postgresql-12-postgis-3

We can incrementally improve for different version when we need to.

@lucernae lucernae requested a review from NyakudyaA April 30, 2020 09:45
@lucernae
Copy link
Contributor Author

CC @NyakudyaA we don't handle postgis migration explicitly yet. Maybe it has to be injected using manual dump in the new cluster. But for the moment, I am planning on merging this PR after passing your review (without handling postgis migration using manual dump/pl scripts.).


# Inline replace
# Change cluster data_directory
sed -i 's|^data_directory|#data_directory|' /etc/postgresql/11/main/postgresql.conf
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you not supposed to use env variables to reference these so that this can be generic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, you mean the version. Yes, I forgot to replace it.

@NyakudyaA
Copy link
Collaborator

LGTM for me. Will test it locally


if [[ -z ${PGUNIXUSEROLD} ]]; then
PGUNIXUSEROLD=postgres
fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this ever change ?

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 might be if it comes from different image and you want to preserve the ownership so the same datadir can be used in previous image.
But the option is not mandatory

Comment on lines +29 to +30
sed -i 's|^data_directory|#data_directory|' /etc/postgresql/11/main/postgresql.conf
echo "data_directory = '${PGDATAOLD}' # Added by cluster-upgrade.sh" >> /etc/postgresql/11/main/postgresql.conf
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The inline patch

Suggested change
sed -i 's|^data_directory|#data_directory|' /etc/postgresql/11/main/postgresql.conf
echo "data_directory = '${PGDATAOLD}' # Added by cluster-upgrade.sh" >> /etc/postgresql/11/main/postgresql.conf
sed -i 's|^data_directory|#data_directory|' /etc/postgresql/${PGVERSIONOLD}/main/postgresql.conf
echo "data_directory = '${PGDATAOLD}' # Added by cluster-upgrade.sh" >> /etc/postgresql/${PGVERSIONOLD}/main/postgresql.conf

# Variable sanity check
if [[ -z ${PGVERSIONOLD} ]]; then
echo "Environment variable PGVERSIONOLD is empty."
echo "It must be set to postgresql version of the old cluster."
Copy link
Contributor Author

Choose a reason for hiding this comment

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

On second thought, I think it would be good to fail early in this case.

@kristofj-umd
Copy link

I am looking for a way to upgrade my container's version from 9.6-2.4 to the current version (15?-3?). Do you have a workflow that you can recommend for accomplishing this? (Or, even better, a script for handling this?)

@NyakudyaA NyakudyaA closed this Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants