我有一个Yesod应用程序,该应用程序正在Docker容器中部署到Heroku。该应用使用Amazon SES发送电子邮件。使用Yesod Devel在本地运行该应用程序时,此功能正常,但是在Heroku上的容器中,我会收到以下错误:
HttpExceptionRequest Request {
host = "email.eu-west-1.amazonaws.com"
port = 443
secure = True
requestHeaders = [("Content-Type","application/x-www-form-
urlencoded"),("Date","Wed, 20 Sep 2017 12:39:49 +0000"),("X-Amzn-
Authorization","AWS3-HTTPS AWSAccessKeyId=AKIAIBUN4ZEOKYKOB35A,
Algorithm=HmacSHA256,
Signature=xh3fi4EJOAe0LOZVCng5NRZIw2D+6P++0aO4Q5Dy0gw=")]
path = "/"
queryString = ""
method = "POST"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutDefault
requestVersion = HTTP/1.1
}
(ConnectionFailure Network.BSD.getProtocolByName: does not exist (no
such protocol name: tcp))
我认为我可能需要在容器中安装一些额外的软件包。这是Dockerfile:
FROM ubuntu:17.04
RUN apt-get update && apt-get install -y libpq-dev
WORKDIR /app
ADD . /app
EXPOSE 8080
ENV PGHOST localhost
CMD "./run"
感谢Michael Snoyman的提示,我发现netbase
是填充/etc/protocols
所需的包装。安装后,我发现了一个新的错误,抱怨Amazon SES的SSL证书来自未知的证书机构。
我安装了ca-certificates
软件包,这消失了。我还遇到了一个错误,告诉我没有安装libstdc++6
- 所以我安装了它。所有现在都在工作。
使用电子邮件auth和Amazon SES发送电子邮件的最终Dockerfile
如下("运行"命令是stack build
的汇编可执行的):
FROM ubuntu:17.04
RUN apt-get update && apt-get install -y libpq-dev libgnutls30 netbase libstdc++6 ca-certificates
WORKDIR /app
ADD . /app
EXPOSE 8080
ENV PGHOST localhost
CMD "./run"
hooray试验和错误:)