-
Notifications
You must be signed in to change notification settings - Fork 312
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
Add upgrade helper #246
Conversation
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
LGTM for me. Will test it locally |
|
||
if [[ -z ${PGUNIXUSEROLD} ]]; then | ||
PGUNIXUSEROLD=postgres | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this ever change ?
There was a problem hiding this comment.
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline patch
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." |
There was a problem hiding this comment.
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.
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?) |
For #243
At the moment the unittest checks:
We can incrementally improve for different version when we need to.