Page History
Table of Contents |
---|
Introduction
For JS7 - Automated Deployment On Premises use of a Deployment Area is recommended.
...
- to hold the script environment for JS7 - Automated Installation and Update and the JS7 - Deployment Packaging,
- to hold the configuration files and certificates for deployment of JS7 componentsproducts,
- to hold the JS7 installations per JS7 release and component product such as JOC Cockpit, Controller, Agent,
- to hold the archive of deployment packages per JS7 releases and target machine,
- to operate a JS7 Agent that is used to perform the JS7 - Deployment Workflow.
The following sections explain the directories included in a Deployment Area.
Find step-by-step instructions from the JS7 - Deployment - Setting up the Deployment Area article.
Anchor | ||||
---|---|---|---|---|
|
Directories and Files
The suggested directory layout for the Deployment Area includes the following directories and files:
archive
(holds Deployment Packages)<deployment-descriptor>
(specifies the Deployment Descriptor)agents
(holds Agent Deployment Packages)<agent-id>
(specifies the directory for a specific Agent identified by its Agent ID)
js7_deploy_agent_unix.<agent-id>.<release>.config.tar.gz
(Deployment Package tarball for the Agent's configuration directory)js7_deploy_agent_unix.<agent-id>.<release>.install.tar.gz
(Deployment Package tarball for the Agent's installation directory)run_deploy_agent.sh
(deployment scriptDeployment Script for execution on the target host)run_install_agent.sh
(wrapper script for the parameterized call to thejs7_install_agent.sh
) Installer Script)run_rollout_agent.sh
(Rollout Script for transfer of tarballs and Deployment Script to the target host)
<agent-id>
(directory for a specific Agent identified by its
<agent-id>
(specifies the Agent ID)...
controllers
(holds Controller Deployment Packages)<controller-id>
(specifies the directory for a specific Controller identified by its Controller ID)<instance-type>
(specifies the type of the Controller instance which isprimary
orsecondary
)js7_deploy_controller_unix.<controller-id>.<instance-type>.<release>.config.tar.gz
(Deployment Package tarball for the Controller instance's configuration directory)js7_deploy_controller_unix.<controller-id>.<instance-type>.<release>.install.tar.gz
(Deployment Package tarball for the Controller instance's installation directory)run_deploy_controller.sh
(Deployment Script for execution on the target host)run_install_controller.sh
(Wrapper Script for the parameterized call to thejs7_install_controller.sh
Installer Script)run_rollout_controller.sh
(Rollout Script for transfer of tarballs and Deployment Script to the target host)
<instance-type>
(specifies the type of the<instance-type>
(specifies the type of the Controller instance which isprimary
orsecondary
)
<controller-id>
(specifies the (directory for a specific Controller identified by its Controller ID)...
- joc (holds JOC Cockpit Deployment Packages)
<joc-id>
(specifies the directory for a specific JOC Cockpit identified by its Cockpit ID)<instance-type>
(specifies the type of the JOC Cockpit instance which isprimary
orsecondary
)js7_deploy_joc_linux.<joc-id>.<instance-type>.<release>.config.tar.gz
(Deployment Package tarball for the JOC Cockpit instance's configuration directory)js7_deploy_joc_linux.<joc-id>.<instance-type>.<release>.install.tar.gz
(Deployment Package tarball for the JOC Cockpit instance's installation directory)run_deploy_joc.sh
(Deployment Script for execution on the target host)run_install_joc.sh
(Wrapper Script for the parameterized call to thejs7_install_joc.sh
Installer Script.run_rollout_joc.sh
(Rollout Script for transfer of tarballs and Deployment Script to the target host)
<instance-type>
(specifies the type of the JOC Cockpit instance which isprimary
orsecondary
)
<joc-id>
(specifies the directory for a specific JOC Cockpit IDidentified by its JOC Cockpit ID)...
js7_import_tar.gz
(holds the Deployment Workflow for import to JS7 JOC Cockpit, see JS7 - Deployment Workflow)run_deploy.sh
(Wrapper Script to run allrun_deploy_*.sh
Deployment Scripts for Agent, Controller and JOC Cockpit instances in the same Deployment Descriptor)
<deployment-descriptor>
(specifies the Deployment Descriptor)...
bin
(holds executable files, preferably individual scripts, Deployment Scripts and Installer Scripts available from JS7 - Download)jq
(jq JSON processor for Linux as available from https://github.com/stedolan/jq under the license https://opensource.org/licenses/MIT)js7_create_certificate_store.sh
(used to add certificates to keystores and truststores, see see JS7 - How to add SSL TLS Certificates to Keystore and Truststore)js7_create_deployment_package.sh
(used to create Deployment Packages, see JS7 - Deployment Packaging)js7_install_agent.sh
(used to install Agents, see JS7 - Automated Installation and Update of AgentUnix Shell Installation Script - js7_install_agent.sh)js7_install_controller.sh
(used to install Controller instances, see JS7 - Automated Installation and Update of ControllerUnix Shell Installation Script - js7_install_controller.sh)js7_install_joc.sh
(used to install JOC Cockpit instances, see JS7 - Automated Installation and Update of JOC CockpitUnix Shell Installation Script - js7_install_joc.sh)
ca
(holds the Certificate Authority as explained from JS7 - How to create self-signed X.509 SSL TLS Certificates, not used if an external Certificate Authority is in place)certs
(holds CAself-signed Certificatescertificates)csr
(holds Certificate Signing Requests)private
(holds Private Keys)
config
(holds configuration files)agents
(holds Agent configuration files)instances
(holds configuration files specific for an Agent in a user environment)<agent-id>
(specifies the Agent ID for directories and files that are specific to an Agent)
config
(general configuration)private
(specific configuration)<pgp-public-key>
(public key file or keyring file)https-keystore.p12
(default location and file name of a PKCS12 keystore holding the Agent's private key and certificate)https-truststore.p12
(default location and file name of a PKCS12 truststore holding the Root CA Certificate)
trusted-pgp-keys
(optionally holds PGP public key files and keyring files used for signing, see JS7 - Deployment of Scheduling Objects)<pgp-public-key>
(public key file or keyring file
<agent-id>
(specifies the Agent ID for directories and files that are specific to an Agent)
...
trusted-x509-keys
templates
(optionally holds configuration files that ship as templates for a number of Agents)<template-name>
(an arbitrary directory name for templates can be used)config
(general configuration)private
(specific configuration)trusted-pgp-keys
(optionally holds PGP public key files and keyring files used for X.509 certificate files used for signing, see JS7 - Deployment of Scheduling Objects)- <x509
<pgp-public-
certificate> (X.509 certificatekey>
(public key file or keyring file)<x509 <pgp-public-
certificate> (X.509 certificatekey>
(public key file or keyring file)...
- <x509
https-keystore.p12
(optional default location and file name of a PKCS12 keystore)https-truststore.p12
(optional default location and file name of a PKCS12 truststore)trusted-x509-keys
(optionally holds X.509 certificate files used for signing, see JS7 - Deployment of Scheduling Objects)<x509-certificate>
(X.509 certificate file)<x509-certificate>
(X.509 certificate file)...
private.conf
(optional configuration file, for example to specify keystore, truststore and Distinguished Names of Controller certificatecertificates, see see JS7 - Agent Configuration Items)log4j2.xml
(optional log configuration file, see JS7 - Log Levels and Debug Options)
...
agent.conf
(optional configuration file, see JS7 - Agent Configuration Items)
<agent-id>
(specifies the Agent ID for directories and files that are specific to an Agent)...
templates
(holds configuration files that act as templates for a number of Agents)<template-name>
(an arbitrary directory name for templates can be used)config
(general configuration...
controllers
(holds Controller configuration files)private
instances
(specific configurationholds configuration files specific for Controller instances in a user environment)- trusted
<controller-
pgpid>.<controller-
keys (optionally holds PGP public key files and keyring files used for signing, see JS7 - Deployment of Scheduling Objects)...
trusted-x509-keys
(optionally holds X.509 certificate files used for signing, see JS7 - Deployment of Scheduling Objects)...
- trusted
<template-name>
(an arbitrary directory name for templates can be used)...
certs
(holds certificate files for deployment with Agents and Controllers)ca
(optional Root Certificate Authority used for self-signed certificates)<root-ca-certificate>
(the Root CA Certificate file, frequently available with a .pem, .crt extension)
...
type>
(specifies the Controller ID for directories and files that are specific to a Controller instance with the instance type being
primary
orsecondary
)config
(general configuration)private
(specific configuration)<controller-cert>
(the Controller instance's server authentication certificate)https-keystore.p12
(default location and file name of a PKCS12 keystore holding the Controller instance's private key and certificate)https-truststore.p12
(default location and file name of a PKCS12 truststore holding the Root CA Certificate)
<controller-id>.<controller-type>
(specifies the Controller ID for directories and files that are specific to a Controller)
...
templates
(holds configuration files that ship as templates for a number of Controllers)<template-name>
(an arbitrary directory name for templates can be used)config
(general configuration)private
(specific configuration)trusted-pgp-keys
(optionally holds PGP public key files and keyring files used for signing, see JS7 - Deployment of Scheduling Objects)<pgp-public-key>
(public key file or keyring file)<pgp-public-key>
(public key file or keyring file)...
trusted-x509-keys
(optionally holds X.509 certificate files used for signing, see JS7 - Deployment of Scheduling Objects)<x509-certificate>
(X.509 certificate file)<x509-certificate>
(X.509 certificate file)...
private.conf
(optional configuration file, for example to specify keystore, truststore and Distinguished Names of JOC Cockpit certificate, see JS7 - Controller Configuration Items)log4j2.xml
(optional log configuration file, see JS7 - Log Levels and Debug Options)
controller.conf
(optional configuration file, see JS7 - Controller Configuration Items)
<template-name>
(an arbitrary directory name for templates can be used)...
joc
(holds JOC Cockpit configuration files)instances
(holds configuration files that are specific for JOC Cockpit instance in a user environment)<joc-id>.<instance-type>
(holds configuration files for a JOC Cockpit
...
instances
(holds configuration files specific for a Controller instance)<controller-id>.<controller-type>
(specifies the Controller ID for directories and files that are specific to a Controller instance with the instance type beingprimary
orsecondary
)config
resources
(general configuration)private
(specific configuration)trusted-pgp-keys
(optionally holds PGP public key files and keyring files used for signing, see JS7 - Deployment of Scheduling Objects)<pgp-public-key>
(public key file or keyring file)<pgp-public-key>
(public key file or keyring file)...
trusted-x509-keys
(optionally holds X.509 certificate files used for signing, see JS7 - Deployment of Scheduling Objects)<x509-certificate>
(X.509 certificate file)<x509-certificate>
(X.509 certificate file)...
https-keystore.p12
(optional default location and file name of a PKCS12 keystore)https-truststore.p12
(optional default location and file name of a PKCS12 truststore)private.conf
(optional configuration file, for example to specify keystore, truststore and Distinguished Names of JOC Cockpit certificate, see JS7 - Controller Configuration Items)log4j2.xml
(optional log configuration file, see JS7 - Log Levels and Debug Options)
controller.conf
(optional configuration file, see JS7 - Controller Configuration Items)
<controller-id>.<controller-type>
(specifies the Controller ID for directories and files that are specific to a Controller)...
- optionally holds configuration files such as the
joc.properties
file, keystore, truststore files etc.) response
(optionally holds response files, mainly thejoc_install.xml
response file, that will be copied to the JOC Cockpit's setup directory)
- optionally holds configuration files such as the
<joc-id>.<instance-type>
(holds configuration files for a JOC Cockpit instance with the instance type beingprimary
orsecondary
)...
templates
(holds configuration files that ship as templates for a number of JOC Cockpit instances)dbms
(holds sample response files per supported DBMS, mainly thejoc_install.xml
response file andhibernate.cfg.xml
file that will be copied to the JOC Cockpit's setup directory)h2
(H2®)mariadb
(MariaDB®)mssql
(SQL Server®)mysql
(MySQL®)oracle
(Oracle®)pgsql
(PostgreSQL®)
http
(holds sample configuration files for use with HTTP connections)resources
(holds configuration files such as thejoc.properties
file)start.d
(holds configuration files such ashttp.ini
,https.ini
,ssl.ini
)
https
(holds sample configuration files for use with HTTPS connections)resources
(holds configuration files such as thejoc.properties
file with keystore and truststore settings)start.d
(holds configuration files such ashttp.ini
,https.ini
,ssl.ini
)
templates
(holds configuration files that act as templates for a number of Controllers)<template-name>
(an arbitrary directory name for templates can be used)config
(general configuration)private
(specific configuration)trusted-pgp-keys
(optionally holds PGP public key files and keyring files used for signing, see JS7 - Deployment of Scheduling Objects)...
trusted-x509-keys
(optionally holds X.509 certificate files used for signing, see JS7 - Deployment of Scheduling Objects)...
<template-name>
(an arbitrary directory name for templates can be used)...
server
(Server Authentication Certificates)<server-certificate>(Server Certificate file, frequently available with a .pem, .crt extension)<server-certificate>(Server Certificate file, frequently available with a .pem, .crt extension)client
(Client Authentication Certificates)<client-certificate>(Client Certificate file, frequently available with a .pem, .crt extension)<client-certificate>controllers
(holds Controller configuration files)joc
licenses
(optionally holds JOC Cockpit configuration files)instances
(holds configuration files that are specific for a JOC Cockpit instance)<server>.<instance-type>
(holds configuration files for a JOC Cockpit instance running on a specific server with the instance type being primary
or secondary
)resources
(optionally holds configuration files such as thejoc.properties
file, keystore, truststore files etc.)response
(holds response files, mainly thejoc_install.xml
response file, that are copied to the JOC Cockpit's setup directory)
<server>.<instance-type>
(holds configuration files for a JOC Cockpit instance running on a specific server with the instance type being primary
or secondary
files related to JS7 licenses in a user environment)js7-license.jar
(holds binary licensed code, see JS7 - How to apply a JS7 License Key)*.pem
(holds the user's license key, see JS7 - How to apply a JS7 License Key)
desc
(holds Deployment Descriptors)standalone
(holds sample files related to Standalone instances of JS7 Agents, Controller, JOC Cockpit)cluster
(holds sample files related to Cluster instances of JS7 Agents, Controller, JOC Cockpit)<deployment-descriptor>.json
(Deployment Descriptor .json file specific for a user environment)<deployment-descriptor>
.json
(Deployment Descriptor .json file specific for a user environment)...
templates
logs
(optionally holds configuration files that act as templates for a number of JOC Cockpit instances)<template-name>
(an arbitrary directory name for templates can be used)resources
(optionally holds configuration files such as thejoc.properties
file, keystore, truststore files etc.)response
(holds response files, mainly thejoc_install.xml
response file, that are copied to the JOC Cockpit's setup directory)
<template-name>
(an arbitrary directory name for templates can be used)...
desc
(holds Deployment Descriptors)<deployment-descriptor>.json
(Deployment Descriptor .json file)<deployment-descriptor>
.json
(Deployment Descriptor .json file)...
logs
(holds log files)deployment_package.<deployment-descriptor>.<host>.<timestamp>.log
(Packaging Script log files)install_js7_agent.<host>.<timestamp>.log
(Agent Installer log files)install_js7_controller.<host>.<timestamp>.log
(Controller Installer log files)install_js7_joc.<host>.<timestamp>.log
(JOC Cockpit Installer log files)
release
(holds the installation tarballs for JS7 releases)...
(users can apply an arbitrary directory hierarchy at this level)js7_agent_unix.<release>.tar.gz
(JS7 Agent installation tarball as download from the SOS Web Site)js7_controller_unix.<release>.tar.gz
(JS7 Controller installation tarball as download from the SOS Web Site)js7_joc_linux.<release>.tar.gz
(JS7 JOC Cockpit installation tarball as download from the SOS Web Site)
work
(the working area is preferably used to perform installation of JS7 components during packaging)agents
(directory for Agent installation during packaging)<agent-id>
(specifies the Agent ID for directories and files that are specific to an Agent)...
(sub-directories used for Agent installation)
<agent-id>
(specifies the Agent ID for directories and files that are specific to an Agent)...
controllers
(directory for Controller installation during packaging)<controller-id>
(specifies the Controller ID for directories and files that are specific to a Controller)...
(sub-directories used for Controller installation)
<controller-id>
(specifies the Controller ID for directories and files that are specific to a Controller)...
tmp
(temporary files are written to this directory, if the --keep-work
switch is used when invoking the JS7 - Deployment Packaging then files will remain in this directory which suggests cleanup by the user)env.sh
(Environment Script, see next chapter)Explanation on Individual Files
Environment Script: env.sh
The Environment Script initializes a number of environment variables that map to directories as explained above.
...
Code Block | ||||
---|---|---|---|---|
| ||||
#!/bin/sh
SCRIPT_HOME=$HOME/js7.deploy
DEP_ARCHIVE="${DEP_ARCHIVE:-$SCRIPT_HOME/archive}"
DEP_BIN="${DEP_BIN:-$SCRIPT_HOME/bin}"
DEP_CONFIG="${DEP_CONFIG:-$SCRIPT_HOME/config}"
DEP_DESC="${DEP_DESC:-$SCRIPT_HOME/desc}"
DEP_LOGS="${DEP_LOGS:-$SCRIPT_HOME/logs}"
DEP_RELEASE=/mnt/releases/scheduler_setups
DEP_TARGET="/home/sos/js7.target"
DEP_WORK="${DEP_WORK:-$SCRIPT_HOME/work}"
JAVA_HOME="${SCRIPT_HOME}"/jdk-11.0.2
PATH=${JAVA_HOME}/bin:${PATH}
export JAVA_HOME PATH DEP_ARCHIVE DEP_BIN DEP_CONFIG DEP_DESC DEP_LOGS DEP_RELEASE DEP_TARGET DEP_WORK |
Explanation:
- Any environment variable makes use of a fallback if not otherwise specified.
- By default the
env.sh
script's directory is assumed to hold the directory layout of the Deployment Area.
- By default the
- Each environment variable in the script points to a directory with a specific purpose that can be located outside of the suggested directory layout.
- In the above example the
DEP_RELEASE
environment variable specifies a location of JS7 installation files from a mount point. - The
DEP_ARCHIVE
,DEP_BIN
,DEP_CONFIG
,DEP_DESC
,DEP_LOGS
,DEP_WORK
environment variables point to directories explained with the directory layout. - The
DEP_TARGET
environment variable points to a location on the same server to simulate deployments to target hosts.
- In the above example the
- The
JAVA_HOME
environment variable is specified to enforce use of a specific Java version for temporary installation of JS7 components during packaging. - Consider that environment variables have to be exported in order to be applied by subsequent calls to deployment scripts.
...
Code Block | ||||
---|---|---|---|---|
| ||||
. ./env.sh |
...
- log files)
deployment_package.<deployment-descriptor>.<host>.<timestamp>.log
(Packaging Script log files)install_js7_agent.<host>.<timestamp>.log
(Agent Installer log files)install_js7_controller.<host>.<timestamp>.log
(Controller Installer log files)install_js7_joc.<host>.<timestamp>.log
(JOC Cockpit Installer log files)
release
(holds the installation tarballs of JS7 releases)...
(users can apply an arbitrary directory hierarchy at this level)js7_agent_unix.<release>.tar.gz
(JS7 Agent installation tarball as download from the SOS Web Site)js7_controller_unix.<release>.tar.gz
(JS7 Controller installation tarball as download from the SOS Web Site)js7_joc_linux.<release>.tar.gz
(JS7 JOC Cockpit installation tarball as download from the SOS Web Site)
work
(the working area is preferably used to perform installation of JS7 products during packaging)agents
(directory for Agent installation during packaging)<agent-id>
(specifies the Agent ID for directories and files that are specific to an Agent)
...
(sub-directories used for Agent installation)
<agent-id>
(specifies the Agent ID for directories and files that are specific to an Agent)
...
controllers
(directory for Controller installation during packaging)<controller-id>
(specifies the Controller ID for directories and files that are specific to a Controller)
...
(sub-directories used for Controller installation)
<controller-id>
(specifies the Controller ID for directories and files that are specific to a Controller)
...
tmp
(temporary files are written to this directory, if the--keep-work
switch is used when invoking the JS7 - Deployment Packaging then files will remain in this directory which suggests cleanup by the user)
env.sh
(Environment Script, see next chapter)
Explanation on Individual Files
Environment Script: env.sh
The Environment Script initializes a number of environment variables that map to directories as explained above.
The script has to be invoked before running any script to install, to package or to deploy to target hosts.
Code Block | ||||
---|---|---|---|---|
| ||||
#!/bin/sh
SCRIPT_HOME=${HOME}/js7.deploy
DEP_ARCHIVE="${DEP_ARCHIVE:-$SCRIPT_HOME/archive}"
DEP_BIN="${DEP_BIN:-$SCRIPT_HOME/bin}"
DEP_CA="${DEP_CA:-$SCRIPT_HOME/ca}"
DEP_CONFIG="${DEP_CONFIG:-$SCRIPT_HOME/config}"
DEP_DESC="${DEP_DESC:-$SCRIPT_HOME/desc}"
DEP_RELEASE="${DEP_RELEASE:-$SCRIPT_HOME/release}"
DEP_WORK="${DEP_WORK:-$SCRIPT_HOME/work}"
JAVA_HOME="/usr/lib/jvm/jdk-11.0.2"
PATH=${DEP_BIN}:${JAVA_HOME}/bin:${PATH}
export JAVA_HOME PATH DEP_ARCHIVE DEP_BIN DEP_CA DEP_CONFIG DEP_DESC DEP_RELEASE DEP_WORK |
Explanation:
- Any environment variable makes use of a fallback if not otherwise specified.
- By default the
env.sh
script's directory is assumed to hold the directory layout of the Deployment Area.
- By default the
- Each environment variable in the script points to a directory with a specific purpose that can be located outside of the suggested directory layout.
- The
DEP_ARCHIVE
,DEP_BIN
,DEP_CA
,DEP_CONFIG
,DEP_DESC
,DEP_RELEASE
,DEP_WORK
environment variables point to directories explained with the directory layout. - Users can modify the directory layout at their will, for example the making the
DEP_RELEASE
environment variable indicate a mount point.
- The
- The location of the Java JDK is specified with the
JAVA_HOME
environment variable. Users have to adjusts the environment variable to the location of their Java JDK.- Typically Java LTS releases 11 and newer can be used. For Agent and Controller Java 1.8 can be used. For details see Which Java versions is JobScheduler available for?
- The
PATH
environment variable is adjusted to point to the location of thebin
sub-directory of Java.
- Consider that environment variables have to be exported in order to be applied by subsequent calls to deployment scripts.
The Environment Script has to be sourced to make environment variables available to shell scripts in the Deployment Area:
The script has to be sourced, this means the call to the script is preceded by a dot and a space like this:
Code Block | ||||
---|---|---|---|---|
| ||||
. ./env.sh |
Anchor | ||||
---|---|---|---|---|
|
The Installer Wrapper Scripts are created by the JS7 - Deployment Packaging Script to parameterize calls to the Installer Scripts.
An example of a Wrapper Script for installation of an Agent using HTTPS connections looks like this:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#!/bin/sh
set -e
DEP_CONFIG="/home/sos/js7.deploy/config"
DEP_BIN="/home/sos/js7.deploy/bin"
DEP_WORK_TEMP="/home/sos/js7.deploy/work/agents/agent_001"
mkdir -p "${DEP_WORK_TEMP}"
"${DEP_BIN}"/js7_install_agent.sh \
--real-path-prefix="${DEP_WORK_TEMP}" \
--release="2.5.0" \
--tarball="/mnt/releases/scheduler_setups/2.5.0/js7_agent_unix.2.5.0.tar.gz" \
--home="${DEP_WORK_TEMP}/opt/sos-berlin.com/js7/agent-primary" \
--data="${DEP_WORK_TEMP}/var/sos-berlin.com/js7/agent-primary" \
--http-port="localhost:31443" \
--https-port="centostest-primary.sos:31443" \
--controller-id="cluster" \
--controller-primary-cert="${DEP_CONFIG}/controllers/instances/cluster.primary/config/centostest-primary.crt" \
--controller-secondary-cert="${DEP_CONFIG}/controllers/instances/cluster.secondary/config/private/centostest-secondary.crt" \
--keystore="${DEP_CONFIG}/agents/instances/agent_001/config/private/https-keystore.p12" \
--keystore-password="jobscheduler" \
--truststore="${DEP_CONFIG}/agents/instances/agent_001/config/private/https-truststore.p12" \
--truststore-password="jobscheduler" \
--deploy-dir="${DEP_CONFIG}/agents/templates/https/config" \
--make-dirs |
Explanation:
- The parameterization is used from the Deployment Descriptor.
- The
--home
and--data
directories are prefixed with the directory of the work area.- The
--real-path-prefix
holds the work area directory. The Installer Script makes use of this information to conclude the effective directories as used for the target host.
- The
- Wrapper Scripts for Controllers and JOC Cockpit are similarly parameterized.
Anchor | ||||
---|---|---|---|---|
|
The Deployment Scripts are created by the JS7 - Deployment Packaging Script. The scripts are called by Rollout Scripts on target hosts to extract the respective tarballs. The parameterization is created from the Deployment Descriptor.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#!/bin/sh
set -e
force_sudo="0"
if [ $(id -u) -eq 0 ]
then
use_sudo=""
else
use_sudo="sudo"
fi
systemd_service_dir="/usr/lib/systemd/system"
systemd_service_name="js7_agent_31445.service"
... Log ".. executing pre-extraction command: StopService"
StopService
if [ -d "/opt/sos-berlin.com/js7/agent-primary" ]
then
Log ".. removing home directory: /opt/sos-berlin.com/js7/agent-primary"
if [ "${force_sudo}" -eq 0 ] && [ -w "/opt/sos-berlin.com/js7/agent-primary" ]
then
rm -f -r "/opt/sos-berlin.com/js7/agent-primary"
else
${use_sudo} rm -f -r "/opt/sos-berlin.com/js7/agent-primary"
fi
fi
if [ ! -d "/opt/sos-berlin.com/js7" ]
then
Log ".. creating parent home directory: /opt/sos-berlin.com/js7"
if [ "${force_sudo}" -eq 0 ] && [ -w "/opt/sos-berlin.com" ]
then
mkdir -p "/opt/sos-berlin.com/js7"
else
${use_sudo} mkdir -p "/opt/sos-berlin.com/js7"
fi
if [ "${force_sudo}" -eq 1 ] || [ ! -w "/opt/sos-berlin.com" ]
then
Log ".. owning parent home directory to: sos"
${use_sudo} chown -R sos "/opt/sos-berlin.com/js7"
fi
fi
Log ".. extracting tarball to home directory: /opt/sos-berlin.com/js7"
cd "/opt/sos-berlin.com/js7" > /dev/null
Log ".. extracting tarball: js7_deploy_agent_unix.agent_001.2.5.1.install.tar.gz"
if [ "${force_sudo}" -eq 1 ]
then
test -e "/tmp/js7_deploy_agent_unix.agent_001.2.5.1.install.tar.gz" && gzip -c -d < "/tmp/js7_deploy_agent_unix.agent_001.2.5.1.install.tar.gz" | ${use_sudo} tar -xf -
else
test -e "/tmp/js7_deploy_agent_unix.agent_001.2.5.1.install.tar.gz" && gzip -c -d < "/tmp/js7_deploy_agent_unix.agent_001.2.5.1.install.tar.gz" | tar -xf -
fi
rc=$?
cd - > /dev/null
if [ ! -d "/var/sos-berlin.com/js7" ]
then
Log ".. creating parent data directory: /var/sos-berlin.com/js7"
if [ "${force_sudo}" -eq 0 ] && [ -w "/var/sos-berlin.com" ]
then
mkdir -p "/var/sos-berlin.com/js7"
else
${use_sudo} mkdir -p "/var/sos-berlin.com/js7"
fi
if [ "${force_sudo}" -eq 1 ] || [ ! -w "/var/sos-berlin.com" ]
then
Log ".. owning parent data directory to: sos"
${use_sudo} chown -R sos "/var/sos-berlin.com/js7"
fi
else
if [ -d "/var/sos-berlin.com/js7/agent-primary" ]
then
if [ "${force_sudo}" -eq 1 ] || [ ! -w "/var/sos-berlin.com/js7/agent-primary" ]
then
Log ".. owning data directory to: sos"
${use_sudo} chown -R sos "/var/sos-berlin.com/js7/agent-primary"
fi
fi
fi
Log ".. extracting tarball to data directory: /var/sos-berlin.com/js7"
cd "/var/sos-berlin.com/js7" > /dev/null
Log ".. extracting tarball: |
Code Block | ||||
---|---|---|---|---|
| ||||
#!/bin/sh
set -e
JS7_DEP_CONFIG="/home/sos/js7.deploy/config"
JS7_DEP_SCRIPT="/home/sos/js7.deploy/bin"
JS7_DEP_WORK="/home/sos/js7.deploy/work/agents/agent_001"
mkdir -p "/home/sos/js7.deploy/work/agents/agent_001"
${JS7_DEP_SCRIPT}/js7_install_agent.sh \
--real-path-prefix="${JS7_DEP_WORK}" \
--release="2.5.0" \
--tarball="/mnt/releases/scheduler_setups/2.5.0/js7_agent_unix.2.5.0.tar.gz" \
--home="${JS7_DEP_WORK}/opt/sos-berlin.com/js7/agent-primary" \
--data="${JS7_DEP_WORK}/var/sos-berlin.com/js7/agent-primary" \
--http-port="localhost:31443" \
--https-port="centostest-primary.sos:31443" \
--controller-id="testsuite" \
--controller-primary-cert="${JS7_DEP_DEPLOY}/certs/server/centostest-primary.crt" \
--controller-secondary-cert="${JS7_DEP_DEPLOY}/certs/server/centostest-secondary.crt" \
--keystore="${JS7_DEP_DEPLOY}/agents/instances/agent_001/config/private/https-keystore.p12" \
--keystore-password="jobscheduler" \
--truststore="${JS7_DEP_DEPLOY}/agents/instances/agent_001/config/private/https-truststore.p12" \
--truststore-password="jobscheduler" \
--deploy-dir="${JS7_DEP_DEPLOY}/agents/templates/https/config" \
--make-dirs |
Explanation:
- The parameterization is used from the Deployment Descriptor.
- The
--home
and--data
directories are prefixed with the directory of the work area.- The
--real-path-prefix
holds the work area directory. The Installer Script makes use of this information to conclude the effective directories as used for the target host.
- The
- Wrapper Scripts for Controllers and JOC Cockpit are similarly parameterized.
...
Code Block | ||||
---|---|---|---|---|
| ||||
#!/bin/sh set -e scp -i "/home/sos/.ssh/sos_rsa" -P 22 "/home/sos/js7.deploy/archive/agent-https-2022-12-04/agents/agent_001/js7_deploy_agent_unix.agent_001.2.5.01.installconfig.tar.gz" sos@centostest-primary:"/tmp" ssh -i "/home/sos/.ssh/sos_rsa" -p 22 -t -t -o LogLevel=QUIET sos@centostest-primary << 'EOF' systemctl stop js7.agent_001 cd "/opt/sos-berlin.com/js7" > /dev/null if [ "${force_sudo}" -eq 1 ] then test -e "/tmp/js7_deploy_agent_unix.agent_001.2.5.1.config.tar.gz" && gzip -c -d < "/tmp/js7_deploy_agent_unix.agent_001.2.5.1.config.tar.gz" | ${use_sudo} tar -xf - else test -e "/tmp/js7_deploy_agent_unix.agent_001.2.5.01.installconfig.tar.gz" && gzip -c -d < "/tmp/js7_deploy_agent_unix.agent_001.2.5.01.installconfig.tar.gz" | tar -xf - fi rc=$? cd - > /dev/null rc=$? systemctl start js7.agent_001 exit $rc EOF scp -i "/home/sos/.ssh/sos_rsa" -P 22 "/home/sos/js7.deploy/archive/agent-https-2022-12-04/agents/agent_001/js7_deploy_agent_unix.agent_001.2.5.0.config.tar.gz" sos@centostest-primary:"/tmp" ssh -i "/home/sos/.ssh/sos_rsa" -p 22 -t -t -o LogLevel=QUIET sos@centostest-primary << 'EOF' systemctl stop js7.agent_001 cd "/var/sos-berlin.com/js7" > /dev/null test -e "/tmp/js7_deploy_agent_unix.agent_001.2.5.0.config.tar.gz" && gzip -c -d < "/tmp/js7_deploy_agent_unix.agent_001.2.5.0.config.tar.gz" | tar -xf - cd - > /dev/null rc=$? systemctl start js7.agent_001 exit $rc EOFif [ "${rc}" -eq 0 ] then Log ".. owning home directory to: sos1:sos1" ${use_sudo} chown -R sos1:sos1 "/opt/sos-berlin.com/js7/agent-primary" rc=$? fi if [ "${rc}" -eq 0 ] then Log ".. owning data directory to: sos2:sos2" ${use_sudo} chown -R sos2:sos2 "/var/sos-berlin.com/js7/agent-primary" rc=$? fi if [ "${rc}" -eq 0 ] then Log ".. creating systemd service: js7_agent_31445.service" MakeService "/opt/sos-berlin.com/js7/agent-primary/bin/agent_31445.service" rc=$? fi Log ".. executing post-extraction command: StartService" StartService Log ".. deployment completed, return code: ${rc}" exit ${rc} |
Explanation:
- Authentication is performed by use of private/public keyskey.
- For each deployed tarball transfer and extraction are individually applied.
- The example includes commands for pre- and post-processing to stop and to start an Agent from iJS7 - systemd Service Files for automated Startup and Shutdown with Unix Systems.
Alternative Directory Layout
The directory layout of the Deployment Area is not carved in stone. Instead, users can modify the env.sh
Environment Script to point to different directories.
- The example leaves out (
...
) a number of shell functions that are created to implement the MakeService, StopService and StartService operations.
Anchor | ||||
---|---|---|---|---|
|
The Rollout Scripts perform transfer of deployment tarballs to target hosts and extract the respective tarballs by invoking the Deployment Script. The parameterization is created from the Deployment Descriptor.Use of the env.sh
Environment Script brings benefits when adding your own scripts to the ./bin
folder, for example to create individual deployment packages like this:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#!/bin/sh
set -e
SCRIPT_HOME=$(cd "$(dirname "$0")" >/dev/null && pwd)
DEP_ARCHIVE=${DEP_ARCHIVE:-$(dirname "${SCRIPT_HOME}")/archive}
DEP_BIN=${DEP_BIN:-$(dirname "${SCRIPT_HOME}")/bin}
DEP_CONFIG=${DEP_CONFIG:-$(dirname "${SCRIPT_HOME}")/config}
DEP_DESC=${DEP_DESC:-$(dirname "${SCRIPT_HOME}")/desc}
DEP_WORK=${DEP_WORK:-$(dirname "${SCRIPT_HOME}")/work}
${DEP_BIN}/js7_create_deployment_package.sh \
--deploy-desc=${DEP_DESC}/agent-https-2022-12-04.json \
--config-dir=${DEP_CONFIG} \
--archive-dir=${DEP_ARCHIVE} \
--script-dir=${DEP_BIN} \
--work-dir=${DEP_WORK} \
--deploy-agent-id=deploymentAgent \
--keep-script \
--keep-work |
Explanation:
...
scp -i "/home/sos/.ssh/sos_rsa" -P 22 "/home/sos/js7.deploy/archive/user-joc-controller-agent-https-2022-12-04/agents/agent_001/js7_deploy_agent_unix.agent_001.2.5.1.install.tar.gz" sos@centostest-primary:"/tmp"
scp -i "/home/sos/.ssh/sos_rsa" -P 22 "/home/sos/js7.deploy/archive/user-joc-controller-agent-https-2022-12-04/agents/agent_001/js7_deploy_agent_unix.agent_001.2.5.1.config.tar.gz" sos@centostest-primary:"/tmp"
scp -i "/home/sos/.ssh/sos_rsa" -P 22 "/home/sos/js7.deploy/archive/user-joc-controller-agent-https-2022-12-04/agents/agent_001/run_deploy_agent.sh" sos@centostest-primary:"/tmp"
ssh -i "/home/sos/.ssh/sos_rsa" -p 22 -t -t -o LogLevel=QUIET sos@centostest-primary 'chmod u+x /tmp/run_deploy_agent.sh && /tmp/run_deploy_agent.sh' |
Resources
...