How to back up a bundle from a running JBoss Fuse container? - osgi

I lost the original build file, but it is still there working nicely in the container. I would like to avoid rebuilding, as some edge conditions might come to play. I would expect it is possible to back up the working binary, so I could deploy new version and safely rollback if unfortunate. However, I can't find the folder where these are stored, or any commands that would magically extract the bundle.
There is a folder $FUSE_HOME/data/repository with a maven-like structure, and it seems to contain most of the installed bundles, but apparently not all, specifically not the version I am after.

Under the 'data/cache' directory you will see the bundles and the bundle numbers. Do a 'osgi:list' on the karaf shell and find the number of your bundle. Underneath the bundle+number directory you will find the deployed bundle creatively named 'bundle.jar'.

Related

Osgi bundle in start phase but not getting active

My OSGi bundle is giving me strange behaviour. Some times it gets Active in first go and some time I need to restart Karaf again and again to see whether my bundle is active or not. Even I cann't see any exception. And all other bundles are active. Can anyone suggest me what can be the cause. I checked its headers they are just ok, we are importing all the packages and exporting none. As is the case for my bundle. Even I hit start command many times. But it is not getting Active state.
Installation order of your bundles might not be aligned to their dependency orders. Try creating your own feature.xml file, where you can set the installation order of your bundles during startup. You can find more detail at https://karaf.apache.org/manual/latest/provisioning
And do not forget to add the features you have created to $KARAF_ROOT/etc/org.apache.karaf.features file in order to make your features installed automatically during startup.

How to store go dependencies?

I am using GoDep to resolve a project dependencies.
My problem is that repositories for dependencies maight be removed and my project wouldn't build.
I am trying to find any solution to store dependencies at Artifactory or another solution.
Please advice.
Regards.
Okay so GoDeps may be the standard way of doing this, but I usually found it a bit complicated. In my opinion, use a Makefile which sets a custom GoPath and just include dependencies with your code (remove their .git folder). This way the version freezes and no one needs to do a godep restore or something similar.
You can make recipes like make deploy that builds your code, runs GoFmt, cleans the pkg files, installs it to your custom GoPath bin/ and then you just go and run the binary.
You can have another one like make install that will install any missing dependencies.
I've managed to create a watch using this on my Makefile to keep on looking for changes on a linux based system using inotify-tools and call rebuild.
Internally all commands will be using standard go commands but you'll get rid of the GoDeps and maintaining JSON. To upgrade a dependency, it may be a bit of a problem as you'd have to manually copy the whole directory into your custom path and remove the .git/ folder.
Our company uses this method and seems to work quite nice for us.
Plus this method basically gets you away the $GOPATH/src/github.com/repoName/ kind of paths.
If i seem unclear, let me know, I'll add a gist on github.

Symlinking or hardlinking (but not copying) files with Maven

I'm switching an old web-application to using Maven rather than Ant. It goes mostly fine, but there is one thing I'm not sure about.
With customly written Ant build file I had a "development deployment mode", where it would symlink certain files (JSP and certain others) rather than copying them. This would result in a very streamlined development procedure: once you have deployment running, you just edit files in your source code checkout directory, and webserver picks up these changes automatically. Basically, you edit something in your editor, save file, and in a few seconds the changes automatically become visible through your browser, without any further steps.
How would I go about implementing something similar with Maven?
While this doesn't seem possible without writing a custom plugin, I found war:inplace goal in maven-war-plugin, which achieves what I want. The only downside is that I have to keep JSP files, JS files, images etc. together in src/main/webapp rather than have them logically separated in e.g. src/main/jsp, src/main/js, but that's not that important.

Spring Tool Suite: How do i clean Spring Tool Suite cache (if there is one)?

Few days back I created a maven project and i'm using angularJS for view, but whenever i make changes in the html file it doesn't show up after running the project, i clean the project countless number of times but the changes still don't show up.
But what i don't understand is that sometimes the changes show up the next day I run the project.
So is there some kind of cache that i need to delete after making new changes to my project??
I'm using STS Version: 3.3.0.RELEASE.
Thanks,
-Elysium
It sounds like your JavaScript files are not being copied over to the target directory properly. Make sure that after you do a build in the workspace that the proper version of the JS files are in the target folder on the filesystem (i.e., look outside of Eclipse). If the files are not correct, then your maven commands are not being completely invoked inside the workspace.
It's hard to say exactly what is going on without more information, but this sounds possible.

Can I force Fuse Fabric Maven Proxy to push an updated version of the same jar to containers

I've developed a project that has a bundle whose only purpose is to write a file to a certain location on all of the containers running it.
This file will change often, but does not really constitute an increase in version number. I also don't want to have 100 versions of this bundle in my repository. So I have left it as a snapshot. This question would also apply if I was doing active development on a project for fuse fabric.
Once built, I deploy the bundle to my fabric's maven proxy with:
mvn deploy:deploy-file -Dfile=target/file-1.0-SNAPSHOT.jar -DartifactId=file -DgroupId=com.some.id -Dversion=1.0.0 -Dtype=bundle -Durl=http:// username:password#hostname:port/maven/upload
I can then add my bundle to a profile with:
mvn:com.some.id/file/1.0.0
This works the first time.
Then I make a change to the file, rebuild the bundle, and deploy with exactly the same command. I remove the bundle from the profile and add it back in. The maven proxy on the fabric server has the new bundle in it if I check $FUSE_HOME/data/maven/proxy/com/some/id/file/1.0.0/
But on all of the containers running the profile on a separate server, the bundle is not updated. I assume because the version has not changed. However, fabric should be smart enough to tell the difference, as the md5 should be different.
For now I can change the version number and my problem is solved, or clear the maven proxy by hand. But in production I will not be able to clear the proxy on every server, nor can I expect someone to come up with a unique version for the bundle every time they make a small change to this file (which should happen often).
I have already tried adding updatePolicy=always to the fabric maven configuration, but I believe that only affects repositories that it is pulling from, not the proxy.
Any advice on the best way to solve this problem is welcome.
If you are using containers, your old artefacts must be cached in
$FUSE_HOME/instances/CONTAINER_NAME/data/maven/agent/
Delete the old artefacts from here and stop/start your container.

Resources