'rake db:structure:load' is succeeding then timing out

I’m relatively new to CircleCI. Just setup my Docker Hub image which includes PG client. I’m trying to do some testing on a Rails App, and it’s getting stuck at

rake db:structure:load

What’s interesting, is that it does seem to succeed, but then times out. I get the output

set_config 
------------
 
(1 row)

(END)

which usually indicates that the structure load succeeds. But then it just hangs, and eventually times out with:

(END)rails aborted! Interrupt: /root/repo/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.2/lib/active_record/tasks/postgresql_database_tasks.rb:108:in `system' 
/root/repo/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.2/lib/active_record/tasks/postgresql_database_tasks.rb:108:in `run_cmd' 
/root/repo/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.2/lib/active_record/tasks/postgresql_database_tasks.rb:80:in `structure_load' 
/root/repo/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.2/lib/active_record/tasks/database_tasks.rb:223:in `structure_load' /root/repo/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.2/lib/active_record/tasks/database_tasks.rb:236:in `load_schema' 
/root/repo/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.2/lib/active_record/tasks/database_tasks.rb:255:in `block in load_schema_current' 
/root/repo/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.2/lib/active_record/tasks/database_tasks.rb:304:in `block in each_current_configuration' /root/repo/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.2/lib/active_record/tasks/database_tasks.rb:303:in `each' 
/root/repo/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.2/lib/active_record/tasks/database_tasks.rb:303:in `each_current_configuration' 
/root/repo/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.2/lib/active_record/tasks/database_tasks.rb:254:in `load_schema_current' 
/root/repo/vendor/bundle/ruby/2.2.0/gems/activerecord-5.1.2/lib/active_record/railties/databases.rake:290:in `block (3 levels) in <top (required)>' /root/repo/vendor/bundle/ruby/2.2.0/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:21:in `block in perform' 
/root/repo/vendor/bundle/ruby/2.2.0/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:18:in `perform' 
/root/repo/vendor/bundle/ruby/2.2.0/gems/railties-5.1.2/lib/rails/command.rb:46:in `invoke' /root/repo/vendor/bundle/ruby/2.2.0/gems/railties-5.1.2/lib/rails/commands.rb:16:in `<top (required)>' bin/rails:4:in `require' bin/rails:4:in `<main>' Tasks: TOP => db:structure:load (See full trace by running task with --trace) Too long with no output (exceeded 10m0s)

So it seems like it’s succeeding, then just hanging.

The previous rake db:create succeeds without problem.

Any ideas?

I also ran into this issue, I made a Stackoverflow post about it.

In short: seems to involve psql using a terminal pager for output and waiting for user input, and my current improper workaround in .circleci/config.yml is:

environment:
  PAGER: cat # prevent psql commands triggering pager

Awesome! Thanks for the workaround! Seems to be working now!