Page History
...
- The JS7 offers to perform operations on JOC Cockpit, Controllers and Agents by use of the JS7 - REST Web Service API.
- For detailed information see the Technical Documentation of the REST Web Service API.
- For available CLI operations see JS7 - Unix Shell Command Line Interface.
- The REST Web Service API can be accessed from Shell utilities such as
curl
. - In addition, a PowerShell module is available for simplified access to the REST Web Service API. This is described in the JS7 - PowerShell Module article.
The Controller Git Deployment Script offered for Unix Shell can be applied to perform frequently used deployment operations on Controllers and Agents.
Use of a Controller Cluster or Agent Cluster is subject to the JS7 - License.
...
Git repositories.
Git Deployment Script
Command | Object | Documentation | ||
---|---|---|---|---|
register / unregister / check | Standalone Controller Controller Cluster | JS7 - Controller Cluster | ||
get-item / store-item / update-item / delete-item | Standalone JOC Cockpit | |||
clone / checkout | Standalone JOC Cockpit | store-agent / delete-agent | Standalone Agent Agent Cluster | JS7 - Agent Cluster JS7 - Management of Standalone Agents JS7 - Management of Agent Clusters |
deploy-agent / revoke-agent | ||||
export-agent / import-agent | ||||
store-subagent / delete-subagent | Subagent | |||
store-cluster / delete-cluster | Subagent Cluster | |||
deploy-cluster / revoke-cluster | ||||
encrypt / decrypt | None | Encrypt / decrypt strings and files | ||
add / commit / push / pull | ||||
get-credentials / store-credentials / delete-credentials |
The script is offered for download and can be applied for frequently used deployment operations:
...
Code Block | ||
---|---|---|
| ||
Usage: deploy-git.sh [Command] [Options] [Switches] Commands: get-item --folder [--recursive] [--local] store-item [--path] [--type] [--folder] [--recursive] [--local] [--controller-id] [--no-invalid] [-no-draft] [--no-deployed] [--no-released] [--latest] update-item [--path] [--type] [--folder] [--recursive] [--local] removedelete-item [--path] [--type] [--folder] [--local] checkout --folder [--local] [--branch | --tag] clone --folder [--local] --remote-url add --folder [--local] commit --folder [--local] --message push --folder [--local] pull --folder [--local] get-credentials store-credentials --server --user-account --user-name --user-mail [--user-password | --user-access-token | --user-private-key] removedelete-credentials --server Options: --url=<url> | required: JOC Cockpit URL --controller-id=<id[,id]> | required: Controller ID --user=<account> | required: JOC Cockpit user account --password=<password> | optional: JOC Cockpit password --ca-cert=<path> | optional: path to CA Certificate used for JOC Cockpit login --client-cert=<path> | optional: path to Client Certificate used for login --client-key=<path> | optional: path to Client Key used for login --timeout=<seconds> | optional: timeout for request, default: 60 --folder=<folder[,folder]> | optional: list of inventory folders holding objects --path=<path[,path]> | optional: list of inventory paths to objects --type=<type[,type]> | optional: list of object types such as WORKFLOW,SCHEDULE --branch=<identifier> | optional: Git branch identified by name, default: master --tag=<tag[,tag]> | optional: Git branch identified by tags --message=<text> | optional: Git commit message --server=<host> | optional: Git server --user-account=<account> | optional: Git authentication user account --user-name=<text> | optional: Git authentication user name --user-mail=<e-mail> | optional: Git authentication user e-mail address --user-password=<password> | optional: Git authentication user password --user-access-token=<identifier> | optional: Git authentication user access token --user-private-key=<path> | optional: Git authentication user private key file --remote-url=<url> | optional: Git remote repository URL --audit-message=<string> | optional: audit log message --audit-time-spent=<number> | optional: audit log time spent in minutes --audit-link=<url> | optional: audit log link --log-dir=<directory> | optional: path to directory holding the script's log files Switches: -h | --help | displays usage -v | --verbose | displays verbose output, repeat to increase verbosity -p | --password | asks for password -l | --local | uses repository for local objects -r | --recursive | specifies folders to be looked up recursively -tu | --user-latestpassword | asks for Git account password | uses--no-draft latest version of objects -u | --user-password | asks for Git account password --no-draft | excludes draft objects --no-deployed | excludes deployed objects --no-released | excludes released objects --no-invalid | excludes invalid objects --show-logs | shows log output if --log-dir is used --make-dirs | creates directories if they do not exist |
...
The following examples illustrate use cases for automated deployment of Controller and Agents.
Registering, Checking and Unregistering Controller
Controller instances are assigned a Controller ID on installation. When registering the Controller it will be registered with the given Controller ID.
deployment to Git repositories.
Managing Git Credentials
Credentials for a Git Server can be managed from the JOC Cockpit GUI using JS7 - Profiles - Git Management.Users can register a Controller from its URL. Users can check if the connection between JOC Cockpit and Controller can be established. Unregistering a Controller deletes the Controller and related Agents from the inventory
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API request_options=(--url=http://localhost:4446 --user=root --password=root) --controller-id=controller) # registerget Standalone Controllercredentials ./deploy-controllergit.sh registerget-credentials "${request_options[@]}" \ --primary-url=http://localhost:4444 --primary-title="Standalone Controller" # check Standalone Controller Connectionstore credentials ./deploy-controllergit.sh checkstore-credentials "${request_options[@]}" --controller-url=http://localhost:4444 # unregister Standalone Controller ./deploy-controller.sh unregister "${request_options[@]}" --controller-id=controller |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API request_options=(--url=http://localhost:4446 --user=root --password=root) # register Controller Cluster ./deploy-controller.sh register "${request_options[@]}" \ --primary-url=http://localhost:4544 --primary-title="Primary Controller" \ server=github.com --user-account=community \ --secondaryuser-url=http://localhost:4644name="Community" --secondaryuser-title="Secondary Controller" # check Controller Cluster Connections ./deploy-controller.sh check "${request_options[@]}" --controller-url=http://localhost:4544 ./deploy-controller.sh check "${request_options[@]}" --controller-url=http://localhost:4644 # unregister Controller Cluster ./deploy-controller.sh unregister "${request_options[@]}" --controller-id=controller |
Storing, Deploying, Revoking and Deleting Agents
Storing and Deploying Agents
When Agents are stored, then they are added or updated in the inventory and are set to the not deployed status.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API
request_options=(--url=http://localhost:4446 --user=root --password=root --controller-id=controller)
# store Standalone Agent
./deploy-controller.sh store-agent "${request_options[@]}" \
--agent-id=StandaloneAgent --agent-name=StandaloneAgent \
--agent-url="http://localhost:4445" --title="Standalone Agent"
# deploy Standalone Agent
./deploy-controller.sh deploy-agent "${request_options[@]}" --agent-id=StandaloneAgent |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API
request_options=(--url=http://localhost:4446 --user=root --password=root --controller-id=controller)
# store Agent Cluster with Primary/Secondary Director Agent
./deploy-controller.sh store-agent "${request_options[@]}" \
--agent-id=AgentCluster --agent-name=AgentCluster --title="Agent Cluster" \
--primary-subagent-id=primary-director --primary-url=http://localhost:4545 --primary-title="Primary Director" \
--secondary-subagent-id=secondary-director --secondary-url=http://localhost:4645 --secondary-title="Secondary Director"
# deploy Agent Cluster
./deploy-controller.sh deploy-agent "${request_options[@]}" --agent-id=AgentCluster --cluster |
Revoking and Deleting Agents
When Agents are revoked, then they will be deleted from the Controller. The Agent configuration remains in place with the inventory and will be set to the not deployed status.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API
request_options=(--url=http://localhost:4446 --user=root --password=root --controller-id=controller)
# revoke Standalone Agent
./deploy-controller.sh revoke-agent "${request_options[@]}" --agent-id=StandaloneAgent
# delete Standalone Agent
./deploy-controller.sh delete-agent "${request_options[@]}" --agent-id=StandaloneAgent |
Revoking an Agent Cluster includes to revoke the Subagents and Subagent Clusters from the Controller using a single operation.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API
request_options=(--url=http://localhost:4446 --user=root --password=root --controller-id=controller)
# revoke Agent Cluster
./deploy-controller.sh revoke-agent "${request_options[@]}" --agent-id=AgentCluster --cluster
# delete Agent Cluster
./deploy-controller.sh delete-agent "${request_options[@]}" --agent-id=AgentCluster |
Storing and Deleting Subagents
When Subagents are stored, then they are added or updated in the inventory and will be set to the not deployed status.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API request_options=(--url=http://localhost:4446 --user=root --password=root --controller-id=controller) # store Subagents ./deploy-controller.sh store-subagent "${request_options[@]}" \ --agent-id=AgentCluster --subagent-id=Subagent_01 \ --subagent-url=http://localhost:4745 --title="Subagent 01" ./deploy-controller.sh store-subagent "${request_options[@]}" \ --agent-id=AgentCluster --subagent-id=Subagent_02 \ --subagent-url=http://localhost:4845 --title="Subagent 02" # delete Subagents ./deploy-controller.sh delete-subagent "${request_options[@]}" --subagent-id=Subagent_01 ./deploy-controller.sh delete-subagentmail="community@sos-berlin.com" \ --user-private-key=/var/sos-berlin.com/js7/joc/resources/joc/repositories/private/sos-community.rsa # delete credentials ./deploy-git.sh delete-credentials "${request_options[@]}" --subagent-id=Subagent_02 |
Storing, Deploying, Revoking and Deleting Subagent Clusters
Storing and Deploying Subagent Clusters
When Subagent Clusters are stored, then they are added or updated in the inventory and will be set to the not deployed status.
server=github.com |
Cloning a Git Repository
A Git repository can be cloned and mapped to a JOC Cockpit inventory folderWhen Subagent Clusters are deployed, then the cluster configuration will be made available to the Agent Cluster.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API request_options=(--url=http://localhost:4446 --user=root --password=root --controller-id=controller) # store active-passive (fixed-priority) Subagent Clusterclone repository ./deploy-controllergit.sh store-clusterclone "${request_options[@]}" \ --agent-id=AgentClusterfolder=/TestRepo --clusterremote-id=active-passive \ --subagent-id=Subagent_01,Subagent_02 --priority=first --title="Active-Passive Clusterurl="git@github.com:sos-berlin/js7-demo-inventory-rollout-test" # store active-active (round-robin) Subagent Clusteroptionally checkout repository if a specific branch should be used ./deploy-controller.sh store-cluster "${request_options[@]}" \ --agent-id=AgentCluster --cluster-id=active-active \ --subagent-id=Subagent_01,Subagent_02 --priority=next --title="Active-Active Cluster" # deploy Subagent Clusters ./deploy-controller.sh deploy-cluster "${request_options[@]}" --cluster-id=active-passive ./deploy-controller.sh deploy-clustergit.sh checkout "${request_options[@]}" --folder=/TestRepo --branch=main |
Managing Scheduling Objects in a Git Repository
Getting Scheduling Objects from a Git Repository
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API request_options=(--url=http://localhost:4446 --user=root --password=root --controller-id=controller) # get items from local repository ./deploy-git.sh get-item "${request_options[@]}" --cluster-id=active-active |
Revoking and Deleting Subagent Clusters
When Subagent Clusters are revoked, then they are deleted from the Agent Cluster. The cluster configuration remains in place with the inventory and will be set to the not deployed status.
folder=/TestRepo --recursive |
Storing Scheduling Objects to a Git Repository
The operation will update a Git repository to hold objects available in the JOC Cockpit When Subagent Clusters are deleted, then they are deleted from the Agent Cluster and from the inventory.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API request_options=(--url=http://localhost:4446 --user=root=root --password=root --controller-id=controller) # store items to rollout respository: folder ./deploy-git.sh store-item "${request_options[@]}" --passwordfolder=root/TestRepo --controller-id=controller)recursive # revoke Subagent Clusters store items to rollout respository: object path and type of deployed object ./deploy-controllergit.sh revokestore-clusteritem "${request_options[@]}" --cluster-id=active-passive}" --path=/TestRepo/03_VariablesPassing/jdwVariablesAdHoc-repo --type=WORKFLOW --no-draft # store items to local respository: object path and type of draft object ./deploy-controllergit.sh revokestore-clusteritem "${request_options[@]}" ---cluster-id=active-activepath=/TestRepo/03_VariablesPassing/jdjVariablesJobResource --type=JOBRESOURCE --no-deployed --local # delete Subagent Clusters ./deploy-controller.sh delete-cluster "${request_options[@]}" --cluster-id=active-passivestore items to rollout respository: object path and type of deployed or draft object ./deploy-controllergit.sh deletestore-clusteritem "${request_options[@]}" --cluster-id=active-active |
Exporting and Importing Agents
Agent configurations can be exported to an archive file. They can be imported, for example when setting up next JS7 environments.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API request_options=(--url=http://localhost:4446 --user=root --password=root --controller-id=controller) # export Agents from their Agent ID ./deploy-controller.sh export-agent-path=/TestRepo/51_JobTemplates/51_JobTemplate --type=JOBTEMPLATE # store items to rollout respository: folder limited to draft objects ./deploy-git.sh store-item "${request_options[@]}" --folder=/TestRepo --recursive --no-released --no-deployed # store items to rollout respository: folder limited to deployed objects ./deploy-git.sh store-item "${request_options[@]}" \ --file=export_agents.zip--folder=/TestRepo --recursive --no-released --agent-id=StandaloneAgent,AgentClusterno-draft # import Agentsstore items to rollout respository: folder limited to released objects ./deploy-controllergit.sh importstore-agentitem "${request_options[@]}" --file=export_agents.zip |
Using encrypted Passwords
...
folder=/TestRepo --recursive --no-deployed --no-draft |
Deleting Scheduling Objects from a Git Repository
The operation will delete objects from a Git Repository.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# create Private Key openssl ecparam -name secp384r1 -genkey -noout -out encrypt.key # create Certificate Signing Request, adjust the subject to your needs openssl req -new -sha512 -nodes -key encrypt.key -out encrypt.csr -subj "/C=DE/ST=Berlin/L=Berlin/O=SOS/OU=IT/CN=Encrypt" # create Certificate, adjust the validity period to your needs openssl x509 -req -sha512 -days 1825 -signkey encrypt.key -in encrypt.csr -out encrypt.crt -extfile <(printf "keyUsage=critical,keyEncipherment,keyAgreement\n") # encrypt the password "root" using the Certificate, the encryption result will be returned and will look like: enc:BEXbHYa... MY_JS7_PASSWORD=$(./deploy-controller.sh encrypt --in="root" --cert=encrypt.crt) # store the environment variable to your profile ($HOME/.bash_profile or similar) to make the encrypted password available to the shell # export MY_JS7_PASSWORD=enc:BEXbHYa... # options for connection to the JS7 REST API can specify the encryption result as password and the Private Key for common options for connection to JS7 REST API request_options=(--url=http://localhost:4446 --user=root --password=root --controller-id=controller) # delete items from rollout repository: folder ./deploy-git.sh delete-item "${request_options[@]}" --folder=/TestRepo # delete items from rollout repository: object path and type ./deploy-git.sh delete-item "${request_options[@]}" --path=/TestRepo/03_VariablesPassing/jdwVariablesAdHoc-repo --type=WORKFLOW # delete items from rollout repository: object path and type ./deploy-git.sh delete-item "${request_options[@]}" --path=/TestRepo/51_JobTemplates/51_JobTemplate --type=JOBTEMPLATE # delete items from local repository: object path and type ./deploy-git.sh delete-item "${request_options[@]}" --path=/TestRepo/03_VariablesPassing/jdjVariablesJobResource --type=JOBRESOURCE --local |
Updating the JOC Cockpit Inventory from a Git Repository
The operation will update the JOC Cockpit inventory from scheduling objects available in a Git repository.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST APIdecryption request_options=(--url=http://localhost:4446 --user=root --password="$MY_JS7_PASSWORDroot --controller-id=controller) # update items from rollout respository: folder ./deploy-git.sh update-item "${request_options[@]}" --folder=/TestRepo # update items from local respository: folder ./deploy-git.sh update-item "${request_options[@]}" --key=encrypt.keyfolder=/TestRepo --controller-id=controller)local # forupdate example,items whenfrom exportingrollout Agentsrespository: thepath Privateand Keytype is used to decrypt the password on-the-fly for access to the REST APIof object ./deploy-controllergit.sh exportupdate-agentitem "${request_options[@]}" --file=export_agents.zippath=/TestRepo/03_VariablesPassing/jdwVariablesAdHoc-repo --agent-id=StandaloneAgent,AgentClustertype=WORKFLOW |
Resources
- API
- Controller Status Operations
- Workflow Deployment Operations
- Workflow Status Operations
- Identity Service Deployment Operations
- JOC Cockpit Status Operations
...