我有一个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"
答案 0 :(得分:4)
感谢Michael Snoyman的提示,我发现netbase
是填充/etc/protocols
所需的包。安装完成后,我收到一条新错误,抱怨说Amazon SES的SSL证书来自未知的证书颁发机构。
我安装了ca-certificates
软件包,这就消失了。我还遇到一个错误,告诉我libstdc++6
没有安装 - 所以我安装了它。一切正常。
与Yesod合作的最终Dockerfile
,使用电子邮件身份验证和Amazon SES发送电子邮件,如下所示(“运行”命令是来自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的反复试验:)