Deployment with Karaf and ACE

advertisement
Deployment with Karaf and ACE
Jean-Baptiste Onofré, Talend
jbonofre@apache.org, 2011-11-11
Summary




Background
Introduction to Karaf
Introduction to ACE
ACE and Karaf
•
•


Use case 1: standalone ACE server and Karaf with
ACE agent (demo)
Use case 2: Karaf hosting ACE server
Roadmap
Q&A
My Background





Jean-Baptiste Onofré
Software Architect at Talend
ASF Member
PMC for Karaf, ServiceMix
Committer for ACE, Camel, Kalumet
Introduction to Karaf



Lightweight complete OSGi container,
abstracting the OSGi framework (Felix or
Equinox)
Comes from ServiceMix Kernel
High adoption (Geronimo, ServiceMix,
…)
Karaf overview
Enterprise (JPA, JNDI, JTA)
WebContainer (Pax Web/Jetty)
Instances
Remote &
Management
ConfigAdmin
Shell Console
Logging
Deployers
Security/JAAS WebConsole
Features
Aries Blueprint / Spring
OSGi framework (Apache Felix / Eclipse Equinox)
JVM
Karaf directory structure
/bin: startup scripts
 /etc: configuration files (ConfigAdmin)
 /data: working directory
 /data/cache: OSGi framework bundle cache
 /data/generated-bundles: temporary folder used by the deployer
 /data/log: log files
 /deploy: hot deploy directory
 /instances: directory containing child instances
 /lib: contains the bootstrap libraries
 /lib/ext: directory for JRE extensions
 /lib/endorsed: directory for endorsed libraries
 /system: OSGi bundles repository (OBR), laid out as a Maven 2 repository

Karaf start/stop

Starting Karaf with the shell:
> ./bin/karaf

Starting Karaf without shell:
> ./bin/karaf server

Starting Karaf in background:
> ./bin/start

Stopping Karaf:
karaf@root> osgi:shutdown
> ./bin/stop
Karaf shell console
Complete Unix-like shell environment: completion,
grep, more, find, etc
 Remote using SSH (Karaf uses Mina SSHd)
 Contextual help on commands:

karaf@root> <tab>Display all 182 possibilities? (y or n)
*:help
addurl
admin:change-opts
admin:change-rmi-registry-port admin:change-ssh-port
admin:connect
admin:create
admin:destroy
admin:list
admin:rename
admin:start
admin:stop
bundle-level
cancel
cat
…
karaf@root> features:list --help
Karaf Logging
Powerful logging system powered by OPS4J PAX
Logging
 Supports several logging API: Apache Commons
Logging, SLF4J, Apache Log4j, Java Util Logging
 Karaf provides commands: log:display, log:displayexception, log:set
 Use of etc/org.ops4j.pax.logging.cfg by default
(changes are dynamic)

Karaf child instances
Karaf supports multiple child instances.
 A child instance is a copy that you can launch separately and
deploy applications into. An instance is not a full copy of Karaf,
but only a copy of the configuration files and data folder which
contains all the runtime information, logs and temporary files
 Instances are managed by the « admin » commands:
admin:list, admin:create, admin:start, ...
 The bin/admin script allows you to manipulate child instances
outside a Karaf shell environment

Karaf configuration
Karaf combines ConfigAdmin and FileInstance to be able
to propagate changes on the configuration files to the
bundles
 Files in /etc folder are used to set the startup
configuration.
 For dynamic configuration, Karaf provides commands to
administer the OSGi configuration service: config:edit,
config:proplist, etc
 Support of commit and rollback: config:update,
config:cancel
 Provides an MBean dedicated for configuration.

Karaf deployers
Karaf monitor the deploy folder by
default (FileInstall) and delegates the
polled files to the deployers
 A deployer is simply a bundle, easy to
create
 Karaf provides several deployer: Spring,
Feature, Kar, War, Wrap

Karaf features
Karaf provisioning is made by Features
 A Karaf feature is a collection of bundles, configuration,
and others features forming an application
 Features are described in a XML features descriptor

<features xmlns='http://karaf.apache.org/xmlns/features/v1.0.0'>
<feature name='my' version='1.0'>
<feature>other</feature>
<bundle>mvn:...bundleA</bundle>
<bundle>http:...bundleB</bundle>
<config></config>
<configfile></configfile>
</feature>
</features>
Introduction to ACE
Software distribution framework
providing
 Handle dependency management
 Deployment management
 Log reporting

ACE topology
ACE server including repository, distribution, etc
 A set of target system where the ACE agent is running
 A client (browser or REST) to handle the ACE server console

ACE logical grouping
ACE feature is like a Karaf feature but
only handling bundles: it's a group of
bundles
 ACE distribution is a group of features
 ACE target is where the ACE agent is
running: it's where distributions will be
deployed

ACE and Karaf
ACE provides Karaf features
 ACE agent easily deployable in Karaf
using the ace-agent feature
 ACE also provides all Karaf features to
deploy the ACE server in Karaf

Use case 1

Standalone ACE server:
unzip org.apache.ace.target.devserver*.zip
cd ace-devserver
./run.sh

Install ACE agent in Karaf:
karaf@root> admin:create testing
karaf@root> admin:set-opts testing “-Didentification=testing”
karaf@root> admin:connect testing
karaf@testing> features:addurl mvn:org.apache.ace.karaf/apache-ace/0.8.1-incubatorSNAPSHOT/xml/features
karaf@testing> features:install ace-agent
Started management agent.
Target ID : testing
Server
: http://localhost:8080
Sync interval: 2000 ms
Unaffected bundles will not be stopped during deployment.
Use case 2
ACE server distribution powered by
Karaf:

root@karaf> features:addurl mvn:org.apache.ace.karaf/apache-ace/0.8.1-incubatorSNAPSHOT/xml/features
root@karaf> features:install ace-server

Will be in the ACE provided distributions
Roadmap
Extend/enhance ACE feature/distribution to be able
to directly support Karaf features
 Leverage Karaf sub-projects in ACE: Karaf Cellar
clustering, Karaf Cave OBR
 Embed ACE in Apache Kalumet to provide a complete
deployment platform (OSGi, J2EE, OS, etc)

Sources
Links
•
•
•
http://karaf.apache.org
http://incubator.apache.org/ace
http://Incubator.apache.org/kalumet
Contact

Jean-Baptiste (JB) Onofré
•
•
•
jbonofre@apache.org
jbonofre@talend.com
http://blog.nanthrax.net
Q&A
Download