reconfigure issue on database

I've followed the download page instructions to the letter, but I'm getting an error. Debian 8 on OpenVZ

 * execute[create gitlab database user] action run

    ================================================================================
    Error executing action `run` on resource 'execute[create gitlab database user]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '2'
    ---- Begin output of /opt/gitlab/embedded/bin/psql --port 5432 -h /var/opt/gitlab/postgresql -d template1 -c "CREATE USER gitlab" ----
    STDOUT:
    STDERR: psql: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
    ---- End output of /opt/gitlab/embedded/bin/psql --port 5432 -h /var/opt/gitlab/postgresql -d template1 -c "CREATE USER gitlab" ----
    Ran /opt/gitlab/embedded/bin/psql --port 5432 -h /var/opt/gitlab/postgresql -d template1 -c "CREATE USER gitlab" returned 2

    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/postgresql.rb

    170:   execute "create #{sql_user} database user" do
    171:     command "#{bin_dir}/psql --port #{pg_port} -h #{postgresql_socket_dir} -d template1 -c \"CREATE USER #{sql_user}\""
    172:     user pg_user
    173:     not_if { !pg_helper.is_running? || pg_helper.user_exists?(sql_user) }
    174:   end
    175:

    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/postgresql.rb:170:in `block in from_file'

    execute("create gitlab database user") do
      action :run
      retries 0
      retry_delay 2
      default_guard_interpreter :execute
      command "/opt/gitlab/embedded/bin/psql --port 5432 -h /var/opt/gitlab/postgresql -d template1 -c \"CREATE USER gitlab\""
      backup 5
      returns 0
      user "gitlab-psql"
      declared_type :execute
      cookbook_name "gitlab"
      recipe_name "postgresql"
      not_if { #code block }
    end

Recipe: gitlab::gitlab-rails
  * execute[clear the gitlab-rails cache] action run
    - execute /opt/gitlab/bin/gitlab-rake cache:clear
Recipe: gitlab::database_migrations
  * 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-script20150813-13022-p23kkz" ----
    STDOUT: rake aborted!
    PG::ConnectionBad: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `initialize'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `new'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `connect'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/connection_adapters/postgresql_adapter.rb:568:in `initialize'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/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.11/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.11/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.11/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.11/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.11/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.11/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.11/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.11/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.11/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/connection_handling.rb:87:in `connection'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/migration.rb:916:in `initialize'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/migration.rb:814:in `new'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/migration.rb:814:in `up'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/lib/active_record/migration.rb:792:in `migrate'
    /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.1.11/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-script20150813-13022-p23kkz" ----
    Ran "bash"  "/tmp/chef-script20150813-13022-p23kkz" returned 1

    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/definitions/migrate_database.rb

     19:   bash "migrate #{params[:name]} database" do
     20:     code <<-EOH
     21:       set -e
     22:       log_file="/tmp/#{params[:name]}-db-migrate-$(date +%s)-$$/output.log"
     23:       umask 077
     24:       mkdir $(dirname ${log_file})
     25:       #{params[:command]} 2>& 1 | tee ${log_file}
     26:       exit ${PIPESTATUS[0]}
     27:     EOH
     28:     action params[:action]
     29:   end
     30: end

    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/definitions/migrate_database.rb:19:in `block in from_file'

    bash("migrate gitlab-rails database") do
      params {:command=>"/opt/gitlab/bin/gitlab-rake db:migrate", :action=>:nothing, :name=>"gitlab-rails"}
      action :nothing
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      command "migrate gitlab-rails database"
      backup 5
      returns 0
      code "      set -e\n      log_file=\"/tmp/gitlab-rails-db-migrate-$(date +%s)-$$/output.log\"\n      umask 077\n      mkdir $(dirname ${log_file})\n      /opt/gitlab/bin/gitlab-rake db:migrate 2>& 1 | tee ${log_file}\n      exit ${PIPESTATUS[0]}\n"
      interpreter "bash"
      declared_type :bash
      cookbook_name "gitlab"
      recipe_name "database_migrations"
    end