如何在CircleCI 2.0上设置Postgres角色

时间:2017-12-01 20:19:53

标签: postgresql circleci

我按照这里的指示: https://circleci.com/docs/2.0/postgres-config/

我的相关Circle配置如下所示:

<div class="container body-content">
    @Html.Partial("_ShoppingCart.cshtml")
    @RenderBody()
</div>

但是当我尝试连接test: docker: - image: circleci/node:6.11.0 - image: circleci/mongo:3.2.13 - image: circleci/postgres:9.5 environment: - POSTGRES_USER=custom - POSTGRES_PASSWORD=password - POSTGRES_DB=custom - image: rabbitmq:3.5.4 steps: etc etc... 上的nodejs应用时出现以下错误:

localhost:5432

如果我已定义error: error during connection: SequelizeConnectionError: FATAL: role "ubuntu" does not exist,为什么甚至尝试使用“ubuntu”?

如果我删除环境变量,这不起作用。我不明白为什么这不起作用,因为根据文档它应默认为ubuntu。

1 个答案:

答案 0 :(得分:0)

您的配置文件看起来不太合适。这就是通常的格式。

version: 2.0
jobs:
  build:
  docker:
    - image: circleci/node:6.11.0
    - image: circleci/postgres:9.5
      environment:
      - POSTGRES_USER=custom_user
      - POSTGRES_PASSWORD=custom_password
      - POSTGRES_DB=custom_db

  working_directory: ~/your_project_dir

  steps:
   - 
   -
   ..

在此之后,检查db-user,密码和数据库名称是否与上面环境块中提到的名称相同。您可能需要在代码和.env文件中仔细检查您的值。

jdbc:postgresql://localhost/custom_db?user=custom_user&password=custom_pass

如果你正在使用ruby或node,你可能需要设置ruby-env的节点变量。

相关问题