18

Currently, rake db:schema:load is run to setup the database on CircleCI. In migrating from using schema.rb to structure.sql, the command has been updated to: rake db:structure:load.

Unfortunately, it appears to hang and does not return:

$ bin/rake db:structure:load --trace
** Invoke db:structure:load (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:structure:load
WARNING: terminal is not fully functional

 set_config 
------------

(1 row)

(END)rake aborted!
Interrupt:
<STACK TRACE>
bin/rake:9:in `<main>'
Tasks: TOP => db:structure:load
Too long with no output (exceeded 10m0s)

Found someone else with the same issue on CircleCI, no answers though.

Kache
  • 15,647
  • 12
  • 51
  • 79

2 Answers2

26

This seems to have something to do with the psql client's output to the terminal expecting user input:

 set_config 
------------

(1 row)

(END)   <--- like from a terminal pager

Not exactly a proper solution, but a workaround in .circleci/config.yml:

jobs:
    build:
        docker:
          - image: MY_APP_IMAGE
            environment:
              PAGER: cat # prevent psql commands using less
Kache
  • 15,647
  • 12
  • 51
  • 79
3

Ran into something similar recently on CircleCI with Postgres 11.14.

Here is the thread about it there: https://discuss.circleci.com/t/postgres-failing-with-upgrading-from-11-6-to-11-14/42932/2

Basically needed to add to the Ruby environment section in the Circle CI config.yml:
PSQL_PAGER: ''

Thanks to @swrobel for the fix.

CanuckT
  • 321
  • 1
  • 3
  • 14