Chapter 6: 503 Error on vapor.cloud

I can successfully deploy the project to xxx.vapor.cloud and I can successfully use rested to call localhost:8080/api/acronyms, but when trying to do so on the xxx.vapor.cloud/api/acronyms I get the following back as a response header. Any suggestions? TIA

HTTP/1.1 503 Service Unavailable

Strict-Transport-Security: max-age=15724800;
Date: Thu, 30 Aug 2018 00:44:56 GMT
Content-Type: text/html
Connection: keep-alive
Content-Length: 206
Server: nginx

After doing a little digging here (thanks 0xtim!) I called vapor cloud logs.

Error: nil, dnsAAAAError: nil, connectionErrors: [NIO.SingleConnectionFailure(target: [IPv6]localhost:5432, error: connection reset (error set): Connection refused (errno: 111)), NIO.SingleConnectionFailure(target: [IPv4]localhost:5432, error: connection reset (error set): Connection refused (errno: 111))])): file /home/buildnode/jenkins/workspace/oss-swift-4.1-package-linux-ubuntu-16_04/swift/stdlib/public/core/ErrorType.swift, line 191
2018-08-30T00:55:18.895300222Z Current stack trace:
2018-08-30T00:55:18.918301592Z 5 libswiftCore.so 0x00007fe3e6d2afeb + 3702763
2018-08-30T00:55:18.918229639Z 0 libswiftCore.so 0x00007fe3e6d825c0 _swift_stdlib_reportFatalErrorInFile + 221
2018-08-30T00:55:18.918306538Z 6 libswiftCore.so 0x00007fe3e6af0ad6 + 1366742
2018-08-30T00:55:18.918254579Z 1 libswiftCore.so 0x00007fe3e6af13dc + 1369052
2018-08-30T00:55:18.918311253Z 7 libswiftCore.so 0x00007fe3e6c5df79 + 2862969
2018-08-30T00:55:18.918260612Z 2 libswiftCore.so 0x00007fe3e6d2b222 + 3703330
2018-08-30T00:55:18.918315923Z 8 libswiftCore.so 0x00007fe3e6b2e960 swift_errorInMain + 318
2018-08-30T00:55:18.918291391Z 3 libswiftCore.so 0x00007fe3e6d2c689 + 3708553
2018-08-30T00:55:18.918320662Z 9 Run 0x0000563958144821 + 4392993
2018-08-30T00:55:18.918296644Z 4 libswiftCore.so 0x00007fe3e6af0ad6 + 1366742
2018-08-30T00:55:18.918301592Z 5 libswiftCore.so 0x00007fe3e6d2afeb + 3702763
2018-08-30T00:55:18.918325488Z 10 libc.so.6 0x00007fe3e434c740 __libc_start_main + 240
2018-08-30T00:55:18.918306538Z 6 libswiftCore.so 0x00007fe3e6af0ad6 + 1366742
2018-08-30T00:55:18.918330152Z 11 Run 0x0000563957db9169 + 676201
2018-08-30T00:55:18.918311253Z 7 libswiftCore.so 0x00007fe3e6c5df79 + 2862969
2018-08-30T00:55:18.918315923Z 8 libswiftCore.so 0x00007fe3e6b2e960 swift_errorInMain + 318

@0xtim Can you please help with this when you get a chance? Thank you - much appreciated! :]

Apologies for the delay - did you manage to get this working?

The problem you encountered was because you were trying to connect to a Postgres DB on localhost, which won’t exist in Vapor Cloud. Make sure you configure your DB correctly for the cloud, e.g. https://github.com/raywenderlich/vapor-til/blob/master/Sources/App/configure.swift#L68