Skip to content

Health Checking and Readiness

PID

After the start of the application instance, Onteon checks if application instance process is alive by checking the PID. By default, it gets the PID of process defined in start.command property in configuration:

processProvider:
  name: 'GenericOsProcessProviderImpl'
  version: '1.0.0'
  executable:
    start:
      command: '${ont_app_path}/bin/bin/startup.sh'
      successLine: 'Tomcat started'

Onteon stores this PID in onteon-node-manager/log/app/<application_name>/<application_version>/<application_id>/<application_instance_id>/ONTEON_PID file.

If you want to provide your PID, you can do this by providing the command in getPid property:

processProvider:
  name: 'GenericOsProcessProviderImpl'
  version: '1.0.0'
  executable:
    start:
      command: '${ont_app_path}/bin/bin/startup.sh'
      successLine: 'Tomcat started'
      getPid: bash ps -ax | grep -m1 ${ont_app_path} | awk '{ print $1 }'        

Or you can provide the path to PID file in pidFilePath property:

processProvider:
  name: 'GenericOsProcessProviderImpl'
  version: '1.0.0'
  executable:
    start:
      command: '${ont_app_path}/bin/bin/startup.sh'
      successLine: 'Tomcat started'
      pidFilePath: '${ont_app_path}/CUSTOM_PID_FILE'      

Health Check Url

Health Check Url is another way of checking if the application instance process is alive. You can specify url in the application configuration file, in serviceRepository.healthCheckUrl property:

serviceRepository:
  healthCheckUrl: 'http://localhost:${ont_port_1}'

Application instance is considered as running if the specified url respond with status code 200.

Success Line

To determine if application instance started and is ready, you can use success line. Success line is a text that needs to appear in system out, during the startup. You can specify it in start.successLine property in application instance configuration file.

Application configuration file.

processProvider:
  name: 'GenericOsProcessProviderImpl'
  version: '1.0.0'
  executable:
    start:
      command: '${ont_app_path}/bin/bin/startup.sh'
      successLine: 'Tomcat started'    

Start of application instance.

root@c14d89d70df8:/opt/onteon# onteoncli application-instance start 0ccd378eb4dbba4b89a30858
start instance described by input:{instanceId=0ccd378eb4dbba4b89a30858, appId=6231b4d5eebebe2297c35e2e}
start instance described by appId:6231b4d5eebebe2297c35e2e, instanceId:0ccd378eb4dbba4b89a30858
Tomcat started.
process:tomcat2--1.0.0--6231b4d5eebebe2297c35e2e--0ccd378eb4dbba4b89a30858 with pid:'1247 was correctly started
resultType: SUCCESS
message:    Command executed successfully.