Starting and stopping Petals ESB installed by Debian packages

Introduction

Once Petals ESB is installed through the Debian package, it can be started or stopped with two different ways:

  • at system level: the Petals ESB containers are running with a dedicated system user 'petals'. To use in production mode,
  • at user level: the Petals ESB containers are running as a process of the user that launches them. To use in a development mode.

Startup and shutdown operations are realized through the script or command 'petals-esb'. In following chapters we can find use-cases to explain how to use the script, and a reference guide about this script.

Contributors
No contributors found for: authors on selected page(s)

Starting Petals ESB

Starting Petals ESB at system level

Automatic startup

The Petals ESB package comes with an automatic startup script based on System V (initd) to automatically launch Petals ESB containers as system services when the host boots.
To start the Petals containers, for example, launch the following command on a Ubuntu box:

cdeneux@sph-latitude-D630:~$ sudo service petals-esb start

Two natures of containers are identified:

  • the "available containers" that are configured. These containers are to configure into the directory /etc/petals-esb/container-available. One sub-directory by container.
  • and, the "enable containers" that are automatically started. These containers are to configure into the directory /etc/petals-esb/container-enable. One sub-directory by container.

As "Enable containers" are a subset of "Available containers", we recommend to put the configuration of a container into a sub-directory of /etc/petals-esb/container-available, and create a symbolic link on this sub-directory into /etc/petals-esb/container-enable to "enable" it.

It's not possible to automatically start a container in debug mode. Use a manual startup.
The automatic startup starts all Petals ESB containers declared in the directory /etc/petals-esb/container-enable. So if you add a new Petals ESB container in this directory, and use the command "service petals-esb start", all other Petals ESB containers will be also started, and as they are already started, errors will occurs.

Manual startup

A Petals ESB container configured at system level (its configuration is located in /etc/petals-esb/container-available, and uses sub-directories of /var/lib/petals-esb and /var/log/petals-esb) can be started using a manual startup, for example, to test its configuration. This startup is done using the same mechanism as a Petals ESB container configured at user level, but using the system user 'petals' to be compliant with ACL of the filesystem:

sudo -u petals petals-esb -u <container-configuration>

where <container-configuration> is the URL of the container configuration (ie, URL locating the file server.properties)

For example, to launch the default sample container

sudo -u petals petals-esb -u file:///etc/petals-esb/container-available/default/server.properties
Note 1: When manually starting a Petals ESB container, it will be automatically stopped when closing your shell. Don't use this way to start a Petals ESB container as a system service.
Note 2: The command below uses the default JVM installed on your system. If it is not the right one, you can use a command line as following to specify the right JVM to use:
sudo -u petals JAVA_HOME=${HOME}/jdk1.6.0_45 petals-esb -u file:///etc/petals-esb/container-available/default/server.properties

Starting Petals ESB at user level

A Petals ESB container configured at user level (its full configuration is located under the user's home directory) can be only started using a manual startup:

petals-esb -u <container-configuration>

where <container-configuration> is the URL of the container configuration (ie, URL locating the file server.properties)

For example:

petals-esb -u file:///home/cdeneux/my-petals-esb-containers/demo1/server.properties
When manually starting a Petals ESB container, it will be automatically stopped when closing your shell.

Stopping Petals ESB

The process stopping a Petals ESB container reads the contents of its topology file to get the JMX credentials required to connect to the container and invoke a shutdown. The security to block a shutdown is based on filesystem ACLs of the configuration files of the container. So, don't forget to set the right ACL on these files.

Example: "me:my-group rw-r-----" for your container to authorize you (me) and all member of the group my-group) to shutdown the container.

Stopping Petals ESB at system level

Automatic stop

To stop the Petals containers started as system services uses the following command on a Ubuntu box, for example:

cdeneux@sph-latitude-D630:~$ sudo service petals-esb stop
The automatic stop stops all Petals ESB containers declared in the directory /etc/petals-esb/container-enable. So if you have removed a Petals ESB container in this directory since the last automatic startup, it will not be stopped. Use a manual stop to stop it.

Manual stop

Manual stop of a Petals ESB container automatically started

To stop a Petals ESB container started as system service use the following command:

sudo -u petals petals-esb -u <container-configuration> stop

where <container-configuration> is the URL of the container configuration (ie, URL locating the file server.properties)

For example, to stop the default sample container

sudo -u petals petals-esb -u file:///etc/petals-esb/container-available/default/server.properties stop

Manual stop of a Petals ESB container manually started

If you have manually started a Petals ESB container at system level, just kill it with a Ctrl-C on its console, or use the following command from another shell:

sudo -u petals petals-esb -u <container-configuration> stop

where <container-configuration> is the URL of the container configuration (ie, URL locating the file server.properties)

For example, to stop the default sample container

sudo -u petals petals-esb -u file:///etc/petals-esb/container-available/default/server.properties stop

Stopping Petals ESB at user level

To stop your Petals ESB container, just kill it with a Ctrl-C on its console, or use the following command from another shell:

petals-esb -u <container-configuration> stop

where <container-configuration> is the URL of the container configuration (ie, URL locating the file server.properties)

For example

petals-esb -u file:///home/cdeneux/my-petals-esb-containers/demo1/server.properties stop

Reference guide of script 'petals-esb'

This reference guide is also available as "man" page installed with the Debian package 'petals-esb'.

Synopsis

petals-esb -u container-cfg-url [stop] [-e]
petals-esb -h
petals-esb -V

Description

petals-esb is used to start and stop manually a Petals ESB container.

Options

Short option Long option Description
-e --error Print the extended error message (stack-trace).
-h --help Print usage.
-u container-cfg-url --url container-cfg-url The URL of the Petals container configuration to start or stop.
-V  --version Print the version number and exit. 
stop N/A Stop the local Petals ESB container.
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.