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?