【问题标题】:Rails: rake db:structure:load times out on CircleCI 2.0Rails: rake db:structure:load 在 CircleCI 2.0 上超时
【发布时间】:2019-04-02 22:45:32
【问题描述】:

目前,rake db:schema:load 正在运行以在 CircleCI 上设置数据库。在从使用schema.rb 迁移到structure.sql 时,命令已更新为:rake db:structure:load

不幸的是,它似乎挂起并且没有返回:

$ 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,但没有答案。

【问题讨论】:

    标签: ruby-on-rails database postgresql circleci circleci-2.0


    【解决方案1】:

    这似乎与psql 客户端输出到期望用户输入的终端有关:

     set_config 
    ------------
    
    (1 row)
    
    (END)   <--- like from a terminal pager
    

    不完全是正确的解决方案,而是.circleci/config.yml 中的解决方法:

    jobs:
        build:
            docker:
              - image: MY_APP_IMAGE
                environment:
                  PAGER: cat # prevent psql commands using less
    

    【讨论】:

    • 一个类似的方法用 semaphoreci 为我解决了这个问题
    【解决方案2】:

    最近在 CircleCI 上使用 Postgres 11.14 遇到了类似的情况。

    这里是关于它的线程:https://discuss.circleci.com/t/postgres-failing-with-upgrading-from-11-6-to-11-14/42932/2

    基本需要添加到Circle CI config.yml中的Ruby环境部分:
    PSQL_PAGER: ''

    感谢@swrobel 的修复。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-08
      • 1970-01-01
      • 2017-09-08
      • 1970-01-01
      相关资源
      最近更新 更多