0

我有一个在本地运行良好的 Swift Vapor 应用程序。我已经用 Postman 测试了端点。

当我尝试将应用程序部署到 Google Cloud 时,我收到以下错误。

错误:(gcloud.app.deploy)错误响应:[9]应用程序启动错误:致命错误:在顶层引发错误:

NIO.ChannelError.connectFailed(NIO.NIOConnectionError(host: "localhost", port: 5432, dnsAError: nil, dnsAAAAError: nil, connectionErrors: [NIO.SingleConnectionFailure(target: [IPv6]localhost/::1:5432, error: connect(descriptor:addr:size:) failed: Cannot assign requested address (errno: 99)), NIO.SingleConnectionFailure(target: [IPv4]localhost/127.0.0.1:5432, error: connection reset (error set): Connection refused (errno: 111))])):文件 /home/buildnode/jenkins/workspace/oss-swift-5.0-package-linux-ubuntu-14_04/swift/stdlib/public/core/ErrorType.swift,第 200 行

我不知道我错过了什么。这是我的码头文件。

FROM ibmcom/swift-ubuntu:latest

LABEL Description="App (swift) running on Docker" Vendor="Imthath" Version="1.0"


# Expose default port for App Engine
EXPOSE 7070

# Add app source
ADD . /app
WORKDIR /app

# Build release
RUN swift build --configuration release

ENTRYPOINT .build/release/Run

这是我的 app.yaml。

runtime: custom
env: flex

我在这里想念什么?一些只有错误的谷歌搜索表明 Postgres 可能丢失。我在我的应用程序中使用 FluentPostgreSQL。在那种情况下,如何在我的容器中安装 postgres?或者我还应该做什么?

4

1 回答 1

3

您正在为您的数据库连接或您尝试连接的任何内容指定 localhost。它打印在错误消息中。

于 2019-06-11T17:42:24.960 回答