sameersbn / docker-gitlab

Dockerized GitLab
http://www.damagehead.com/docker-gitlab/
MIT License
7.87k stars 2.14k forks source link

Issue after upgrading sameersbn/docker-gitlab from 8.3.1 to 8.13.6 (and sameersbn/docker-postgressql from 9.1-2 to 9.5-3) #982

Closed ThomBogers closed 7 years ago

ThomBogers commented 7 years ago

After following the upgrade guide I get a 500 error on my gitlab. With postgres outputting the following log, and the last error repeating for all projects:

Initializing datadir...
Initializing certdir...
Initializing logdir...
Initializing rundir...
Setting resolv.conf ACLs...
Initializing database...
‣ Migrating PostgreSQL 9.4 data to 9.5...
‣ Installing PostgreSQL 9.4...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
Creating new cluster 9.4/main ...
  config /etc/postgresql/9.4/main
  data   /var/lib/postgresql/9.4/main
  locale C.UTF-8
  socket /var/run/postgresql
  port   5432
invoke-rc.d: policy-rc.d denied execution of start.
‣ Migration in progress. Please be patient...
Configuring hot standby...
‣ Setting postgresql.conf parameter: wal_level = 'hot_standby'
‣ Setting postgresql.conf parameter: max_wal_senders = '16'
‣ Setting postgresql.conf parameter: checkpoint_segments = '8'
‣ Setting postgresql.conf parameter: wal_keep_segments = '32'
‣ Setting postgresql.conf parameter: hot_standby = 'on'
‣ Setting postgresql.conf parameter: data_directory = '/var/lib/postgresql/9.5/main'
‣ Setting postgresql.conf parameter: log_directory = '/var/log/postgresql'
‣ Setting postgresql.conf parameter: log_filename = 'postgresql-9.5-main.log'
‣ Setting postgresql.conf parameter: ssl = 'off'
Creating database user: gitlab_user
Creating database: gitlab_db...
‣ Loading pg_trgm extension...
‣ Granting access to gitlab_user user...
Starting PostgreSQL 9.5...
LOG:  database system was shut down at 2016-11-25 13:48:31 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
ERROR:  column namespaces.deleted_at does not exist at character 115
STATEMENT:  SELECT  "projects".* FROM "projects" INNER JOIN "namespaces" ON "namespaces"."id" = "projects"."namespace_id" AND "namespaces"."deleted_at" IS NULL WHERE "projects"."pending_delete" = 'f' AND ((
                (namespaces.path = 'company'
              AND projects.path = 'project')
                OR (
                  LOWER(namespaces.path) = LOWER('company')
                  AND LOWER(projects.path) = LOWER('project')
                )
              ))  ORDER BY (CASE WHEN  namespaces.path = 'company' AND  projects.path = 'project' THEN 0 ELSE 1 END) LIMIT 1

I have tried restoring a backup to the new postgres server, but this gives the error:


ERROR:  must be owner of extension plpgsql
ERROR:  must be owner of schema public
ERROR:  schema "public" already exists
ALTER SCHEMA
ERROR:  must be owner of schema public
CREATE EXTENSION
ERROR:  must be owner of extension plpgsql

After Increasing the permissions for the gitlab_user this gives this error:

ERROR:  cannot drop schema public because other objects depend on it
DETAIL:  extension pg_trgm depends on schema public
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
ERROR:  schema "public" already exists

How do I fix this?

virtuman commented 7 years ago

gitlab-ctl db:migrate will fix it for you (most likely) or you can check status first: gitlab-ctl db:migrate:status

ThomBogers commented 7 years ago

That fixed it, thank you very much!

Took me some time to find how to run gitlab-ctl stuff, for other people with this issue this means running:

docker run --name gitlab -it --rm [OPTIONS] \
    sameersbn/gitlab:8.14.0 app:rake db:migrate