GitLab was throwing me a 500 server error this morning after an upgrade via yum. To troubleshoot, I ran the self diagnose command from terminal:
# gitlab-rake gitlab:check
Which gave me the following error to fix:
All migrations up? ... no Try fixing it: sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production Please fix the error above and rerun the checks.
Since I installed GitLab via a yum package, I ran a slightly different command to run the GitLab migrations:
# gitlab-rake db:migrate RAILS_ENV=production
Now I was presented with the source of the issue, relating to PostgreSQL. I needed to enable the pg_trgm extension:
== 20160226114608 AddTrigramIndexesForSearching: migrating ==================== -- execute("SELECT true AS enabled FROM pg_available_extensions WHERE name = 'pg_trgm' AND installed_version IS NOT NULL;") -> 0.0066s rake aborted! StandardError: An error has occurred, all later migrations canceled: You must enable the pg_trgm extension. You can do so by running "CREATE EXTENSION pg_trgm;" as a PostgreSQL super user, this must be done for every GitLab database.
And sure enough, others were having the same issue. These are the steps they (and I) executed to fix the issue:
# yum install postgresql-contrib # su - postgres $ psql -d gitlabhq_production -c "CREATE EXTENSION pg_trgm;" $ exit # gitlab-rake db:migrate RAILS_ENV=production # gitlab-ctl reconfigure # gitlab-ctl restart