cloudsoft.io

Developing Cloudsoft AMP modules

Cloudsoft AMP is running on Karaf OSGi container. Before adding new AMP module please also check Handling Bundle Dependencies

For Developing Cloudsoft AMP modules we recommend using the .tar.gz distribution of Cloudsoft AMP.

Running

Start the instance with a console in the foreground using the following command

bin/karaf

This will launch the Karaf console where you can interact with the running instance. Note that AMP has already started at this point and is reachable at the usual web console url.

Start the instance as a server in the background using the following command

bin/start

The Karaf container will keep state such as installed bundles and configuration between restarts. To reset any changes add clean to the CLI arguments.

Debugging Cloudsoft AMP

To start in debug mode use

bin/karaf debug

and connect to port 5005 using your normal Java debugger.

If you want to change dt_socket port you can pass JAVA_DEBUG_PORT environment variable

JAVA_DEBUG_PORT=5006 bin/karaf debug

To pause startup until the debugger is connected you can use

JAVA_DEBUG_OPTS='-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005' bin/karaf debug

For other options please check your JVM JPDA documentation. Hotspot JPDA: https://docs.oracle.com/javase/8/docs/technotes/guides/jpda/

Start the AMP server in the background using the following command

bin/start

The Karaf container will keep state such as installed bundles and configuration between restarts. To reset any changes add clean to the CLI arguments.

With RPM it is pretty much the same however there are a few things you have to prepare.

  1. Export variables set in /lib/systemd/system/amp.service. Variables which are by default there. export KARAF_HOME=/opt/amp KARAF_ETC=/etc/amp AMP_PERSISTENCE_DIR=/var/lib/amp
  2. cd /opt/amp
  3. sudo -u amp -E /opt/amp/bin/karaf debug
  4. As mentioned in previous paragraph use JAVA_DEBUG_OPTS to set additional options like block Java startup until debugger is attached.

Configuring

Configuration of AMP when running under Karaf is largely done through standard Karaf mechanisms.