Upgrade db migration error from gitlab-ce 7.10.1 to 7.10.4

When trying to upgrade from gitlab-ce 7.10.1 to 7.10.4 during the db migration I get:
role “git” does not exist
Running on ubuntu-trusty. I can roll back to 7.10.1. Here is the output during the upgrade:

sudo apt-get install gitlab-ce=7.10.4~omnibus-1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  gitlab-ce
1 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B/311 MB of archives.
After this operation, 9,216 B of additional disk space will be used.
(Reading database ... 131138 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_7.10.4~omnibus-1_amd64.deb ...
gitlab preinstall: Backing up GitLab SQL database (excluding Git repositories, uploads)
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
[SKIPPED]
Dumping uploads ...
[SKIPPED]
Creating backup archive: 1471879488_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
Deleting old backups ... skipping
Unpacking gitlab-ce (7.10.4~omnibus-1) over (7.10.1~omnibus.2-1) ...
dpkg: warning: unable to delete old directory '/opt/gitlab/embedded/logs': Directory not empty
Setting up gitlab-ce (7.10.4~omnibus-1) ...
gitlab: Thank you for installing GitLab!
gitlab: Configure and start GitLab by running the following command:
gitlab:
gitlab: sudo gitlab-ctl reconfigure
gitlab:
gitlab: GitLab should be reachable at http://reactorgitlab
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab:
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab:
Shutting down all GitLab services except those needed for migrations
ok: down: logrotate: 1s, normally up
ok: down: nginx: 0s, normally up
ok: down: postgresql: 0s, normally up
ok: down: redis: 0s, normally up
ok: down: sidekiq: 0s, normally up
ok: down: unicorn: 0s, normally up
ok: run: postgresql: (pid 22740) 1s
ok: run: redis: (pid 22748) 0s
run: postgresql: (pid 22740) 1s; run: log: (pid 14310) 1104678s
run: redis: (pid 22748) 0s; run: log: (pid 14258) 1104684s
Reconfiguring GitLab to apply migrations
Starting Chef Client, version 11.18.0
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
  - gitlab
  - runit
Compiling Cookbooks...
Recipe: gitlab::default
  * directory[/etc/gitlab] action create (up to date)
[2016-08-22T11:26:10-04:00] WARN: Cloning resource attributes for directory[/var/opt/gitlab] from prior resource (CHEF-3694)
[2016-08-22T11:26:10-04:00] WARN: Previous directory[/var/opt/gitlab]: /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:40:in `from_file'
[2016-08-22T11:26:10-04:00] WARN: Current  directory[/var/opt/gitlab]: /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/users.rb:23:in `from_file'
[2016-08-22T11:26:12-04:00] WARN: Cloning resource attributes for directory[/var/opt/gitlab/gitlab-rails/etc] from prior resource (CHEF-3694)
[2016-08-22T11:26:12-04:00] WARN: Previous directory[/var/opt/gitlab/gitlab-rails/etc]: /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/gitlab-rails.rb:43:in `block in from_file'
[2016-08-22T11:26:12-04:00] WARN: Current  directory[/var/opt/gitlab/gitlab-rails/etc]: /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/definitions/unicorn_config.rb:21:in `block in from_file'
[2016-08-22T11:26:12-04:00] WARN: Cloning resource attributes for service[unicorn] from prior resource (CHEF-3694)
[2016-08-22T11:26:12-04:00] WARN: Previous service[unicorn]: /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:78:in `block in from_file'
[2016-08-22T11:26:12-04:00] WARN: Current  service[unicorn]: /opt/gitlab/embedded/cookbooks/cache/cookbooks/runit/definitions/runit_service.rb:191:in `block in from_file'
[2016-08-22T11:26:12-04:00] WARN: Cloning resource attributes for service[sidekiq] from prior resource (CHEF-3694)
[2016-08-22T11:26:12-04:00] WARN: Previous service[sidekiq]: /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb:78:in `block in from_file'
[2016-08-22T11:26:12-04:00] WARN: Current  service[sidekiq]: /opt/gitlab/embedded/cookbooks/cache/cookbooks/runit/definitions/runit_service.rb:191:in `block in from_file'
  Converging 192 resources
  * directory[/etc/gitlab] action nothing (skipped due to action :nothing)
  * directory[/var/opt/gitlab] action create (up to date)
  * directory[/opt/gitlab/embedded/etc] action create (up to date)
  * template[/opt/gitlab/embedded/etc/gitconfig] action create (up to date)
Recipe: gitlab::users
  * directory[/var/opt/gitlab] action create (up to date)
  * group[git] action create (up to date)
  * user[git] action create (up to date)
  * template[/var/opt/gitlab/.gitconfig] action create (up to date)
Recipe: gitlab::web-server
  * group[gitlab-www] action create (up to date)
  * user[gitlab-www] action create (up to date)
Recipe: gitlab::gitlab-shell
  * directory[/var/opt/gitlab/git-data/repositories] action create (up to date)
  * directory[/var/opt/gitlab/.ssh] action create (up to date)
  * file[/var/opt/gitlab/.ssh/authorized_keys] action create (up to date)
  * file[/opt/gitlab/embedded/service/gitlab-shell/authorized_keys.lock] action create (up to date)
  * execute[chcon --recursive --type ssh_home_t /var/opt/gitlab/.ssh] action run (skipped due to only_if)
  * directory[/var/log/gitlab/gitlab-shell/] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-shell] action create (up to date)
  * directory[/var/opt/gitlab/git-data] action create (up to date)
  * template[/var/opt/gitlab/gitlab-shell/config.yml] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-shell/config.yml] action create (up to date)
  * template[/var/opt/gitlab/gitlab-shell/gitlab_shell_secret] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-shell/.gitlab_shell_secret] action create (up to date)
Recipe: gitlab::gitlab-rails
  * directory[/var/opt/gitlab/gitlab-rails/etc] action create (up to date)
  * directory[/opt/gitlab/etc/gitlab-rails] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-rails/working] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-rails/tmp] action create (up to date)
  * directory[/var/opt/gitlab/backups] action create (up to date)
  * directory[/var/log/gitlab/gitlab-rails] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-rails] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-rails/uploads] action create (up to date)
  * template[/opt/gitlab/etc/gitlab-rails/gitlab-rails-rc] action create (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/secret] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/.secret] action create (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/database.yml] action create
    - update content in file /var/opt/gitlab/gitlab-rails/etc/database.yml from 8f2ee9 to d67e45
    --- /var/opt/gitlab/gitlab-rails/etc/database.yml   2016-08-22 11:07:56.361229926 -0400
    +++ /tmp/chef-rendered-template20160822-22757-l6o4wt        2016-08-22 11:26:13.465282240 -0400
    @@ -7,7 +7,7 @@
       encoding: unicode
       database: gitlabhq_production
       pool: 10
    -  username: 'gitlab'
    +  username: 'git'
       password: 'xxxxxxxxxxxx'
       host:
       port: 5432
  * link[/opt/gitlab/embedded/service/gitlab-rails/config/database.yml] action create (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/resque.yml] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/config/resque.yml] action create (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/aws.yml] action delete (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/config/aws.yml] action delete (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/smtp_settings.rb] action delete (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/config/initializers/smtp_settings.rb] action delete (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/gitlab.yml] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml] action create (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/rack_attack.rb] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/config/initializers/rack_attack.rb] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/.gitlab_shell_secret] action create
    - unlink existing file at /opt/gitlab/embedded/service/gitlab-rails/.gitlab_shell_secret
    - create symlink at /opt/gitlab/embedded/service/gitlab-rails/.gitlab_shell_secret to /var/opt/gitlab/gitlab-shell/gitlab_shell_secret
  * directory[/var/opt/gitlab/git-data/gitlab-satellites] action create (up to date)
  * directory[/opt/gitlab/etc/gitlab-rails/env] action create (up to date)
  * file[/opt/gitlab/etc/gitlab-rails/env/HOME] action create (up to date)
  * file[/opt/gitlab/etc/gitlab-rails/env/RAILS_ENV] action create (up to date)
  * file[/opt/gitlab/etc/gitlab-rails/env/SIDEKIQ_MEMORY_KILLER_MAX_RSS] action create (up to date)
  * file[/opt/gitlab/etc/gitlab-rails/env/BUNDLE_GEMFILE] action create (up to date)
  * file[/opt/gitlab/etc/gitlab-rails/env/PATH] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/tmp] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/public/uploads] action create (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-rails/log] action create (up to date)
  * link[/var/log/gitlab/gitlab-rails/sidekiq.log] action create (skipped due to not_if)
  * file[/opt/gitlab/embedded/service/gitlab-rails/db/schema.rb] action create
    - change owner from 'root' to 'git'
  * remote_file[/var/opt/gitlab/gitlab-rails/VERSION] action create
    - update content in file /var/opt/gitlab/gitlab-rails/VERSION from 10be26 to 8b0e46
    --- /var/opt/gitlab/gitlab-rails/VERSION    2016-08-22 11:07:56.485229932 -0400
    +++ /tmp/.VERSION20160822-22757-14iosy7     2016-08-22 11:26:13.621282247 -0400
    @@ -1,2 +1,2 @@
    -7.10.1
    +7.10.4
  * execute[chown -R root:root /opt/gitlab/embedded/service/gitlab-rails/public] action run
    - execute chown -R root:root /opt/gitlab/embedded/service/gitlab-rails/public
  * execute[clear the gitlab-rails cache] action nothing (skipped due to action :nothing)
Recipe: gitlab::cron
  * cron[gitlab-ci schedule builds] action delete (up to date)
Recipe: gitlab::default
  * service[unicorn] action nothing (up to date)
  * service[ci-unicorn] action nothing (up to date)
  * service[sidekiq] action nothing (up to date)
  * service[ci-sidekiq] action nothing (up to date)
Recipe: runit::upstart
  * cookbook_file[/etc/init/gitlab-runsvdir.conf] action create (up to date)
  * execute[initctl status gitlab-runsvdir] action run
    - execute initctl status gitlab-runsvdir
  * execute[initctl start gitlab-runsvdir] action run (skipped due to only_if)
Recipe: gitlab::redis
  * group[gitlab-redis] action create (up to date)
  * user[gitlab-redis] action create (up to date)
  * directory[/var/opt/gitlab/redis] action create (up to date)
  * directory[/var/log/gitlab/redis] action create (up to date)
  * template[/var/opt/gitlab/redis/redis.conf] action create (up to date)
  * directory[/opt/gitlab/sv/redis] action create (up to date)
  * directory[/opt/gitlab/sv/redis/log] action create (up to date)
  * directory[/opt/gitlab/sv/redis/log/main] action create (up to date)
  * template[/opt/gitlab/sv/redis/run] action create (up to date)
  * template[/opt/gitlab/sv/redis/log/run] action create (up to date)
  * template[/var/log/gitlab/redis/config] action create (up to date)
  * ruby_block[reload redis svlogd configuration] action nothing (skipped due to action :nothing)
  * file[/opt/gitlab/sv/redis/down] action delete (up to date)
  * link[/opt/gitlab/init/redis] action create (up to date)
  * link[/opt/gitlab/service/redis] action create (up to date)
  * ruby_block[supervise_redis_sleep] action run (skipped due to not_if)
  * service[redis] action nothing (skipped due to action :nothing)
Recipe: gitlab::ci-redis_disable
  * link[/opt/gitlab/service/ci-redis] action delete (up to date)
Recipe: gitlab::postgresql
  * group[gitlab-psql] action create (up to date)
  * user[gitlab-psql] action create (up to date)
  * directory[/var/opt/gitlab/postgresql] action create (up to date)
  * directory[/var/opt/gitlab/postgresql/data] action create (up to date)
  * directory[/var/log/gitlab/postgresql] action create (up to date)
  * link[/var/opt/gitlab/postgresql/data] action create (skipped due to not_if)
  * file[/var/opt/gitlab/postgresql/.profile] action create (up to date)
  * service[procps] action nothing (skipped due to action :nothing)
  * template[/etc/sysctl.d/90-postgresql.conf] action create (up to date)
  * execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] action run (skipped due to not_if)
  * template[/var/opt/gitlab/postgresql/data/postgresql.conf] action create (up to date)
  * template[/var/opt/gitlab/postgresql/data/pg_hba.conf] action create (up to date)
  * template[/var/opt/gitlab/postgresql/data/pg_ident.conf] action create (up to date)
  * directory[/opt/gitlab/sv/postgresql] action create (up to date)
  * directory[/opt/gitlab/sv/postgresql/log] action create (up to date)
  * directory[/opt/gitlab/sv/postgresql/log/main] action create (up to date)
  * template[/opt/gitlab/sv/postgresql/run] action create (up to date)
  * template[/opt/gitlab/sv/postgresql/log/run] action create (up to date)
  * template[/var/log/gitlab/postgresql/config] action create (up to date)
  * ruby_block[reload postgresql svlogd configuration] action nothing (skipped due to action :nothing)
  * file[/opt/gitlab/sv/postgresql/down] action delete (up to date)
  * directory[/opt/gitlab/sv/postgresql/control] action create (up to date)
  * template[/opt/gitlab/sv/postgresql/control/t] action create (up to date)
  * link[/opt/gitlab/init/postgresql] action create (up to date)
  * link[/opt/gitlab/service/postgresql] action create (up to date)
  * ruby_block[supervise_postgresql_sleep] action run (skipped due to not_if)
  * service[postgresql] action nothing (skipped due to action :nothing)
  * execute[create gitlab database user] action run (skipped due to not_if)
  * execute[create gitlabhq_production database] action run (skipped due to not_if)
Recipe: gitlab::unicorn
  * directory[/var/log/gitlab/unicorn] action create (up to date)
  * directory[/opt/gitlab/var/unicorn] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-rails/sockets] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-rails/etc] action create (up to date)
  * template[/var/opt/gitlab/gitlab-rails/etc/unicorn.rb] action create (up to date)
  * directory[/opt/gitlab/sv/unicorn] action create (up to date)
  * directory[/opt/gitlab/sv/unicorn/log] action create (up to date)
  * directory[/opt/gitlab/sv/unicorn/log/main] action create (up to date)
  * template[/opt/gitlab/sv/unicorn/run] action create (up to date)
  * template[/opt/gitlab/sv/unicorn/log/run] action create (up to date)
  * template[/var/log/gitlab/unicorn/config] action create (up to date)
  * ruby_block[reload unicorn svlogd configuration] action nothing (skipped due to action :nothing)
  * file[/opt/gitlab/sv/unicorn/down] action delete (up to date)
  * link[/opt/gitlab/init/unicorn] action create (up to date)
  * link[/opt/gitlab/service/unicorn] action create (up to date)
  * ruby_block[supervise_unicorn_sleep] action run (skipped due to not_if)
  * service[unicorn] action nothing (skipped due to action :nothing)
Recipe: gitlab::ci-unicorn_disable
  * link[/opt/gitlab/service/ci-unicorn] action delete (up to date)
Recipe: gitlab::sidekiq
  * directory[/var/log/gitlab/sidekiq] action create (up to date)
  * directory[/opt/gitlab/sv/sidekiq] action create (up to date)
  * directory[/opt/gitlab/sv/sidekiq/log] action create (up to date)
  * directory[/opt/gitlab/sv/sidekiq/log/main] action create (up to date)
  * template[/opt/gitlab/sv/sidekiq/run] action create (up to date)
  * template[/opt/gitlab/sv/sidekiq/log/run] action create (up to date)
  * template[/var/log/gitlab/sidekiq/config] action create (up to date)
  * ruby_block[reload sidekiq svlogd configuration] action nothing (skipped due to action :nothing)
  * file[/opt/gitlab/sv/sidekiq/down] action delete (up to date)
  * link[/opt/gitlab/init/sidekiq] action create (up to date)
  * link[/opt/gitlab/service/sidekiq] action create (up to date)
  * ruby_block[supervise_sidekiq_sleep] action run (skipped due to not_if)
  * service[sidekiq] action nothing (skipped due to action :nothing)
Recipe: gitlab::ci-sidekiq_disable
  * link[/opt/gitlab/service/ci-sidekiq] action delete (up to date)
Recipe: gitlab::nginx
  * directory[/var/opt/gitlab/nginx] action create (up to date)
  * directory[/var/opt/gitlab/nginx/conf] action create (up to date)
  * directory[/var/log/gitlab/nginx] action create (up to date)
  * link[/var/opt/gitlab/nginx/logs] action create (up to date)
  * template[/var/opt/gitlab/nginx/conf/gitlab-http.conf] action create (up to date)
  * template[/var/opt/gitlab/nginx/conf/nginx.conf] action create (up to date)
  * directory[/opt/gitlab/sv/nginx] action create (up to date)
  * directory[/opt/gitlab/sv/nginx/log] action create (up to date)
  * directory[/opt/gitlab/sv/nginx/log/main] action create (up to date)
  * template[/opt/gitlab/sv/nginx/run] action create (up to date)
  * template[/opt/gitlab/sv/nginx/log/run] action create (up to date)
  * template[/var/log/gitlab/nginx/config] action create (up to date)
  * ruby_block[reload nginx svlogd configuration] action nothing (skipped due to action :nothing)
  * file[/opt/gitlab/sv/nginx/down] action delete (up to date)
  * link[/opt/gitlab/init/nginx] action create (up to date)
  * link[/opt/gitlab/service/nginx] action create (up to date)
  * ruby_block[supervise_nginx_sleep] action run (skipped due to not_if)
  * service[nginx] action nothing (skipped due to action :nothing)
Recipe: gitlab::remote-syslog_disable
  * link[/opt/gitlab/service/remote-syslog] action delete (up to date)
Recipe: gitlab::logrotate
  * directory[/var/opt/gitlab/logrotate] action create (up to date)
  * directory[/var/opt/gitlab/logrotate/logrotate.d] action create (up to date)
  * directory[/var/log/gitlab/logrotate] action create (up to date)
  * template[/var/opt/gitlab/logrotate/logrotate.conf] action create (up to date)
  * template[/var/opt/gitlab/logrotate/logrotate.d/nginx] action create (up to date)
  * template[/var/opt/gitlab/logrotate/logrotate.d/unicorn] action create (up to date)
  * template[/var/opt/gitlab/logrotate/logrotate.d/gitlab-rails] action create (up to date)
  * template[/var/opt/gitlab/logrotate/logrotate.d/gitlab-shell] action create (up to date)
  * template[/var/opt/gitlab/logrotate/logrotate.d/gitlab-ci] action create (up to date)
  * directory[/opt/gitlab/sv/logrotate] action create (up to date)
  * directory[/opt/gitlab/sv/logrotate/log] action create (up to date)
  * directory[/opt/gitlab/sv/logrotate/log/main] action create (up to date)
  * template[/opt/gitlab/sv/logrotate/run] action create (up to date)
  * template[/opt/gitlab/sv/logrotate/log/run] action create (up to date)
  * template[/var/log/gitlab/logrotate/config] action create (up to date)
  * ruby_block[reload logrotate svlogd configuration] action nothing (skipped due to action :nothing)
  * file[/opt/gitlab/sv/logrotate/down] action delete (up to date)
  * link[/opt/gitlab/init/logrotate] action create (up to date)
  * link[/opt/gitlab/service/logrotate] action create (up to date)
  * ruby_block[supervise_logrotate_sleep] action run (skipped due to not_if)
  * service[logrotate] action nothing (skipped due to action :nothing)
Recipe: gitlab::database_migrations
  * execute[initialize gitlab-rails database] action nothing (skipped due to action :nothing)
  * execute[initialize gitlab-ci database] action nothing (skipped due to action :nothing)
  * bash[migrate gitlab-rails database] action nothing (skipped due to action :nothing)
  * bash[migrate gitlab-ci database] action nothing (skipped due to action :nothing)
  * bash[migrate gitlab-rails database] action run

    ================================================================================
    Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of "bash"  "/tmp/chef-script20160822-22757-nln8bu" ----
    STDOUT: rake aborted!
    ActiveRecord::NoDatabaseError: FATAL:  role "git" does not exist
    Run `$ bin/rake db:create db:migrate` to create your database
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:898:in `rescue in connect'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `connect'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:568:in `initialize'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:435:in `new_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:445:in `checkout_new_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `acquire_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:351:in `block in checkout'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:350:in `checkout'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_handling.rb:87:in `connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/migration.rb:916:in `initialize'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/migration.rb:814:in `new'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/migration.rb:814:in `up'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/migration.rb:792:in `migrate'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
    PG::Error: FATAL:  role "git" does not exist
    Run `$ bin/rake db:create db:migrate` to create your database
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `initialize'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `new'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `connect'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:568:in `initialize'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:435:in `new_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:445:in `checkout_new_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `acquire_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:351:in `block in checkout'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:350:in `checkout'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/connection_handling.rb:87:in `connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/migration.rb:916:in `initialize'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/migration.rb:814:in `new'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/migration.rb:814:in `up'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/migration.rb:792:in `migrate'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.9/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
    Tasks: TOP => db:migrate
    (See full trace by running task with --trace)
    STDERR:
    ---- End output of "bash"  "/tmp/chef-script20160822-22757-nln8bu" ----
    Ran "bash"  "/tmp/chef-script20160822-22757-nln8bu" returned 1

(output truncated)

Hi

As per the gitlab change log, I see the migrations have been broken in 7.10.2 which they have fixed in 7.10.4.

v 7.10.4

  • Fix migrations broken in 7.10.2
  • Make tags for GitLab installations running on MySQL case sensitive
  • Get Gitorious importer to work again.
  • Fix adding new group members from admin area
  • Fix DB error when trying to tag a repository (Stan Hu)
  • Fix Error 500 when searching Wiki pages (Stan Hu)
  • Unescape branch names in compare commit (Stan Hu)
  • Order commit comments chronologically in API.

You can try upgrading with a higher version which will not have migration issues (eg: 8.0.0 etc)

OK, I found the problem. I installed 8.0.0 over 7.10.1 and had the same error. I then looked at the PostgreSQL database using:

# sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production

I noticed that gitlabhq_production was owned by role gitlab. In my 7.10.1 database it was owned by role git which was specified in gitlab.rb:

gitlab_rails['db_username']='git'

I removed the above line from gitlab.rb and then ran:

# gitlab-ctl reconfigure
# gitlab-rake db:migrate
# gitlab-ctl restart

Now Gitlab works!

1 Like