Jboss

Jboss 無法連接到 Apple Push Networks

  • June 20, 2018

我正在使用 Aerogear 統一推送伺服器將消息傳遞到推送網路。在我的設置中,消息已正確傳遞到 Android 網路,但無法在 Apple 中傳遞。從後端到推送網路的處理似乎仍然會發生錯誤。

我做了一些Google搜尋,它可能與netty上的某些東西有關,但我不確定。我已經包含了最相關的日誌:

[0m15:36:05,122 DEBUG [org.jboss.aerogear.unifiedpush.message.sender.apns.PushyApnsSender] (Thread-1 (ActiveMQ-client-global-threads-1186871307)) establishing the connection for ab358c33-ca7c-4b26-82d9-528f00a2f4c8
at io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator$FailureWrapper.wrapSslEngine(JdkAlpnApplicationProtocolNegotiator.java:113)
at io.netty.handler.ssl.SslContext.newHandler(SslContext.java:903)
at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:113)
at io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:105)
at io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:597)
at io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1387)
at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:419)
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:506)
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:478)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at com.turo.pushy.apns.ApnsClient$3.operationComplete(ApnsClient.java:395)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:507)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:420)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:104)
at io.netty.channel.AbstractChannel$AbstractUnsafe.doClose0(AbstractChannel.java:686)
at io.netty.channel.DefaultChannelPipeline$HeadContext.close(DefaultChannelPipeline.java:1276)
at io.netty.channel.AbstractChannelHandlerContext.invokeClose(AbstractChannelHandlerContext.java:624)
at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:117)
at io.netty.channel.AbstractChannelHandlerContext.close(AbstractChannelHandlerContext.java:465)
at io.netty.channel.DefaultChannelPipeline.access$000(DefaultChannelPipeline.java:44)
at io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1387)
at io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1122)
at io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:647)
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:506)
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:478)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403)

我了解到蘋果使用 https/2 到它的端點。我們用作部署基礎的來自 Alpine Linux 的映像預設情況下沒有支持 https/2 的必要庫。

以下 Dockerfile 安裝必要的基礎設施以在 Alpine 中擁有 https/2:

FROM alpine:edge

# For nghttp2-dev, we need this respository.
RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >>/etc/apk/repositories 

ENV CURL_VERSION 7.50.1

RUN apk add --update --no-cache openssl openssl-dev nghttp2-dev ca-certificates
RUN apk add --update --no-cache --virtual curldeps g++ make perl && \
   wget https://curl.haxx.se/download/curl-$CURL_VERSION.tar.bz2 && \
   tar xjvf curl-$CURL_VERSION.tar.bz2 && \
   rm curl-$CURL_VERSION.tar.bz2 && \
   cd curl-$CURL_VERSION && \
   ./configure \
       --with-nghttp2=/usr \
       --prefix=/usr \
       --with-ssl \
       --enable-ipv6 \
       --enable-unix-sockets \
       --without-libidn \
       --disable-static \
       --disable-ldap \
       --with-pic && \
   make && \
   make install && \
   cd / && \
   rm -r curl-$CURL_VERSION && \
   rm -r /var/cache/apk && \
   rm -r /usr/share/man && \
   apk del curldeps
CMD ["curl"]

Curl -v 應該報告 https/2 啟用為:

curl -s --http2 -I https://nghttp2.org
HTTP/2 200 

我發現這裡記錄了這個程序

引用自:https://serverfault.com/questions/916874