将PostgreSQL依赖关系变量添加到停靠文件Backstage

b5lpy0ml  于 2022-11-04  发布在  PostgreSQL
关注(0)|答案(2)|浏览(109)

我正在尝试通过Backstage创建一个Docker映像并使用Heroku进行部署。Backstage中的默认数据库是SQLlite3,但我在Heroku中使用的是PostgreSQL。我是否应该在应用程序创建过程中使用Backstage创建的DOCKERFILE中的任何PostgreSQL依赖项?enter image description here

dxpyg8gm

dxpyg8gm1#

您不需要安装postgres依赖项,只需在app-config. yaml中正确配置Postgres即可。

quhf5bfb

quhf5bfb2#

您是否曾访问过此文档?
简而言之:
1.您需要将postgresql安装为后端的依赖项:

yarn add --cwd packages/backend pg

1.执行app-config.yaml中的设置

backend:
  database:
-    client: better-sqlite3
-    connection: ':memory:'
+    # config options: https://node-postgres.com/api/client
+    client: pg
+    connection:
+      host: ${POSTGRES_HOST}
+      port: ${POSTGRES_PORT}
+      user: ${POSTGRES_USER}
+      password: ${POSTGRES_PASSWORD}
+      # https://node-postgres.com/features/ssl
+      # you can set the sslmode configuration option via the `PGSSLMODE` environment variable
+      # see https://www.postgresql.org/docs/current/libpq-ssl.html Table 33.1. SSL Mode Descriptions (e.g. require)
+      # ssl:
+      #   ca: # if you have a CA file and want to verify it you can uncomment this section
+      #     $file: <file-path>/ca/server.crt
``

相关问题