如何使用asadmin启动脚本将Let's Encrypt密钥/证书添加到Payara Micro

时间:2019-05-29 17:29:24

标签: docker payara payara-micro

我使用certbot独立服务器为我的设置成功生成了一个Let's Encrypt证书,但是现在我想将其移入payara微型容器中进行生产。 Payara Micro允许我将asadmin命令放在它可以运行的前置/后置脚本中。

首先,这是创建容器的docker命令:

docker run -p 8765:8090 \
           --mount type=bind,src=$(pwd)/deployments,dst=/opt/payara/deployments \
           --mount type=bind,src=$(pwd)/lib,dst=/opt/payara/lib \
           --mount type=bind,src=$(pwd)/cert,dst=/etc/letsencrypt/live/mydomain.com \
           --mount type=bind,src=$(pwd)/scripts,dst=/opt/payara/scripts \
           --env-file payara.env \
           --restart=always \
           payara/micro:5.191 \
           --prebootcommandfile /opt/payara/scripts/preboot.asadmin \
           --addlibs /opt/payara/lib \
           --deploy /opt/payara/deployments/MyApp.war \
           --sslport 8090 \
           --sslcert le_myapp \
           --contextroot ROOT

preboot.asadmin脚本只有一行:

add-pkcs8 --domain_name production --destalias "le_myapp" --priv-key-path /etc/letsencrypt/live/mydomain.com/private.pem --cert-chain-path /etc/letsencrypt/live/mydomain.com/fullchain.pem

当然,注册证书失败,并且日志未提供任何有关失败原因的有用信息。我应该注意,在letsencrypt.py script最近添加到Payara之后,我对asadmin命令进行了建模:

[2019-05-29T16:41:48.329+0000] [] [WARNING] [] [fish.payara.boot.runtime.BootCommand] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1559148108329] [levelValue: 900] Boot Command add-pkcs8 failed Exception while executing command. 

[2019-05-29T16:41:48.999+0000] [] [INFO] [] [fish.payara.boot.runtime.BootCommand] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1559148108999] [levelValue: 800] [[
  Boot Command set returned with result SUCCESS : PlainTextActionReporterSUCCESSDescription: set AdminCommandnull
    configs.config.server-config.network-config.network-listeners.network-listener.https-listener.port=8090
]]

[2019-05-29T16:41:49.042+0000] [] [INFO] [] [fish.payara.boot.runtime.BootCommand] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1559148109042] [levelValue: 800] [[
  Boot Command set returned with result SUCCESS : PlainTextActionReporterSUCCESSDescription: set AdminCommandnull
    configs.config.server-config.network-config.network-listeners.network-listener.https-listener.enabled=true
]]

[2019-05-29T16:41:49.114+0000] [] [INFO] [] [fish.payara.boot.runtime.BootCommand] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1559148109114] [levelValue: 800] [[
  Boot Command set returned with result SUCCESS : PlainTextActionReporterSUCCESSDescription: set AdminCommandnull
    configs.config.server-config.network-config.protocols.protocol.https-listener.ssl.cert-nickname=le_myapp
]]

0 个答案:

没有答案