apache-camelosgiapache-karaf

Deploying Apache Karaf into production


For context: I am currently working with Apache Camel to do some integration tasks. I compile the code with Maven which gives me bundles I install in my Apache Karaf instance (v. 4.4.1). On top of that I also have some XML files I put into the deploy folder.

My actual question is that after developing locally on my computer, what is considered best practice to transfer the Apache Karaf instance with its content to a production server? I have tried transfering files which works fine (copy-pasting the Apache Karaf folder).

Note: I am using Git for versioning and have different builds locally. I don't want to use Docker or other containerization methods.

Best Regards


Solution

  • Karaf is very flexible. In my humble opinion, I prefer generating a Karaf custom distribution that already contains all my bundles or features with all the dependencies.

    You can create your custom distribution to include your XML files or any extra configuration file. Finally, the end user takes your custom distribution, usually in the form of a zip file, and unzips it on the server to launch the application as a regular application or service.

    Apache Unomi works in this way: https://unomi.incubator.apache.org/. If you want to see an example of a custom distribution, take a look at these links:

    https://github.com/apache/karaf/tree/main/examples/karaf-docker-example
    https://github.com/yupiik/esb
    

    Another possible alternative is to have an instance of Karaf already configured on your server and deploy your application as a KAR file. The KAR files can include bundles and/or features and all the dependencies required. You can deploy the KAR file by moving it to the /deploy folder.