Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Table of Contents
outlinh1. true
outlinh1. true
1printablefalse
2stylh1. none
3indent20px

...

Universal Agent Batch Installer Job Chain

 

universal_agent_installer.job_chain.xml

The job chain for update/installation of one Agent has the nodes:

  • CheckPreRequisite
    • Checking for the correct java version >= 1.8
    • Checking whether JobScheduler Universal Agent already has been installed.
      • If so
        • Shutting down a probably running instance
        • remove the installation
  • TransferInstallaionSetup: To transfer the setup jar file to the host
    • Before the transfer starts, the preprocessor will create the instancescript.sh from the template jobscheduler_agent_instance_script.txt
    • The files, that will be transerfered are specified in globals/transfer/file_spec=.*\.(sh|gz)$

    • With this regular expression, these files will be transfered
      • The JobScheduler Universal Agent: jobscheduler_unix_universal_agent.1.11.0-SNAPSHOT.tar.gz
      • The instancescript: jobscheduler_agent_<port>.sh
      • The installation scipt: jobscheduler_universal_agent_install.sh
  • PerformInstall: To start the installation using SSH.
    • The in the step before transfered installation script will be executed
    • The installation script will install and start the JobScheduler Universal Agent
    • Finally the postprocessing commands will be executed
      • The postprocessing commands are stored in installation/postprocessing/command
      • Three commands will be executed
        • if you have more than three commands, please add the call in the job PerformInstall
      • The default commands will setup the autostart for JobScheduler Universal Agent on an Ubuntu server
        • echo ${ssh.sudo_password} | sudo -S cp ${install_path}/bin/jobscheduler_agent.sh /etc/init.d/jobscheduler
        • echo ${ssh.sudo_password} | sudo -S update-rc.d jobscheduler defaults

Parameters

All jobs have access to the following parameters. These parameters also will be used for the JobScheduler Universal Agent instance script to the options for the start.

 

definitin

Code Block
languagexml
collapsetrue
<job_chain  name="universal_agent_installer">
    <job_chain_node  state="CheckPreRequisite" job="CheckPreRequisite" next_state="TransferInstallationSetup" error_state="error"/>
    <job_chain_node  state="TransferInstallationSetup" job="TransferInstallationSetup" next_state="PerformInstall" error_state="error"/>
    <job_chain_node  state="PerformInstall" job="PerformInstall" next_state="success" error_state="error" on_error="suspend"/>
    <job_chain_node  state="success"/>
    <job_chain_node  state="error"/>
</job_chain>

 

Image Added

The job chain for update/installation of one Agent has the nodes:

  • CheckPreRequisite
    • Checking for the correct java version >= 1.8
    • Checking whether JobScheduler Universal Agent already has been installed.
      • If so
        • Shutting down a probably running instance
        • remove the installation
  • TransferInstallaionSetup: To transfer the setup jar file to the host
    • Before the transfer starts, the preprocessor will create the instancescript.sh from the template jobscheduler_agent_instance_script.txt
    • The files, that will be transerfered are specified in globals/transfer/file_spec=.*\.(sh|gz)$

    • With this regular expression, these files will be transfered
      • The JobScheduler Universal Agent: jobscheduler_unix_universal_agent.1.11.0-SNAPSHOT.tar.gz
      • The instancescript: jobscheduler_agent_<port>.sh
      • The installation scipt: jobscheduler_universal_agent_install.sh
  • PerformInstall: To start the installation using SSH.
    • The in the step before transfered installation script will be executed
    • The installation script will install and start the JobScheduler Universal Agent
    • Finally the postprocessing commands will be executed
      • The postprocessing commands are stored in installation/postprocessing/command
      • Three commands will be executed
        • if you have more than three commands, please add the call in the job PerformInstall
      • The default commands will setup the autostart for JobScheduler Universal Agent on an Ubuntu server
        • echo ${ssh.sudo_password} | sudo -S cp ${install_path}/bin/jobscheduler_agent.sh /etc/init.d/jobscheduler
        • echo ${ssh.sudo_password} | sudo -S update-rc.d jobscheduler defaults

Parameters

All jobs have access to the following parameters. These parameters also will be used for the JobScheduler Universal Agent instance script to the options for the start.

 

 killscript
ParameterDescriptionXML
agent_options.scheduler_ip_address
The ip address of the JobScheduler Universal Agents hostinstallation/agent_options/scheduler_ip_address
agent_options.scheduler_http_port
The port of the JobScheduler Universal Agent
ParameterDescriptionXML
agent_options.scheduler_ip_address
The ip address of the JobScheduler Universal Agents hostinstallation/agent_options/scheduler_ip_address
agent_options.scheduler_http_port
The port of the JobScheduler Universal Agentinstallation/agent_options/scheduler_http_port
agent_options.java_home
 installation/agent_options/java_home
agent_options.java_options
 installation/agent_options/java_options
agent_options.scheduler_home

If SCHEDULER_HOME is not set, the default will be set.

Default: install_path + "/jobscheduler_agent"

installation/agent_options/scheduler_home
agent_options.scheduler_user
 installation/agent_options/scheduler_user
agent_options.scheduler_log_dir
 installation/agent_options/scheduler_log_dir
agent_options.scheduler_kill_script
installation/agent_options/scheduler_http_port
agent_options.scheduler_pid_file_dirjava_home
 installation/agent_options/schedulerjava_pid_file_dir
host
The ssh ip address of the JobScheduler Universal Agents hostinstallation/ssh/host
port
The ssh port of the JobScheduler Universal Agentinstallation/ssh/port
user
The ssh user of the JobScheduler Universal Agentinstallation/ssh/user
auth_method
The ssh auth method of the JobScheduler Universal Agentinstallation/ssh/auth_method
auth_file
The ssh auth file of the JobScheduler Universal Agentinstallation/ssh/auth_file
password
The ssh password  of the JobScheduler Universal Agentinstallation/ssh/password
sudo_password
The sudo password for ssh userinstallation/ssh/sudo_password
install_path
The folder, where JobScheduler Universal Agent will be installedinstallation/install_path

 

TransferInstallationSetup

home
agent_options.java_options
 installation/agent_options/java_options
agent_options.scheduler_home

If SCHEDULER_HOME is not set, the default will be set.

Default: install_path + "/jobscheduler_agent"

installation/agent_options/scheduler_home
agent_options.scheduler_user
 installation/agent_options/scheduler_user
agent_options.scheduler_log_dir
 installation/agent_options/scheduler_log_dir
agent_options.scheduler_kill_script
 installation/agent_options/scheduler_kill_script
agent_options.scheduler_pid_file_dir
 installation/agent_options/scheduler_pid_file_dir
host
The ssh ip address of the JobScheduler Universal Agents hostinstallation/ssh/host
port
The ssh port of the JobScheduler Universal Agentinstallation/ssh/port
user
The ssh user of the JobScheduler Universal Agentinstallation/ssh/user
auth_method
The ssh auth method of the JobScheduler Universal Agentinstallation/ssh/auth_method
auth_file
The ssh auth file of the JobScheduler Universal Agentinstallation/ssh/auth_file
password
The ssh password  of the JobScheduler Universal Agentinstallation/ssh/password
sudo_password
The sudo password for ssh userinstallation/ssh/sudo_password
install_path
The folder, where JobScheduler Universal Agent will be installedinstallation/install_path

 

TransferInstallationSetup

For more detailed explanation of the parameters have a look at the yade documentaiton.

...

  1. copy the content of the live folder to the live folder of a JobScheduler instance
  2. copy the content of the folder batch_install to any folder
  3. create an installation input file
  4. adjust the parameter values for the job AgentBatchInstaller
  5. set the name for settings file in the installation input file (globals/transfer/settings)
  6. create the YADE settings file
    1. Add <ProtocolFragments> for each host you want install JobScheduler Universal Agent
    2. Add a <Profile> for each host you want install JobScheduler Universal Agent.

Files

The Zip file for the JobScheduler Universal Agent batch installer contains

Folder batch_install_universal_agent

Folder batch_install_universal_agent contains the configuration files for the job chain and jobs that will provide the batch installer for the JobScheduler Universal Agent

AgentBatchInstaller.job.xml

Contains the configuration for the batch installer starter job. The job will read the batch installation file that contains an entry for each Agent and create an order for the batch installer job chain for each Agent that should be installed/updated

Code Block
languagexml
collapsetrue
<job  name="BatchInstaller">
    <params >
        <param  name="installation_definition_file" value="c:\temp\batchinstall.xml"/>
        <param  name="filter_install_host" value=""/>
        <param  name="filter_install_port" value=""/>
        <param  name="installation_job_chain" value="/batch_install_universal_agent/universal_agent_installer"/>
        <param  name="update" value="true"/>
    </params>
    <script  language="java" java_class_path="" java_class="com.sos.jitl.agentbatchinstaller.JSUniversalAgentBatchInstallerJSAdapterClass"/>
    <run_time />
</job>

 

CheckPreRequisite.job.xml

Contains the configuration for the job that checks the prerequisites.

The job is implemented by the JITL SSH job. The script that will be exexuted to check the prerequisites is defined in the script tag of the job.

 

Code Block
languagexml
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>
<job  title="Launch remote commands or executable files by SSH" order="yes" stop_on_error="no">
    <description >
        <include  file="jobs/JobSchedulerSSHJob.xml"/>
    </description>
    <params />
    <script  language="java" java_class="sos.scheduler.job.SOSSSHJob2JSAdapter">
        <![CDATA[
echo .JobScheduler Universal Agent
echo .checking prerequisites ${install_path}
echo .checking Java Runtime Version >= 1.8? ......
JAVA_VER=$(java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')
if [ "$JAVA_VER" > "18" ]
then
  echo ..java version: $JAVA_VER ok
else
  echo ..wrong Java version found
  echo ..expectet version is >= 1.8
  echo ..installed version is $JAVA_VER
  exit 8
fi
echo .checking whether JobScheduler Universal Agent is already installed?
if [ -f ${install_path}/jobscheduler_agent/bin/jobscheduler_agent.sh ]
then
  echo ..JobScheduler Universal Agent already installed
  echo ..shutting down JobScheduler Universal Agent 
  ${install_path}/jobscheduler_agent/bin/jobscheduler_agent.sh stop
  echo ..removing installation from  ${install_path}
  rm -Rf ${install_path}/lib
else
  echo .. this is the first installation of JobScheduler Universal Agent 
fi
exit $?
        ]]>
    </script>
    <run_time />
</job>

TransferInstallationSetup.job.xml

Contains the configuration for the job that transfers the installation files.

The job is implemented by the JITL YADE job.

 

Code Block
languagexml
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>
<job  title="API Job for JobScheduler Advanced Data Exchange" order="yes" stop_on_error="no">
    <description >
        <include  file="jobs/jadeJob.xml"/>
    </description>
    <environment >
        <variable  name="test" value="1"/>
    </environment>
    <script  language="java" java_class="sos.scheduler.jade.JadeJob"/>
    <run_time />
</job>

 

PerformInstall.job.xml

Contains the configuration for the job that executes the installation of the JobScheduler Universal Agent

The job is implemented by the JITL ssh job.

Code Block
languagexml
collapsetrue
<job  title="Launch remote commands or executable files by SSH" order="yes" stop_on_error="no" name="PerformInstall">
    <description >
        <include  file="jobs/JobSchedulerSSHJob.xml"/>
    </description>

    <params />

    <script  language="java" java_class="sos.scheduler.job.SOSSSHJob2JSAdapter">
        <![CDATA[
echo Executing PerformInstall ${target_dir}
chmod a+x ${target_dir}/jobscheduler_universal_agent_install.sh
${target_dir}/jobscheduler_universal_agent_install.sh -d${install_path}

test -z "${command_1}" || "${command_1}"
rc=$?
test $rc -eq 0 && test -z "${command_2}" || "${command_2}"
rc=$?
test $rc -eq 0 && test -z "${command_3}" || "${command_3}"

exit $?
        ]]>
    </script>

    <monitor  name="templateProcessor" ordering="1">
        <script  language="java:javascript">
            <![CDATA[
function spooler_process_before(){
  var order = spooler_task.order;
  var source_dir = order.params.value("PerformInstall/source_dir");
  var scheduler_http_port = order.params.value("scheduler_http_port");

  var templateProcessor = new Packages.com.sos.jitl.agentbatchinstaller.JSUniversalAgentBatchInstallerProcessTemplate();
  templateProcessor.execute(source_dir+"/jobscheduler_agent_instance_script.txt",source_dir+"/jobscheduler_agent_" + scheduler_http_port + ".sh",spooler_task.order.delegate);
  return true;
}
            ]]>
        </script>
    </monitor>

    <run_time />
</job>

 

 

installation_definition_file

Code Block
<?xml version="1.0" encoding="ISO-8859-1"?>
<job >
    <params >
        <param  name="installation_definition_file" value="c:\temp\batchinstall.xml"/>
        <param  name="filter_install_host" value=""/>
        <param  name="filter_install_port" value=""/>
        <param  name="installation_job_chain" value="/batch_install_universal_agent/universal_agent_installer"/>
        <param  name="update" value="true"/>
    </params>
    <script  language="java" java_class_path="" java_class="com.sos.jitl.agentbatchinstaller.JSUniversalAgentBatchInstallerJSAdapterClass"/>
    <run_time />
</job>

 

PerformInstall.job.xml

Contains the configuration for the job that executes the installation.

The job is implemented by the JITL SSH job. The script that will be exexuted to check the prerequisites is defined in the script tag of the job. The order has the following parameters for this step.

 

installation_definition_file

Code Block
<?xml version="1.0" encoding="ISO-8859-1"?>
<job >
    <params >
        <param  name="installation_definition_file" value="c:\temp\batchinstall.xml"/>
        <param  name="filter_install_host" value=""/>
        <param  name="filter_install_port" value=""/>
        <param  name="installation_job_chain" value="/batch_install_universal_agent/universal_agent_installer"/>01
        <param  name="update" value="true"/>
    </params>
    <script  language="java" java_class_path="" java_class="com.sos.jitl.agentbatchinstaller.JSUniversalAgentBatchInstallerJSAdapterClass"/>
    <run_time />
</job>

 

Folder setup

The folder setup contains the files that will be transfered to the Agents server during the installation process

Installation script

Template for the instance script

The JobScheduler Universal Agent

 

Job Chain

Job Batch Installer

XSD for installation input file

You will find the xsd-schema for the configuration in config/scheduler_universal_agent_installations.xsd

 

Code Block
languagexml
            <command>echo ${ssh.sudo_password} | sudo cp ${install_path}/bin/jobscheduler_agent.sh /etc/init.d/jobscheduler</command>

 

 

 

 

 

 

  1. the installation input file (globals/transfer/settings)
  2. create the YADE settings file
    1. Add <ProtocolFragments> for each host you want install JobScheduler Universal Agent
    2. Add a <Profile> for each host you want install JobScheduler Universal Agent.

 <?xml version="1.0" encoding="utf-8"?>
<installations lastRun="2015-11-06 15:11">
  <globals>
    <transfer>
      <settings><![CDATA[C:\Temp\batch_install\yade_agent_batch_installer_settings.ini]]></settings>
    </transfer>
  </globals>
  <installation lastRun="2015-11-06 15:11">
    <install_path><![CDATA[/home/test/temp/xxx]]></install_path>
    <agent_options>
      <scheduler_http_port>4445</scheduler_http_port>
      <scheduler_ip_address><![CDATA[192.11.0.116]]></scheduler_ip_address>
    </agent_options>
    <ssh>
      <user><![CDATA[test]]></user>
      <password><![CDATA[12345]]></password>
      <sudo_password><![CDATA[12345]]></sudo_password>
      <auth_method><![CDATA[password]]></auth_method>
      <port><![CDATA[22]]></port>
    </ssh>
    <postprocessing>
      <command><![CDATA[echo ${ssh.sudo_password} | sudo cp ${install_path}/bin/jobscheduler_agent.sh /etc/init.d/jobscheduler]]></command>
      <command><![CDATA[echo ${ssh.sudo_password} | sudo update-rc.d jobscheduler defaults]]></command>
    </postprocessing>
  </installation>
</installations>