wildfly-extras / wildfly-cloud-galleon-pack

Galleon feature-pack for WildFly on the Cloud
Apache License 2.0
7 stars 2 forks source link

cloud-galleon-pack causes that javaOpts port config isn't working for wildfly:run/dev #41

Open martin-v opened 7 months ago

martin-v commented 7 months ago

Hi,

the following POM doesn't respect the javaOpts port config for wildfly:run or wildfly:dev. In case I remove the cloud-galleon-pack it works as expected (e.g. Admin console listening on :9993).

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.4.0</version>
                    <configuration>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <!--<version>4.2.2.Final</version>-->
                    <version>5.0.0.Beta3</version>
                    <configuration>
                        <version>31.0.0.Final</version>
                        <feature-packs>
                            <feature-pack>
                                <location>org.wildfly:wildfly-galleon-pack:31.0.0.Final</location>
                            </feature-pack>
                            <feature-pack>
                                <location>org.wildfly.cloud:wildfly-cloud-galleon-pack:6.0.0.Final</location>
                            </feature-pack>
                        </feature-packs>
                        <javaOpts>
                            <javaOpt>-Djboss.socket.binding.port-offset=3</javaOpt>
                        </javaOpts>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

(Ignore the "The server did not start within 60 seconds." this is caused by https://issues.redhat.com/browse/WFMP-244)

jfdenise commented 7 months ago

@martin-v , when using the cloud feature-pack, the server configuration is updated differently than on bare-metal. The environment variable PORT_OFFSET (https://github.com/wildfly/wildfly-cekit-modules/blob/main/jboss/container/wildfly/launch/port-offset/module.yaml) is to be used in order to set a port offset. The server shutdown in a cloud environment retrieves the offset thanks to this env variable (https://github.com/wildfly/wildfly-cekit-modules/blob/main/jboss/container/wildfly/run/bash/artifacts/opt/jboss/container/wildfly/run/run-utils.sh#L36).

martin-v commented 7 months ago

@jfdenise Thanks for the reply! Can you show me an example configuration with the correct configuration? Didn't find anything and my guess, didn't work.

  <env>
      <PORT_OFFSET>3</PORT_OFFSET>
  </env>

Use case is I have different services and want to run/debug them in parallel.

jfdenise commented 7 months ago

I don't think actually that you will manage to run the server with a PORT_OFFSET. The cloud server is dedicated to run inside WildFly runtime docker image. The problem is that run goal calls bin/standalone.sh although to have the PORT_OFFSET to be taken into account, the launcher: bin/openshift-launch.sh needs to be called. I suggest that you don't build a cloud server when launching the server using the run goal.

jfdenise commented 7 months ago

@martin-v , I think that we could make a small change in order to have the standalone.sh be usable with PORT_OFFSET. I will use this issue to track progress.