Home » Eclipse Projects » Virgo » Deployment of Virgo runtime dependencies: Maven-based builds without Eclipse IDE(Options for deploying dependencies; p2 repository, or other, with or without tycho.)
Deployment of Virgo runtime dependencies: Maven-based builds without Eclipse IDE [message #1150941] |
Wed, 23 October 2013 03:35 |
Douglas Beattie Messages: 6 Registered: October 2013 |
Junior Member |
|
|
As implied in my comments of a recent discussion in this thread, there is a trick to provisioning a Virgo deployment, based on the dependencies ('Import-Package:') of each bundle, and the sometimes "nested" dependencies of those imports.
As GianMaria mentioned, a 'p2' repository can be used to hold these dependencies, and Eclipse Virgo can be configured to pull its dependencies as needed from the p2 repository.
There are at least 2 tricks here I'd like to learn:
- how to create the repository, with proper naming conventions or hierarchy if needed, and
- how to gather -- and filter the dependencies destined for the repository.
For example, using the Maven enforcer plugin and several declarations in the 'properties' section of my POM file, it seems that I'm reasonably able to control which version of Spring components are used. So, at build time, I limit the Spring versions of my application to 3.1.x and above, which show up as "[3.1,4)" in OSGi bundle manifests.
But, since most (but not all) of these are provided by Eclipse Virgo, they should not be included in the list of files which are dependencies which need to be gathered and made available to Virgo before my bundles can be expected to load and resolve properly.
At the moment, I'm using a combination of the maven-dependency-plugin, and a Python program (about 150 lines of code). I run the plugin from the command line as
$ mvn dependency:copy-dependencies -DoutputDirectory=/tmp/deps -DexcludeScope=provided
This pulls a bunch of files from the local Maven build repository
and places them in the output directory. Notice a small sample of the
directory listing:
spring-aop-3.1.0.RELEASE.jar
spring-aop-3.1.4.RELEASE.jar
spring-asm-3.1.0.RELEASE.jar
spring-core-3.1.0.RELEASE.jar
spring-core-3.1.2.RELEASE.jar
spring-core-3.1.4.RELEASE.jar
spring-expression-3.1.4.RELEASE.jar
spring-orm-3.1.2.RELEASE.jar
spring-tx-3.1.2.RELEASE.jar
spring-tx-3.1.4.RELEASE.jar
spring-data-commons-1.5.2.RELEASE.jar
spring-jdbc-3.1.2.RELEASE.jar
The Python program post-processes this set of files by performing lookups based on "major.minor" version, against existing libraries held in the release at 'repository/ext/' and omits most of the spring "dependencies" completely from the final list which is then simply copied into 'repository/usr/', renaming all valid bundles according to naming convention {bundle-symbolic-name}_{bundle-version}. Once all those dependencies are in the 'usr' repository, I'm good. Dropping my bundles into 'repository/usr/' and then dropping my Virgo 'plan' file into the 'pickup' folder has been working great.
So, what of a strategy involving a 'p2 repository'? For a purpose-built virtual appliance (my "application"), there can be no remote p2 repo, so the proper dependencies must exist locally, and this appliance runs standalone. While I suspect there may be a way to start the system at least once and have it "pull" all its required dependencies from a remote location within the corporate LAN, I think this may not be acceptable for bundles which are located/loaded "on demand." And the final product is not necessarily meant to be booted before being deployed. (Think "shrink-wrap.")
Note: I'm not using the Eclipse IDE for development (I switched to IntelliJ IDEA, because Eclipse IDE for almost 10 years still gives me no option for a non-blinking cursor) and the objective is to maintain our Maven projects so they can be built entirely by automated build tools.
. . .
Douglas Beattie
www.linkedin.com/in/beattidp
[Updated on: Wed, 23 October 2013 03:47] Report message to a moderator
|
|
| | | |
Re: Deployment of Virgo runtime dependencies: Maven-based builds without Eclipse IDE [message #1155065 is a reply to message #1151697] |
Fri, 25 October 2013 17:15 |
Douglas Beattie Messages: 6 Registered: October 2013 |
Junior Member |
|
|
Nikolas -- very interesting, and good info! (for the build, I assume) and I'll look closer into this, and study the tycho plugins for Maven.
So, for the provisioning and deployment:
Here for me 'provisioning' means putting all the pieces and configuration -- plan(s), bundles, dependencies -- into an application server installation (Eclipse Virgo of course) on the virtual appliance image. (Other steps to complete the full provisioning might include defaults for DNS resolution, devices/storage, network interfaces or VLAN, etc.)
And, 'deployment' means installing a virtual appliance into a hypervisor, and powering it up, which subsequently would automatically start the application server and associated services for a custom app or set of apps. At the initial point of deployment the 'first boot' home page would typically allow an administrator to further configure application-related end points, host names, credentials, and the like, for the target environment.
At the point of deployment, the purpose-built virtual appliance must be assumed to run inside a secure network environment with possibly an extreme level of firewall and restricted access. So, everything which is required to run the appliance (in particular all bundle dependencies) must exist on the virtual media, and be readily available for Eclipse Virgo for Apache Tomcat. We can't assume any Internet or external access will be allowed or available. (In the experience of a previous employer, if internet access is even attempted during an initial evaluation, their security officers may not like it very much. That is, they should not have to create new routes or deliberately open ports to the outside, to effectively utilize an embedded set of core services and functionality contained within the virtual appliance.)
Anyway, perhaps if I properly create a p2 repository, can I copy it as-is, exactly onto the appliance's virtual media as part of the provisioning process? And then, what would I need to tell Virgo? Can I simply "overlay" it directly into the existing 'p2' folder in the root of the Virgo release, or should I take a copy of the release 'p2' folder and use that as a starting point and destination for (Maven-driven) populating the p2 repo at build time? (And then perhaps copy the final repo contents back into place.)
. . .
Douglas Beattie
www.linkedin.com/in/beattidp
|
|
|
Goto Forum:
Current Time: Wed Apr 17 19:59:57 GMT 2024
Powered by FUDForum. Page generated in 0.01731 seconds
|