Skip to content

Conversation

gsaslis
Copy link
Contributor

@gsaslis gsaslis commented May 7, 2018

What this PR does / why we need it:
Largely, this PR includes cherry-picked work from the restcomm1657 branch, where there is an ongoing effort to move from ant to maven for the generation of the WAR artifacts.

On top of that, this PR introduces 2 extra features:

  1. a new maven profile which builds a WAR file with JUST restcomm connect + management UI. (i.e. without mediaserver, RVD and WebRTC demo in the same WAR file).
  2. the docker image generation of both the "all-in-one" (restcomm/restcomm), as well as the "standalone" (restcomm/connect), ported over from the Restcomm-Docker repository.
    With this, that repository largely (if not entirely) becomes deprecated and reduces our tech debt.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2474

Special notes for your reviewer:

  1. Please note that due to the cherry picks, this PR also includes the wildfly maven module. I am not sure if you would like that included. If not, I can exclude it, because I presume RC does not fully support wildfly yet (which is the work underway in restcomm1657).
  2. At the moment, the Restcomm Media Server has its own docker image and - afaik - so does RVD + WebRTC Demo. This is the reason for the 2 new features above, so we can run each application in its own container, rather than everything-in-one.
  3. The generated restcomm/connect docker image has already been tested with the new mediaserver docker image, and we can get a simple +1234 call running correctly. If there is a more extensive list of tests you would like to run, happy to help with that.

jaimecasero and others added 30 commits April 27, 2018 17:11
(cherry picked from commit acd39e8)
(cherry picked from commit 6852f4b)
(cherry picked from commit cc4b9fe)
(cherry picked from commit 5f2e1e2)
(cherry picked from commit f3a722c)
(cherry picked from commit ec3fcdf)
(cherry picked from commit ecccc12)
(cherry picked from commit 98febea)
(cherry picked from commit bfe3efe)
(cherry picked from commit 7d0f02f)
(cherry picked from commit 6785c18)
(cherry picked from commit 50915fa)
(cherry picked from commit 168fd77)
(cherry picked from commit fbcdd54)
(cherry picked from commit 7e0af37)
(cherry picked from commit 46e27f1)
latest changes from `master` @ `$PROJECT_HOME/restcomm/configuration/config-scripts/as7-config-scripts/restcomm/autoconfig.d/`
Moving them into this GH repo, so they can be included in the docker image build.
As we are moving towards using the docker image as our binary (instead of just the WAR file), it makes sense to keep all those components that are used to build the image in the same repository anyway.
Major differences are two:
1. restcomm binary is NOT retrieved from Box, rather it is expected to be available in the local filesystem. This is because this `Dockerfile` will be used as part of the maven build, so the WAR file will (just) have been created anyway.
2. The Dockerfile now comes in 2 variants: one is `Dockerfile_standalone`, which includes *just* restcomm-connect (i.e. no mediaserver, no rvd, no webrtc-ui). As such, any mediaserver, etc. files are removed from the Dockerfile_standalone. On the other hand, the `Dockerfile_all-in-one` is a more straightforward port from `Restcomm-Docker` repo and basically just includes change (1) above and some reordering (to make continuous rebuilds of docker image faster, leveraging cached layers.
In a nutshell, the `standalone` profile includes just restcomm-connect. The `all-in-one` includes RC + RMS + RVD + WebRTC UI, just like it used to be before introducing these 2 profiles. (Eventually, we should be getting rid of this second one, but for the moment, for backwards compatibility and for moving forward with a smoother migration process, we should keep it around and just focus on improving the WAR + docker image generation on that part (in maven build, instead of `ant` + separate restcomm-docker repo).
the plugin is used in each of the 2 maven profiles (`standalone` and `all-in-one`) to pick up the corresponding Dockerfile (`Dockerfile_standalone` and `Dockerfile_all-in-one`) and build the appropriate docker image (`restcomm/restcomm` and `restcomm/connect` respectively).

For the moment - and this is perhaps a point for discussion - the plugin's `build` goal is bound to the `pre-integration-test` phase, as the fabric8 philosophy suggests you build a docker image (which is the resulting binary artifact from your maven build) and then you `start` it - still within the `pre-integration-test` phase - (together with all of its dependencies, e.g. database docker containers, 3rd party dependencies, etc.) so that you can then run the `verify` phase tests against the running system.
There is also a binding to the plugin's `stop` goal, in the `post-integration-phase`, which tears down the above setup.

I am leaving some of the above bindings commented out, on purpose, so you, oh dear reviewer, can get a better idea of how this works, in case you're not familiar.

Whether we choose to adopt this setup (which in my previous experience is pretty damn awesome!! ) largely depends however on what tests we already run in the `verify` phase and whether we would care to move some to other phases - or even other jenkins pipeline stages.

If we don't want to adopt the above approach, then we can consider binding the docker image creation in some other phase of mvn lifecycle.
(due to previous merge conflicts)

i.e. this change was introduced in 4b5fc6c, but the cherry pick didn't bring it along due to some merge conflict.
Yorgos Saslis added 8 commits May 6, 2018 10:01
This way the `ADD` command in the Dockerfile can both copy the file AND unpack it in one go  ; )
this is almost certainly not needed (especially so in the mid/long-term), but i am adding it for backwards compatibility reasons, and to make for a smoother migration
Manually uploaded media server 6.0.23 in our own CXS Nexus releases repo and fixed artifact ID.
Also added some missing files, which are needed for the all-in-one docker image bundle.
Restcomm does not yet fully support it
@gsaslis gsaslis changed the title [WIP] Maven assembly of WAR + Docker image Maven assembly of WAR + Docker image May 7, 2018
@gsaslis gsaslis requested review from a team and jaimecasero May 7, 2018 13:06
<goals>
<!-- "build" should be used to create the images with the
artifact -->
<goal>build</goal>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again i dont see the "build" goal being hooked to pre-integration-test. i think "package" would be better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaimecasero that is a fair point.

btw, do you agree that it should be bound to some phase, or would you prefer that we added the plugin and then explicitly invoke the docker:build maven target when we want to build a docker image?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im looking into hook docker image generation into some phase, so its part of "regular" build, and invoked with regular maven goals

</properties>
<profiles>
<profile>
<id>all-in-one</id>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens on maven:deploy when both profiles are enabled. Will both binaries will get deployed into nexus with different classifier?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaimecasero with regards to the docker images, that is not an issue, because we have restcomm/restcomm and restcomm/connect images.

What would you propose for WAR binaries?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you mean ZIP binaries... The assemble ZIP files should be deployed in nexus as attachment of project with specific classifier. But since you are using same project coordiante to create slightly different ZIP binaries, then assembly classifier is required to be different...

Honestly i tend to think these are really two different maven artifacts (all-in-one vs standalone),which should be modelled as separate maven modules with diff coordiantes(artifactid). In terms of zip versus docker, im fine sharing same project module, as their are semantically the same binary file (same features delivered) but with different flavors (ZIP versus Docker image). Also, we dont want to deploy docker image into Nexus as maven dependency,but be deployed in Nexus docker registry as docker image...

Again, im not sure about valid usage of profiles here...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the separate module sounds like a valid approach, but we already have separate modules for as7 (and wildfly is coming up) and the approach of a separate module for each combination of (standalone vs. all-in-one) * (as7 vs. wildfly) is already starting to sound like too much overhead... ?

I would happily let you choose on this one and I can adapt accordingly, so we can get this merged in.

<artifactId>sip-servlets-as7</artifactId>
<version>${sipservletapi.version}</version>
<type>zip</type>
<classifier>assembly</classifier>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

classifier is the same as previous assembly, will this create collision if both profiles are enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i get your point, but - to make sure I did get it right - this is not the right place to add that comment, right?

(i mean this right here is referring to the sip-servlets dependency, not the artifact generation... )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, this is not right place sorry, i guess you got the right point anyway..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jaimecasero
Copy link
Contributor

@gsaslis i dont think we will be able to merge this into master with all the wildfly10 stuff, specially all the changes in the pom files...

@gsaslis
Copy link
Contributor Author

gsaslis commented May 7, 2018

@jaimecasero i agree. this is what i tried to highlight on my opening PR comment above.
how would you propose we handle the wildfly10 stuff then? Should I just delete that module from this PR ?

i followed this approach primarily so i can cherry pick your commits and you can keep track of what's included.

@jaimecasero
Copy link
Contributor

@gsaslis wildfly10 new module is not really any issue. But along with the new module there were lots of changes to the existing pom files to remove tomcat depends and bring widlfly. Those changes in core project pom files to accomodate wildfly10 qare the ones i would try to exlucude from this PR...

@gsaslis
Copy link
Contributor Author

gsaslis commented May 7, 2018

@jaimecasero ah, i see, so you're saying i should reverse commit this: a4df2e0
?

<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>assembly</id>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the "right" place i think. this id is same as standalone one, and could create potential collision

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be addressed with 71fd01f

@jaimecasero
Copy link
Contributor

@gsaslis that commit a4df2e0 is specially bad as you seen, becuase it introduces wildfly dependencies, and modifies testsuite to run with wildfly.which is still far from supported...

@gsaslis
Copy link
Contributor Author

gsaslis commented May 7, 2018

@jaimecasero reverse committed with fe1e250

the bindings to the `pre-integration-test` and `post-integration-test` phases only really make sense if/when we want to start some containers during the `verify` phase.
I am keeping those execution bindings in, so we have the hooks ready. However, you can *safely remove* the `start` and `stop` executions of the fabric8 docker maven plugin with no problems.
@gvagenas gvagenas force-pushed the feature/mavenized_assembly branch from 0128dcd to 1898ff3 Compare January 13, 2022 15:28
@gvagenas gvagenas force-pushed the master branch 2 times, most recently from 9469191 to c67f142 Compare January 13, 2022 15:49
@gvagenas gvagenas force-pushed the feature/mavenized_assembly branch from 1898ff3 to 1ab97c4 Compare January 13, 2022 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

What is the right way to build from source?

3 participants