Versions Compared

Key

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

Table of Contents

Introduction

The Packaging Script is used in the JS7 - Deployment process for on-premises installations in a JS7 - Deployment Area

  • to install JS7 components products such as JOC Cockpit, Controller, Agent in a temporary environment,
  • to create .tar..gz tarball packages Deployment Packages of the JS7 componentsproducts' installation and configuration directories created during installation,
  • to create a Deployment Script per JS7 componentproduct. The script is later on used to deploy the packages to target machineshosts.

Packaging Script

The Packaging Script is provided for download and can be used to automate installation, updates, upgrades and patches of JS7 Controllersproducts such as JOC Cockpit, Controller and Agents.

  • The script is available for Linux , MacOSand MacOS® and AIX® using bash, dash, ksh and zsh POSIX-compatible shells. 
  • The script script expects a JS7 - Deployment Descriptor file in .json format that specifies the JS7 products, the installation options, configuration options and deployment options.
  • The script creates
    • the run_install_agent.sh, run_install_controller_instance.sh Instance Start Script in the Controller's bin directory if no such file exists,the controller.service systemd Service File in the Controller instance's bin directory, see JS7 - systemd Service Files for automated Startup and Shutdown with Unix Systems.sh, run_install_joc.sh Installer Wrapper Scripts that parameterize installation of the JS7 products,
    • the run_deploy_agent.sh, run_deploy_controller.sh, run_deploy_joc.sh Deployment Scripts that are used to extract Deployment Packages on target hosts.
    • the run_rollout_agent.sh, run_rollout_controller.sh, run_rollout_joc.sh Rollout Scripts that are used to transfer tarball Deployment Packages to target hosts and to execute Deployment Scripts.
    • the js7_import.tar.gz archive for import by JOC Cockpit. The archive includes
      • the JS7 - Deployment Workflow including a calendar and schedule for import with the Configuration view. The objects can be used for automated rollout of Deployment Packages.
      • the Agent configuration of the Deployment Descriptor for import with the Manage Controllers/Agents view.
  • Find details about the directories and files created by the Packaging Script see JS7 - Deployment Area - Directory Layout.
  • The script terminates with exit code 0 to signal success, with exit code 1 for command line argument errors and with other exit code 2 codes for non-recoverable errors.
  • The script is intended as a baseline example for customization of JS7 by JS7 users and by SOS within the scope of professional services.Refer also to information in the  JS7 - Controller Command Line Operation article

Prerequisites

The Packaging Script requires the jq utility and OpenSSL to be available from the operating system. 

Version 1.6 of jq for Linux is available from the js7_deploy.tar.gz archive, see JS7 - Download, and ships with the MIT license, see https://opensource.org/licenses/MIT.

Download

Find the Controller Installer Packaging Script for download from from JS7 - Download.

Usage

Invoking the Packaging Script without arguments displays the usage clause:

Code Block
titleDeployment Packaging Script js7_create_deployment_package.sh
Usage: js7_create_deployment_package.sh [Options] [Switches]

   Options:
    --deploy-desc=<file>               | required: path to a deployment descriptor file
    --deployconfig-dir=<directory>           | required: path to the deploymentconfiguration source directory, default: ../deployconfig
    --work-dir=<directory>             | required: path to the deployment working directory directory, default: ../work
    --archive-dir=<directory>          | required: path to the deployment archive directory directoryarchive directory, default: ../archive
    --release-dir=<directory>          | required: path to release directory holding JS7 installation files, default: ../archiverelease
    --script-dir=<directory>           | optional: path to the script directory directory, default: ../bin
    --deploy-agent-id=<identifier>     | requiredoptional: Agent ID executing the deployment workflow, default: primaryAgent
    --agent-id=<identifier><id[,id]>               | optional: list limitsof Agent processingIDs to awhich processing specificwill Agentbe IDlimited
    --controller-id=<identifier><id[,id]>          | optional: limits processing to a specific Controller ID list of Controller IDs to which processing will be limited
    --joc-instance-id=<id[,id]>        | optional: list of JOC Cockpit Instance IDs to which processing will be limited
    --workflow-parallelism=<number>    | optional: limitsmax. parallel processes in deployment workflow, default: 100
    --workflow-timezone=<number><identifier>       | optional: specifies time zone of the deployment workflow, default: Etc/UTC
    --log-dir=<directory>              | optional: log directory for log output of this script

  Switches:
    -h | --help                        | displays usage
    --force-sudo                       | forces use of sudo for operations on directories
    --dry-run                          | createcreates install scriptscripts without running the script
    --keepmake-scriptdirs                        | keep install script in archive directorycreates the specified directories if they do not exist
    --keep-work                        | keepkeeps temporary installationinstallations in work directory
    --show-logs                        | shows log output of the script

...

Options

  • --deploy-desc
    • Specifies the path to the .json file that holds the JS7 - Deployment Descriptor.
    • Deployment Descriptors specify which JS7 products should be installed and which installation and configuration options should be used the directory in which the Controller should be installed.
  • --deployconfig-dir
    • Specifies the directory in which the Controller data such as configuration files should be storedtop-level directory holding configuration files that will be copied to an Agent, Controller or JOC Cockpit installation..
    • By default the <home>/var directory ../config directory is used, see option --homesee JS7 - Deployment Area.
  • --work-dir
    • Specifies the directory from which the Controller reads configuration filesthat holds the working area to temporarily install JS7 products.
    • By default the <data>../configwork directory is used, see option --data see JS7 - Deployment Area.
  • --archive-dir
    • Specifies the directory to which deployment packages are stored.
    • By default the ../archive directory is used, see JS7 - Deployment Server.
  • --archiverelease-dir
    • Specifies the directory from in which the Controller reads configuration files..tar.gz installer files for JS7 releases are stored.
    • By default the ../release directory is used, see JS7 - Deployment Area.
  • ----script-dir
  • ---deploy-agent-id
    • Specifies the directory from which the Controller reads configuration filesthe name of the Agent that should execute jobs in the Deployment Workflow.
    • This information will be added to the Deployment Workflow and can be changed later on in JOC Cockpit.
  • --agent-id
    • Selects the Agent IDs available from the Deployment Descriptor file to which creation of Deployment Packages should be limited.
    • If more than one Agent ID is specified the Agent IDs are separated by comma.
  • --agentcontroller-id
    • Selects the Controller IDs of Controllers available from the Deployment Descriptor file to which creation of Deployment Packages should be limited.
    • If more than one Controller ID is specified the Controller IDs are separated by comma.
    • Note that in a Controller Cluster its members use the same Controller ID, therefore Deployment Packages are created for all membersSpecifies the directory from which the Controller reads configuration files.
  • --controllerjoc-instance-id
    • Selects the JOC Cockpit Instance IDs available from the Deployment Descriptor file to which creation of Deployment Packages should be limited. Typically Instance IDs are given as numbers in ascending order.
    • If more than one JOC Cockpit Instance ID is specified the JOC Cockpit Instance IDs are separated by comma, for example --joc-instance-id=1,2.
    • Note that in a JOC Cockpit Cluster its members use the same JOC Cockpit Instance ID, therefore Deployment Packages are created for all membersSpecifies the directory from which the Controller reads configuration files.
  • --workflow-parallelism
    • Specifies the directory from which the Controller reads configuration filesmax. number of parallel deployments that should be executed by the Deployment Workflow.
    • By default up to 100 parallel deployments are performed.
  • --workflow-timezone
    • Specifies the time zone that will be applied to the Deployment Workflow. The time zone is relevant should users wish to modify the included deployment job for consideration of JS7 - Admission Times for Jobs.
  • --log-dir
    • If a log directory is specified then the Packaging Script will log information about processing steps to a log file in this directory.
    • File names are created according to the pattern: deployment_package.<deployment-descriptor>.<hostname>.<yyyy>-<MM>-<dd>T<hh>-<mm>-<ss>.log
    • For example: deployment_package.agent-http-20221204.centostest_primary.2022-12-19T20-50-45.log
    • The --log-dir option is forwarded to the installer scripts that will create individual log files in this directory directory from which the Controller reads configuration files.

Switches

  • -h | --help
    • Displays usage.
  • --force-sudo
    • Forces sudo to be used for installation and deployment. This is required if an existing installation is owned by different account or if the installation should be performed for a different account.
    • This switch requires sudo permissions for the account that runs the Packaging Script.
  • --dry-run
    • Performs a dry-run
    • that will not create Deployment Packages but will create Installer Wrapper Scripts for JS7 products only.
    • The wrapper scripts will make use of configuration items specified with the Deployment Descriptor and will parameterize execution of the Installer Scripts, see JS7 - Automated Installation and UpdateDisplays the log output created by the script.
  • --keep-scriptwork
    • Specifies that temporary installations of JS7 products in the working area will not be removed but will remain in place to allow checking the installation and configuration options in place.
  • --make-dirs
    • If directories are missing that are indicated with the --home, --backup-dir or --log-dir options then they will be created
    • Displays the log output created by the script.
  • --keepshow-worklogs
    • Displays the log output created by the script if the --log-dir option is used.
    • The --show-logs
    • Displays the log output created by the script option is forwarded to the installer scripts that will display individually created log files if the --log-dir option is used.

Examples

The following examples illustrate typical use cases.

Create Deployment Package

Code Block
titleExample for use of Packaging Script
linenumberstrue
. ./env.sh

./bin/js7_create_deployment_package.sh \
    --deploy-desc=${DEP_DESC}/standalone/standalone-agent-http-https-202212042022-12-04.descriptor.json

# initializes deployment environment variables
# makes use of the indicated deploymentDeployment descriptorDescriptor file that holds configuration items for a number of Agents
# creates works with default values for the location of the work area and of the homearchive directory if it does not existto which Deployment Packages will be stored

Perform dry-run to receive Wrapper Scripts

Code Block
titleExample for use of Packaging Script
linenumberstrue
. ./env.sh

./bin/js7_create_deployment_package.sh \
    --deploy-desc=${DEP_DESC}/standalone/standalone-agent-https-20221204http-2022-12-04.descriptor.json \
    --keep-script \
    --dry-run

dry-run

# initializes deployment environment variables
# makes use of the indicated deploymentDeployment descriptorDescriptor file that holds configuration items for a number of Agents
# performs a dry-run that will not create packagesDeployment Packages but will generate wrapper scripts that parameterize calls to the Installer Scripts
# works with default values for the location of the work area to which wrapper scripts will be stored

Create Deployment Package (parameterized)

Code Block
titleExample for use of Packaging Script
linenumberstrue
#!/bin/sh

set -e

DEP_HOME=/home/sos/js7.deploy
DEP_ARCHIVE=${DEP_ARCHIVE:-"${DEP_HOME}"/archive}
DEP_BIN=${DEP_BIN:-"${DEP_HOME}"/bin}
DEP_CONFIG=${DEP_CONFIG:-"${DEP_HOME}"/config}
DEP_DESC=${DEP_DESC:-"${DEP_HOME}"/desc}
DEP_LOGS=${DEP_LOGS:-"${DEP_HOME}"/logs}  
DEP_RELEASE=${DEP_RELEASE:-"${DEP_HOME}"/release}
DEP_WORK=${DEP_WORK:-"${DEP_HOME}"/work}

"${DEP_BIN}"/js7_create_deployment_package.sh \
    --deploy-desc="${DEP_DESC}"/standalone/standalone-agent-http-2022-12-04.descriptor.json \
    --config-dir="${DEP_CONFIG}" \
    --archive-dir="${DEP_ARCHIVE}" \
    --release-dir="${DEP_RELEASE}" \
    --script-dir="${DEP_BIN}" \
    --work-dir="${DEP_WORK}" \
    --log-dir="${DEP_LOGS}" \
    --deploy-agent-id=deploymentAgent \
    --keep-work \
    --show-logs \
    --make-dirs

# makes use of the indicated Deployment Descriptor file that holds configuration items for a number of Agents
# works with specific values for directories
# keeps copies of the installer scripts and installations in the work area
# creates log files in the indicated directory and forwards the location to installer scripts

Resources

...