0 Replies Latest reply on Mar 3, 2017 11:57 AM by E Francis

    6.4 EAP - How to deploy multiple artifacts into Docker container via IntelliJ JBoss plugin

    E Francis Newbie



      I'm in the process of moving a complicated JBoss 6.4 EAP dev environment into a Docker container and I need some help getting IntelliJ to successfully deploy the application into the container. This is a pretty specific problem, so I'm hoping someone who has worked on or has experience with the IntelliJ JBoss plugin's Docker volume support can help me out!


      TLDR: I need to deploy multiple artifacts that live in different target/ folders into a JBoss instance inside a Docker container via a shared Docker volume, so that the source code can live on the host but be deployed into the container.



      The current, working dev environment not inside a Docker container


      The project consists of multiple "sub projects" that have their own artifacts that all work together, with the standalone.xml using the exploded artifacts for hot swapping like this:


           <deployment name="subproject-A" runtime-name="subproject-A.war">
                  <fs-exploded path="/Users/me/project-name/subproject-A/target/subproject-A"/>

            <deployment name="subproject-B" runtime-name="subproject-B.war">
                  <fs-exploded path="/Users/me/project-name/subproject-B/target/subproject-B"/>

            <deployment name="subproject-C" runtime-name="subproject-C.war">
                  <fs-exploded path="/Users/me/project-name/subproject-C/target/subproject-C"/>




      The end goal, with the environment in the Docker container

      • [WORKING] mount a volume into the Docker container, to share the source code from "~/devel/project-name/" on my host machine to the same path in the container
      • [WORKING] add a user to the JBoss ManagementRealm and use the IntelliJ JBoss plugin to connect to it remotely over the http interface on port 9999
      • [NOT WORKING] use the IntelliJ JBoss plugin to deploy into the Docker container via a Docker volume


      The problems

      1. The IntelliJ JBoss plugin does support a "Remote staging" type of "Local or mounted folder" with a "Docker Volume" Host type. Sounds like just what I need! But it provides a "Path from root" and "Mapped as" that only lets you provide one mapped path (see the screenshot of the IntelliJ deploy config below to see that mapping config). Unfortunately for me, I have multiple artifacts being deployed that have different "target" folders which doesn't work well when I can only map one folder. So if I set up the IntelliJ deploy config to map the "subproject-A" artifact's "target/" folder from host to container correctly, that "subproject-A" artifact will deploy successfully into "project-name/subproject-A/target/subproject-A", but all the other artifacts will fail with an error because they're looking for something like "project-name/subprojectA/target/subproject-C" which obviously isn't right.

        I "solved" this (it doesn't feel like a good solution) by creating a folder called "project-name/all-targets/" which just contains symlinks to the respective artifact "target" folders. So "ls -l project-name/all-targets" looks like this

          lrwxrwxrwx 1 user user 103 Feb  3 22:27 subproject-A -> /home/user/project-name/subproject-A/target/subproject-A
          lrwxrwxrwx 1 user user 103 Feb  3 22:27 subproject-B -> /home/user/project-name/subproject-B/target/subproject-B
          lrwxrwxrwx 1 user user 103 Feb  3 22:27 subproject-C -> /home/user/project-name/subproject-C/target/subproject-C

        So alright, now I can just set up the "Remote staging" "Path from root" and "Mapped as" in the IntelliJ JBoss plugin to map a single folder, and that folder contains symlinks with the right names to make the artifacts end up in the right spot when IntelliJ tries to transfer over the files into the Docker volume.
      2. Using this approach with only one mapped path, the first artifact will always have its failed transferred into the container and deploy successfully, but none of the following artifacts will deploy. I don't get any helpful logs as to why, and I'm stuck. The server log output of the second failed artifact deploy looks like this:

        container-name | 00:08:11,497 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 6) JBAS013412: Timeout after [1000] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'deploy' at address '[("deployment" => "subproject-B")]'
        container-name | 00:08:11,504 ERROR [org.jboss.as.server] (management-handler-thread - 6) JBAS015870: Deploy of deployment "subproject-B.war" was rolled back with the following failure message: "JBAS013487: Operation timed out awaiting service container stability"
        container-name | 00:08:16,505 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 6) JBAS014781: Step handler org.jboss.as.server.deployment.DeploymentHandlerUtil$1@623a931f for operation {"operation" => "deploy","address" => [("deployment" => "subproject-B")],"operation-headers" => {"caller-type" => "user","access-mechanism" => "NATIVE"}} at address [("deployment" => "subproject-B")] failed handling operation rollback -- java.util.concurrent.TimeoutException: java.util.concurrent.TimeoutException
        container-name | at org.jboss.as.controller.OperationContextImpl.waitForRemovals(OperationContextImpl.java:275) [jboss-as-controller-7.5.5.Final-redhat-3.jar:7.5.5.Final-redhat-3]



      Any help would be really appreciated, thanks!