0

I've a Swift Vapor app which works fine locally. I've tested the endpoints with Postman.

When I try to deploy the app to Google Cloud, I get the following error.

ERROR: (gcloud.app.deploy) Error Response: [9] Application startup error: Fatal error: Error raised at top level:

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))])): file /home/buildnode/jenkins/workspace/oss-swift-5.0-package-linux-ubuntu-14_04/swift/stdlib/public/core/ErrorType.swift, line 200

I have no clue what I am missing. This is my dockerfile.

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

This is my app.yaml.

runtime: custom
env: flex

What am I missing here? Some google searches with just the error shows that Postgres might be missing. I am using FluentPostgreSQL in my app. In that case, how to install postgres in my container? or what else should I do?

imthath
  • 1,353
  • 1
  • 13
  • 35

1 Answers1

3

You’re specifying localhost for your Database connection or whatever it is you’re trying to connect to. It’s printed in the error message.

Andrew Edwards
  • 1,005
  • 1
  • 9
  • 24
  • Thanks. I had earlier mentioned host name as "localhost" in configure.swift file and now I removed it. but I am getting another error - ERROR: (gcloud.app.deploy) Error Response: [13] An internal error occurred during deployment. – imthath Jun 11 '19 at 18:01
  • No idea. I’d need more info about how you’re deploying and more logs – Andrew Edwards Jun 11 '19 at 19:08