Store environment-specific OSGI Configurations for CQ - configuration

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.

Related

How to separate development and production environments in shadow-cljs?

I want to separate development and production environment variables for my shadow-cljs which is running in conjunction with a lein app through the Luminus template. My production environment is a docker container running on heroku.
It should work in a way that I can import a map, say config, and so that I can access the keys using (:some-key config), or something similar to this.
There is built-in support for separating release and dev configuration.
https://shadow-cljs.github.io/docs/UsersGuide.html#_release_specific_vs_development_configuration
The "import a map and access by key" you are asking for is not supported by shadow-cljs and would be something a library would provide instead.
I also do not recommend using environment variables to configure a build.
Also note that shadow-cljs configuration is about build time. If you want to access the "environment" at runtime you do not make it part of the build at all. Say you create a :node-script build running in node. You can just access js/process.env.SOME_ENV at runtime via normal code.

Services and env in manifest file?

I have a web (online calculator for an example) which developed by my fellow tem members. Now they want to deploy in PCF using manifests.
Languages used : python, php and javascipt.
I gone through the docs about pcf with manifest.yml
In that I don't have any idea about services and env.
What is that services and how can I find the services for the above project and also how can I find the environment variables?
And tell whether these fields are mandatory to run the project in PCF.
To your original question:
What is that services and how can I find the services for the above project and also how can I find the environment variables? And tell whether these fields are mandatory to run the project in pcf.
Does your app require any services to run? Services would be things like a database or message queue. If it does not, then you do not need to specify any services in your manifest. They are optional.
Similarly, for environment variables, you would only need to set them if they are required to configure your application. Otherwise, just omit that section of your manifest.
At the end of the day, you should talk with whomever developed the application or read the documentation they produce as that's the only way to know what services or environment variables are required.
In regards to your additional questions:
1)And also I have one more query...like in our application we used python ok! In that we use lots of pacakages say pandas,numpy,scipy and so on...how can I import all the libraries into the PCF ??? Buildpacks will contain version only right?
Correct. The buildpack only includes Python itself. Your dependencies either need to be installed or vendored. To do this for Python, you need to include a requirements.txt file. The buildpack will see this and use pip to install your dependencies.
See the docs for the Python buildpack which explains this in more detail: https://docs.cloudfoundry.org/buildpacks/python/index.html#pushing_apps
2)And also tell me what will be the path for my app name if Java I can enclose jar files
For Java apps, you need to push compiled code. That means, you need to run something like mvn package or gradle assemble to build your executable JAR or WAR file. This should be a self contained file that has everything necessary to run your app, compile class files, config, and all dependent JARs.
You then run cf push -p path/to/my-app.jar (or WAR, whatever you build). The cf cli will take everything in the app and push it up to Cloud Foundry where the Java buildpack will install things like the JVM and possibly Tomcat so you app can run.
what should I do for application devloped using pyhton , JavaScript and php....
You can use multiple buildpacks. See the instructions here.
https://docs.cloudfoundry.org/buildpacks/use-multiple-buildpacks.html
In short, you can have as many buildpacks as you want. The last buildpack in the list is special because that is the buildpack which will set the start command for your application (although you can override this with cf push -c if necessary). The non-final buildpacks will run and simply install dependencies.
3) we were using postgresql how can I use this in pcf with my app
Run cf marketplace and see if there are any Postgres providers in your Marketplace. If there is one, you can just do a cf create-service <provider> <plan> <service name> and the foundation will create a database for you to use. You would then run a cf bind-service <app> <service name> to bind the service you create to your app. This will generate credentials and pass them along to your app when it starts. You app can then read the credentials out of VCAP_SERVICES and use them to make connections to the database.
See here for more details:
https://docs.cloudfoundry.org/devguide/services/application-binding.html
https://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html#VCAP-SERVICES

CAS overlay: How to reduce the WAR size

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.

JBoss Fuse Specified service reference is null

I have two bundles, one is DB related and another one simple. DB bundle will export osgi service reference. Another one will get the service reference.
It is working fine when installing one by one. The service reference is null when starting the Jboss fuse karaf container.
Can i set bundle ordering ? or Can i set delay for completing DB bundle?
I need to install bundle after completing DB bundle.
Advance Thanks.
The actual code you have to write depends on how your bundles start. Do you use a Java class as BundleActivator? Spring? Blueprint?
Generally speaking, each bundle must specify its dependencies. There are 2 kinds of dependencies:
dependeny on some classes in packages exported by other bundles
dependency on a service provided by some other bundle
Your bundle should declare packages and services (Java interfaces) it needs. This way you "force" JBoss/Karaf to start bundles in the correct order and avoid null service references.
Have a look at this guide:
https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html-single/Managing_OSGi_Dependencies/index.html

How can one configure Hudson to integrate with Sventon?

Hudson ver. 1.353
Sventon ver. 2.14
I just cannot figure out how to configure Hudson to work with Sventon. It seems that the path format that Hudson expects from Sventon is not the format used by Sventon.
Any ideas?
Thanks.
UPDATE
Given an SVN repository with the name of windows, the Sventon URL path to the repository is http://dev-builder:8080/svn/repos/windows/list/
However, Hudson expects something like
http://dev-builder:8080/svn/repobrowser.svn?name=windows
Can anyone explain how this should be configured?
Regarding configuration, under the Source Code Management section of a job configuration, the Repository Browser dropdown lists Sventon 2.x as one of the options. (Not trying to be snarky, just making sure you're using the correct configuration.)
There are some Hudson bugs (search for sventon) in various states that might be related to your issue.
It's not clear to me whether this is a configuration problem or a Hudson bug. You could post the relevant configuration and both the paths that Hudson generates and Sventon expects. If it is a reproducible Hudson bug, reporting it to the Hudson bug database is the best bet.
Update with my experience: Under Source Code Management, I configured my Repository Browser to be Sventon 2.x and set the Repository URL to http://localhost:8080/svn and Repository Instance to windows. Hudson then listed changes with Sventon links as http://localhost:8080/svn/repos/windows/info?revision=XYZ
I think this means you should set:
Repository Browser to Sventon 2.x
Repository URL to http://dev-builder:8080/svn, and
Repository Instance to windows
Beware that the Hudson inline documentation for Sventon 2.x is wrong about the URLs that will be generated. It looks like this was never updated from 1.x.
You should however be aware that Sventon does not integrate well with projects that have multiple modules from different repositories. We for example use repositories A, B and C. And we've set our repository instance to A so that we can browse to things in that repository but not in any of the other.
Otherwise I really like Sventon as a svn browser.