CAS overlay: How to reduce the WAR size - cas

I am upgrading CAS from 3.x to 5.x. The CAS Overlay Installation: builds a war file of about 120 MB about 5 times larger than 3.x.
How can I skip the unused modules/jars from the war file in order to reduce the file size and deployment time? I only need to authenticate against a Database and AD/LDAP.

The build for CAS 5.3.x is based on Apache Maven, and Apache Maven has a concept for excluding dependencies. You can read more about this here. This means that you'd have to find the coordinates for dependencies you think you don't need and exclude from your deployment via exclusions tag. Furthermore, the Apache WAR plugin does allow you exclude files from the final packaging, which you might also be able to use to remove JARs, etc from the final web application artifact that you think you don't need. You can read more about that here.
Tweaking the internals and list of dependencies is a completely non-supported approach and may directly affect the stability and security of the deployment. Do so at your own risk.

Related

DIY Tomcat, where is the webapp folder on the local git repo

following OpenShift tutorials, creating a tomcat application and clone it, the local repository will contain a pom.xml, webapp folder.
What's the equivalent on a diy application that contain a diy and misc folders
Thank's in advance, any help is appreciated cause I'm really stuck here !?
Update
Well I've install a Tomcat 8 DIY application following this tutorial here everything works fine, I can see the Tomcat page in the browser, the problem is how to deploy a .war file.
For a Tomcat 6/7 application on OpenShift, the local git repository have this structure:
____Tomcat7/6
|_________ webapp
|_________ src
|_________ pom.xml
But for a Tomcat 8 DYI application I have this structure
________Tomcat8/diy
|__________ Diy
|__________ misc
|__________ readme
So Where to deploy my .war files, cause there is no webapp folder?
The title of your question suggests that you are mixing up at least 5 different, completely independent & orthogonal tools and concepts:
Git is a version control system ("push", "local repo")
Maven is a build tool ("pom.xml")
Apache Tomcat is a servlet container ("Tomcat 6/7/8")
rhc is some client tool provided by yet another cloud computing platform ("OpenShift")
Your code is the stuff that you have written, it's completely under your responsibility.
Before you start doing anything, please make sure that you have at least some basic understanding of what each of these tools does. Then ask yourself whether you really need Tomcat 8 instead of Tomcat 7, and whether a 2 year blog post about the compilation of Tomcat 8 within an OpenShift gear is the best source. All these deployment details can change pretty quickly, if it worked two years ago, it's not guaranteed that it would work now.
I've never worked with OpenShift, but as far as I understand, the basic idea is this:
You write your code
You create your OpenShift account and allocate some "Gear" (or "Dyno" or whatever...) for your application
You commit your source code (/src) and the files that are necessary for the build (pom.xml), and use git to push it to the repository OpenShift gave you.
OpenShift then uses your pom.xml and builds all the WAR-files on it's own
Then you can use your rhc client tool to start your application, if that's not done automatically.
Some of these steps can be changed.
If you really have to, you can indeed compile your own Tomcat8, the tutorial you linked tells you how (more or less. The dude who did it obviously knew what he was doing there, so he might have skipped some details that seemed trivial to him).
Furthermore, if you really want, you can deploy pre-packaged WAR-files, by deliberately removing all the stuff that is necessary to build you app (removing pom.xml and all the /src), and instead adding the packaged application to your git repo, and then pushing it all to OpenShift. Then it will skip the build step, and just run what you gave it. OpenShift seems to provide some information about this deployment strategy: https://help.openshift.com/hc/en-us/articles/202399740. Please read the documentation and make sure you understand what you want to do. For example, filter-branching your git repo and removing all source files you have ever written is not a good idea, even if you don't need these files on OpenShift.
Currently, I don't see anything of the standard tomcat directory structure in the tree that you show. Instead, there seem to be just some basic ruby-scripts or some other default-demo-app-stuff... That's why it's called "do it yourself". If you don't want this, take a standard Tomcat7 app.

Using org.eclipse.core.resources with RAP

I am currently trying to port an Eclipse RCP plugin to RAP (it is my first experience with RAP). I had a look at several sample applications and tutorials on how to port, but all information I have got says that the bundle org.eclipse.core.resources should be available (as long as I don't misinterpret them completely).
I have resolved all other Required-Bundle-errors, but 'Bundle 'org.eclipse.core.resources' cannot be resolved' resides. It seems that org.eclipse.core.resources is not included with the RAP target platform (I installed it via Eclipse and checked the settings).
Is org.eclipse.core.resources not included anymore and if yes, what can I use to replace it? Or how can I include it?
The bundle org.eclipse.core.resources is not part of the RAP target platform, and it never was. The original bundle the Eclipse platform is not suitable for RAP.
To use the resources bundle with RAP, a RAP version would have to be created, that provides per-session workspaces in ResourcePlugin#getWorkspace(). It's technically feasible but probably a fair amount of work.

How to implement continuous deployment with Nexus and Jenkins

I'm trying to implement a continuous deployment system and I seem to not be able to find a good answer for our problem.
We use Jenkins to run a maven build to generate our artifacts and deploy them to Nexus. I see a few projects that bundle up everything into a single war or tar file, extract one file per request from Nexus by name and deploy it to an application server, but this requires them to know beforehand what versions they have available.
My project has quite a few jars/wars/binaries among other artifacts, which don't get deployed using an application server. What we want to do is be able to do is pull any snapshot or release revision of the software out of nexus and either generate an install package or deliver it directly to a remote server.
Clarification: I want QA or development to be able to select a version from Jenkins; where Jenkins will poll Nexus for the available versions, then perform an automated deploy to a server from Nexus.
Is there an easy nexus/maven way to get software out to a testing system?
So, is there a way to poll nexus to determine what revisions are available through ant/ivy, Jenkins, maven, gradle? I'll write in something else if it helps.
I see that a similar question was asked here: How do I choose an artifact from Nexus in a Hudson / Jenkins job?, but it is as of yet unanswered 9 months later.
Nexus gives you a standard HTTP browsing capability. You could browse the repository through HTTP and see what is available.
I still don't understand your Use Case though. If you know which versions of the project you want then what is the problem?
The easiest would be to write an installer pom.xml that has in it a ${} placeholder for the version you want for the artifacts then invoke mvn with mvn package -Dproduct.version=1.0.0
If you use a container, PAX has plugins that allow you to specific artifacts like mvn:myGroup/myArtifact/myVersion and it will auto pull from Maven.
Nexus isn't doing any magic. It's all well known paths on a URL of groups/artifactId/versions

Store environment-specific OSGI Configurations for CQ

I'd like to store the Felix configurations we've made in SVN and have them applied to CQ in the packages produced by an automated build. To do this I have been following the instructions found in this CQ5 OSGI Configuration Document to create sling:OsgiConfig configuration nodes that get checked into SVN.
How can I store environment-specific configurations? For example, I want a different logging configuration for the DEV environment than the PROD environment will use. I would like to store the config for both environments in SVN ideally and have the environment pick which config to use somehow based on the environment.
How can I do that--or is there a different approach that I should be using for environment-specific configurations?
To have environment-specific configurations, you should use Run Modes in CQ5 - there is plenty of information here on how to achieve this_page
Hope this helps.

Using closed-source dependencies with Maven

I have a closed-source project that I would like to build using Maven. It has a dependency on two java libraries which are not available in any public repository that I've been able to find (libGoogleAnalytics.jar and FlurryAgent.jar in this case, but the question applies to any closed-source dependency).
I would like anyone in my organization to be able to build the application using the exact same versions of the dependencies that I use to build the application. This includes my colleagues and our build-server.
How do I manage closed-source dependencies that maven doesn't know how to resolve?
Obviously, I could go to each person's machine and manually execute "mvn install:install-file" to get the binary into their maven repository, but manually managing dependencies like that defeats the purpose of a dependency manager.
As per maven's Internal Repositories documentation, I could set up a repository server somewhere and put the binaries there, which all the developers would then access. But that means I have a new server to maintain (or at least a new website on an existing server). It also means I have to worry about permissions to ensure that outside parties can't access the repository. It also means I have to worry about backups and availability now so that developers don't run into hiccoughs if the repository is unavailable.
All of these problems would go away for me if I could somehow use our existing scm (hg in this case, but it could be git or svn or whatever) to store the dependencies. Our source control repository is backed up already, it will basically always be available to developers doing builds, and its permissions have already been dealt with.
But I haven't been able to figure out how to manage maven dependencies using hg yet, if this is even possible.
It turns out that Manfred's answer didn't quite work for me. The app compiled, but it did not run on my Android device because the required google analytics classes were missing.
Following the links he supplied, I discovered this solution which is actually a little cleaner and worked properly.
In summary, I added the following dependencies to my pom.xml. The groupId, artifactId, and version were all made up by me using reasonable values:
<dependencies>
...
<dependency>
<groupId>com.google.android.apps.analytics</groupId>
<artifactId>libGoogleAnalytics</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.flurry</groupId>
<artifactId>FlurryAgent</artifactId>
<version>1.24</version>
</dependency>
</dependencies>
I then added a repository definition for where I'm storing the third party dependencies in my project's source tree:
<repository>
<id>third.party.closed.source.repo</id>
<url>file://${basedir}/../maven_repo_3rd_party</url>
</repository>
I then moved the jar files to the following location:
./maven_repo_3rd_party/com/google/android/apps/analytics/libGoogleAnalytics/1.1/libGoogleAnalytics-1.1.jar
./maven_repo_3rd_party/com/flurry/FlurryAgent/1.24/FlurryAgent-1.24.jar
Once I did that, my project compiled and ran exactly as if the third party dependencies were resolved from an official maven repo.
While I really think you should use a dedicated repository server and Sean Patrick is totally right about it here is a hack to get it to work.
Put the jar file in a libs folder just like you did in the days gone by (remember Ant.. ouch) .. and then declare a dependency to each jar using the scope system and a path.
An example can I did this for is described here
http://www.simpligility.com/2010/01/how-to-mavenize-a-typical-web-application-build-jasperserver-3-7-sample-webapp/
Specifically a dependency would e.g. look like this
<dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports-chart-themes</artifactId>
<version>3.7.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/jasperreports-chart-themes-3.7.0.jar</systemPath>
</dependency
Oh and now that I told you how to do it keep in mind that this is BAD practice and has a bunch of issues but it will work...
Use A dedicated Repository Server
As per maven's Internal Repositories
documentation, I could set up a
repository server somewhere and put
the binaries there, which all the
developers would then access.
Exactly. Set up a maven repository server with several repositories, e.g. these:
internal-releases
internal-snapshots
external-opensource
external-closedsource (this is where the lib we are talking about goes)
But that means I have a new server to
maintain (or at least a new website on
an existing server). It also means I have
to worry about permissions to ensure that
outside parties can't access the repository.
Yes, but a company that does serious software development should have an infrastructure like that. But if your company is serious about using Maven, there should probably also be a dedicated position for configuration management, and that person should administer this server.
It also means I have to worry about
backups and availability now so that
developers don't run into hiccoughs if
the repository is unavailable.
The standard repository servers (e.g. Sonatype Nexus) are rock solid. If it ever hangs, just restart the app server / servlet container it's running on. Also, once developers have downloaded a library from the repo, it remains in the local repo, so even if the repo is down, there shouldn't be a problem (but you can't reference a new dependency when the server is down).
Use your existing SCM as a maven repository
OK, if you really want to use your SCM as a maven repo, here's how to do it:
http://maven-svn-wagon.googlecode.com/svn/site/index.html
This article describes how to setup an SVN-based maven repository for your own project. But if you want to deploy a third-party to the repo, just create a pom with the config mentioned here and use that pom to deploy:deploy-file your library.
(There are other wagon / scm implementations also, and the configuration is slightly different, but the solution remains the same: create a pom according to the wagon implementation you are using and then do deploy:deploy-file (see more info on the usage page)