1. Home
  2. Custom Installation
  3. Install Method 2 – Using bundled Tomcat Server as an Operating System Service

Install Method 2 – Using bundled Tomcat Server as an Operating System Service

In this method we will start and run Falcon Deploy web application as an operating system service using the Tomcat Server bundled with Falcon Deploy WAR file. This method does not require you to install or configure Tomcat or any other webserver or servlet container.

Note

Please ensure you have completed the steps listed in the Pre-Install document.

Pre-Installation Checklist

The checks below are done as falcon user.

Ensure FALCON_HOMEORACLE_HOMELD_LIBRARY_PATHJAVA_HOME environment variables are set.

# Check that you are logged in as 'falcon' user
> id
uid=11777(falcon) gid=11777(deploy) groups=11777(deploy),10(wheel)

# Check FALCON_HOME is set.
> echo $FALCON_HOME
/falcon_deploy/app

# Check ORACLE_HOME is set.
echo $ORACLE_HOME
/u01/app/oracle/product/instantclient_12_2

# Check LD_LIBRARY_PATH is set.
echo $LD_LIBRARY_PATH
/u01/app/oracle/product/instantclient_12_2

# Check JAVA_HOME is set.
echo $JAVA_HOME
/usr/lib/jvm/jre

If FALCON_HOME does not return the above value, refer to pre-installation document to complete the setup.

Next, ensure sqlplus is in the path.

> sqlplus

SQL*Plus: Release 12.2.0.1.0 Production on Wed Oct 17 17:39:49 2018

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Enter user-name:

If sqlplus is not working, check that you have completed the Oracle Client installation. If you have installed the Oracle full client it comes with sqlplus and is usually in the $ORACLE_HOME/bin directory. If you have installed the Oracle Instant Client, you have to download and install sqlplus separately. In this case, sqlplus can be in the root folder of $ORACLE_HOME.

Next, ensure java is in the path.

> java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

Copy the downloaded falcon-deploy-ver.war to FALCON_HOME directory on the server. Once copied, update the permission of the WAR file. This step ensures WAR is executable and is accessible only to falcon user and deploy group.

> cd /falcon_deploy/app
> ls -ltr
-rwxr--r-- 1 root deploy 53387165 Oct 23 17:25 falcon-deploy-1.0.war

> sudo chown falcon:deploy falcon-deploy-1.0.war
> sudo chmod 770 falcon-deploy-1.0.war
> ls -ltr falcon-deploy-1.0.war
-rwxrwx--- 1 falcon deploy 53387165 Oct 23 17:25 falcon-deploy-1.0.war

Install and run using bundled Tomcat Server as an Operating System Service

The steps below are for a Linux operating system. Refer to your operating system manual for equivalent steps or commands.

Falcon Deploy can be installed and run as a Unix/Linux service using init.d or systemd. This method makes it very easy to install and manage Falcon Deploy in production environments.

Here, we cover installation as a systemd service. This method is the successor to the popular init system and is now being used by many modern Linux distributions.

Falcon Service

Create a file named falcon.service in /etc/systemd/system directory. Here is an example configuration. The service can accept a wide variety of configuration. Refer to your operating system manual page for customizing your configuration.

[Unit]
Description=Falcon Deploy
After=syslog.target network.target

[Service]
User=falcon
Group=deploy

Environment=ORACLE_HOME=/u01/app/oracle/product/instantclient_12_2
Environment=LD_LIBRARY_PATH=/u01/app/oracle/product/instantclient_12_2
Environment=FALCON_HOME=/falcon_deploy/app
Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -server -Xms512m -Xmx1024m -XX:+UseParallelGC'
ExecStart=/falcon_deploy/app/falcon-deploy-1.0.war
SuccessExitStatus=143

UMask=2007

[Install]
WantedBy=multi-user.target
Note

The environment variables ORACLE_HOME, LD_LIBRARY_PATH, FALCON_HOME, JAVA_HOME are required in systemd configuration even if you have them in environment variable files like .bash_profile. If you omit the environment variables, the application may fail to start or deployments may fail with empty logs.

systemd options

  • Description – A free-form string describing the unit. This is intended for use in UIs to show descriptive information along with the unit name. The description should contain a meaningful name usually describing the service.
  • After – This option ensures that the configured unit is started after the listed unit finished starting up.
  • User ‐ The operating system user.
  • Group ‐ The operating system group.
  • Environment – ORACLE_HOME ‐ The location of the installed Oracle Client software.
  • Environment – LD_LIBRARY_PATH ‐ The location of the installed Oracle Client software libraries.
  • Environment – FALCON_HOME ‐ This parameter is required for successful startup of the application.
  • Environment – JAVA_HOME ‐ The location of JRE. This can also be the JDK home path.
  • Environment – JAVA_OPTS ‐ Here we specify the Java virtual machine (JVM) options. These are recommended and some are for optimal performance of the Java application. You may have to adjust the -Xms(Initial Java heap size) and -Xmx(Maximum Java heap size) based on the available RAM and the load on the system.
  • ExecStart ‐ Command that is executed when this service starts.
  • SuccessExitStatus ‐ Takes a list of exit status definitions that, when returned by the main service process, will be considered successful termination. This is in addition to the normal successful exit code 0 and the signals SIGHUP, SIGINT, SIGTERM, and SIGPIPE.
  • UMask ‐ Set the umask to 2007 so all files created in the falcon_deploy* directories have the group set to deploy and no permissions to users outside the group.
  • WantedBy ‐ Units that require this service unit. Most daemons are grouped under multi-user.target, and it requires basic.target to be up. This means that all services grouped under basic.target will be started before the ones in multi-user.target

The common configuration items are configured in the generic [Unit] and [Install] sections. The service specific configuration options are configured in the [Service] section.

Notify systemd of new service file

After service is configured, we have to notify systemd of new service file. Execute the below command to complete the notification.

> sudo systemctl daemon-reload

Enable Autostart

Enable auto start on system boot.

> sudo systemctl enable falcon.service

Start Falcon Service

As falcon user, start the service and check the output for successful startup of the service.

# Start the service                                            
> sudo systemctl start falcon.service

# Check the service status
> sudo systemctl status falcon.service
● falcon.service - Falcon Deploy
   Loaded: loaded (/etc/systemd/system/falcon.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2018-10-17 21:40:46 UTC; 22min ago
 Main PID: 5837 (falcon-deploy-1.0.war)
   CGroup: /system.slice/falcon.service
           ├─5837 /bin/bash /falcon_deploy/app/falcon-deploy-1.0.war
           └─5851 /usr/bin/java -Dsun.misc.URLClassPath.disableJarChecking=true -jar /falcon_deploy/app/falcon-deploy-1.0.war

# Check the log
> sudo journalctl -f -u falcon.service
Oct 17 21:40:46 ip-10-0-1-248.ec2.internal systemd[1]: Started Falcon Deploy.
Oct 17 21:40:46 ip-10-0-1-248.ec2.internal systemd[1]: Starting Falcon Deploy...
Oct 17 21:40:49 ip-10-0-1-248.ec2.internal falcon-deploy-1.0.war[5837]: 21:40:49.138 [main] INFO  com.Falcon.FalconApplication - Starting FalconApplication v1.0 on ip-10-0-1-248.ec2.internal with PID 5851 (/falcon_deploy/app/falcon-deploy-1.0.war started by falcon in /falcon_deploy/app)
Oct 17 21:41:00 ip-10-0-1-248.ec2.internal falcon-deploy-1.0.war[5837]: 21:41:00.054 [main] INFO  com.Falcon.FalconApplication - Started FalconApplication in 12.15 seconds (JVM running for 13.645)

You can use the following commands to start/stop the falcon service.

> sudo systemctl start falcon.service
> sudo systemctl stop falcon.service
> sudo systemctl restart falcon.service
> sudo systemctl status falcon.service

Log file

To check the console log, use

# To check the console log, use
> sudo journalctl --unit=falcon

# To see real time logs, use the -f option.
> sudo journalctl -f -u falcon.service

# Use -n to specify the number of lines to view in the log.
> sudo journalctl -f -n 1000 -u falcon.service

The commands above give the console log and may be useful to debug if application does not start. To view logs from Falcon Deploy applicaiton, check the log file at $FALCON_HOME/log/falconDeploy.log.

Validation

Open a web browser and enter the address – the server and port where application is running. The address is of the form hostname:8080 or ip_address:8080

This will launch the Falcon Deploy Installation and Configuration (Helper) application. If you see this screen, the installation is successful.

Post Install Step

Refer to the Post-Install document to complete the Falcon Deploy Installation and Configuration (Helper) Application. It is a mini web application bundled with Falcon Deploy application to help you complete the configurations with ease.

Updated on March 13, 2019

Related Articles