Monday, March 4, 2019

Leave a Comment
Starting your jBPM Business Application
as a Service
In addition to starting your jBPM Business
Application generated via start.jbpm.org using the
provided launch scripts, for example:
./launch.sh clean install for unix
or launch.bat clean install for windows,
you can also start and manage your business
application as a service. This provides you with
extra control of your app especially in production
environments.
Weather you are on Unix based system, Windows,
or OSX the first step is to configure the business
application to generate a fully executable jar. To do
this locate your service  module of your business
app and modify its  pom.xml  to configure
the spring-boot-maven-plugin  as follows:
With this configuration building your business app
will produce a fully executable jar.
Now let's see how we can start the business app as
a service under different operating systems.
1. Unix/Linux Service
Here we have two options, using init.d
or systemd .
a) To install our business app as an init.d service
we need to create symlink to our executable jar, for
example (using the default setup on
start.jbpm.org):
sudo ln -s ~/business-application/business-application-service/target/
business-application-service-1.0.SNAPSHOT.jar
/etc/init.d/
business-application-service-1.0.SNAPSHOT.jar
after this you can start your business app with for
example:
service
business-application-service-1.0.SNAPSHOT.jar start
b) To install our business app as a systemd service
we need to create a script
called business-application-service-1.0.SNAPSHOT.service
in the on-service-1.0.SNAPS directory (again
we assume the default business app setup, the
actual name has to reflect the real app name you
have created during app creation on
start.jbpm.org).
The script could look as follows:
[Unit]
Description=
business-application-service-1.0.SNAPSHOT
After=syslog.target
[Service]
User=
business-application-service-1.0.SNAPSHOT
ExecStart=
~/business-application/business-application-service/target/
business-application-service-1.0.SNAPSHOT.jar
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
Don't forget to change the description, user and
execstart parameters to match your installation.
Now we can tell systemd to start our business app
on system boot with for example:
systemctl enable
business-application-service-1.0.SNAPSHOT.service
2. Windows Service
You can start your business application as a
Windows service using winsw command. For
details on how to do this please read detailed
instructions on https://github.com/snicoll/spring-
boot-daemon .
3. OSX Service
If you are on OSX, you can use the launchctl
command. To get started first we need to create
our launch configuration
under ~/Library/LaunchAgents directory. So
let's create a launch config file
called business-application-service-1.0.SNAPSHOT.plist
which can look as follows (again, assuming the
default generation settings):
With the launch config created log out with your
current user and log back in. Your business
application has been started and you can right away
access it under locahost:8090 in your browser.
You can manage your business app service at this
point using the launchctl command. For example
to stop our business app service we would run:
launchctl stop business-application-service-1.0-SNAPSHOT
and to stop our business application from being
started automatically on system startup/login we
can simply remove our launch configuration .plist
file from ~/Library/LaunchAgents directory.
Hope this information is useful to some of you guys
when choosing options on how to launch/deploy/
manage your jBPM Business Applications.
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment