dockerssldocker-composehttpspayara-micro

Enabling payara-micro SSL through docker-compose


I'm trying to enable some security to a payara-micro instance. I'm running a standard payara-micro image through docker-compose, passing a war file (which is well deployed):

  version: '2.2'
  services:
    payara_micro_service:
      restart: always
      image: "payara/micro:5.2022.2-jdk11"
      ports:
        - "8080:8080"
      volumes:
        - ./deployments:/opt/payara/deployments
        - ./resources:/resources

Now, according to the documentation, the way to activate SSL in payara-micro is through system properties or command-line (payaramicro.sslPort or --sslport).

As far as I know you can only inject environment variable to the service. I tried anyway to set

environment:
  payaramicro.sslPort: 8181

But without success:

{
    "Instance Configuration": {
        "Host": "adba96fca46a",
        "Http Port(s)": "8080",
        "Https Port(s)": "",
        "Instance Name": "Pleasant-Paddlefish",
        "Instance Group": "MicroShoal",
        "Hazelcast Member UUID": "435b3b12-9c4f-4f4c-8303-abe226125e4c",
        "Deployed": [
            {
                "Name": "my-service",
                "Type": "war",
                "Context Root": "/my-service"
            }
        ]
    }
}]]

So, sadly, no http port set.

Any idea on how I can configure ssl through docker-compose?

Regards,

B


Solution

  • Ok I found a way:

    environment:
      JVM_ARGS: "-Dpayaramicro.sslPort=8181"
    

    Resulting in:

    {
        "Instance Configuration": {
            "Host": "7358c95d4284",
            "Http Port(s)": "8080",
            "Https Port(s)": "8181",
            "Instance Name": "Tender-Ziege",
            "Instance Group": "MicroShoal",
            "Hazelcast Member UUID": "92118ba1-aa5f-43e0-ae04-34ab0dcf9da5",
            "Deployed": [
                {
                    "Name": "my-service",
                    "Type": "war",
                    "Context Root": "/my-service"
                }
            ]
        }
    }]]
    

    After reading again the documentation more carefully, all the system properties listed can be set using environment variables (you will have to replace the dots by underscores):

    environment:
      payaramicro_sslPort: 8181
    

    Remember this is case sensitive.