-
-
Notifications
You must be signed in to change notification settings - Fork 164
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
Added postgres upgrade tasks #182
Conversation
tasks/postgres_upgrade.sh
Outdated
| CMD=$(sudo gitlab-psql --version) | ||
| echo "version is ${CMD##* }" | ||
| #9.2.18 | ||
| if [ "${CMD##* }" = "9.2.18" ]; then |
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.
would it better to do a -lt 10 here instead of hardcoding a 9.x?
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.
Not in this case. Refer to the link in the OP's PR.
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.
@Nekototori sorry it took so long to get to this. I had to familiarize myself with bolt and get used to using it with sudo before I could properly review this request.
I noted in three spots where your script uses sudo explicitly. Tasks/scripts should not have sudo in them, and should instead be run with --sudo --tty --run-as root on the command line.
We also need to add some documentation to README, adding a ##Tasks section, and then adding this as the first task.
Once you clean up the sudo's, and add in some documentation for usage I'll merge. Make sure to mention the --sudo --run-as root --tty bit, since it's currently not documented fully in bolt docs.
Thanks for your contribution!
tasks/postgres_upgrade.sh
Outdated
| #!/bin/bash | ||
|
|
||
| echo 'Checking pgsql version' | ||
| CMD=$(sudo gitlab-psql --version) |
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 sudo needs to come out here, and this task needs to be run with --sudo --tty --run-as root
tasks/postgres_upgrade.sh
Outdated
| echo "Database size is: $DB_SIZE kb and freespace is $FREE kb" | ||
| if [ $DB_SIZE -lt $FREE ]; then | ||
| echo 'Enough freespace available to proceed.' | ||
| sudo gitlab-ctl pg-upgrade |
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.
remove sudo
tasks/post_upgrade.sh
Outdated
| @@ -0,0 +1,3 @@ | |||
| #!/bin/bash | |||
| echo 'Cleaning up leftover files from upgrade...' | |||
| sudo rm -rf /var/opt/gitlab/postgresql/data.9.2.18 | |||
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.
remove sudo
Was going through upgrading my older gitlab and had to upgrade the postgres database. This task follows the steps and checks here:
https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server
I've broken it up into two. One does the upgrade, and another does the cleanup.