Deployment via CLI-suite

Preconditions

General usage instructions

The general usage instructions for the CLI-suite r3 can be found at or at

Parallel deployments

Starting the deployment of several roles at the same time (“parallel deployments”) is only possible under these conditions:

  • Roles for parallel deployment must not be on the same instances.

  • You must run the deployment in two stages:

    • Stage 1: Update the sources sequentially in one ssh session (parameter -m): r3 deploy -mr role1; r3 deploy -mr role2

    • Stage 2: Deploy the source code to the target instances (parameter -n) in separate ssh sessions for each role:

      1. SSH-Session 1: r3 deploy -nr role1

      2. SSH-Session 2: r3 deploy -nr role2

Available CLI commands

Show help context

~$ r3 deploy -h # Response usage: r3 deploy [-h] [-r ROLE] [--init-hook [INITHOOKDIR]] [--pre-hook [PREHOOKDIR]] [--post-hook [POSTHOOKDIR]] [--rev REV] [-n] [-m] [--sanity-check] [--list-roles | --list-sources] [-d] [-q] optional arguments: -h, --help show this help message and exit -r ROLE, --role ROLE Server role to work on --init-hook [INITHOOKDIR] Run initial hook scripts in default path "init-hook.d/" or given directory (optional) --pre-hook [PREHOOKDIR] Run pre-deploy hook scripts in default path "pre-hook.d/" or given directory (optional) --post-hook [POSTHOOKDIR] Run post-deploy hook scripts in default path "post-hook.d/" or given directory (optional) --rev REV Specify tag/branch to clone (git deployment only!) -n, --skip-update Skip update of source code (optional) -m, --skip-deploy Skip distribution of source code (optional) --sanity-check only check the sanity of all components --list-roles List deployable roles and exit --list-sources List source details and exit -d, --debug Run in debug mode. -q, --quiet Run in quiet mode (only errors are shown).

List available applications/roles, which can be deployed

~$ r3 deploy --list-roles # Response +-------+ | Roles | +-------+ | admin | +-------+ | api | +-------+ | web | +-------+

Start a deployment process for application/role

~$ r3 deploy --role YOUR-ROLE

Review configured deployment sources

r3 deploy --list-roles allows you to see the static configuration for each application/role of the respective environment, e.g. prod.

Response explanation

  • Role: the name of the role

  • Deployment Method: names the method (see details below) used

  • Source: The source repository or path in filesystem used to obtain data from

  • Branch: In case of Git a branch was named by you during setup. You can overwrite this reference by giving the --rev command line option.

  • Excludes: If the filesystem is used as source, sometimes files or folders should be excluded from deployment generally or to protect against human error ( e.g. .git/* or /cache)

List deployment sources

Response explanation

  1. The response is presented to the command line directly.

  2. The response is logged to /var/log/application/deploy.log on the JumpServer for downstream analysis.

  3. On each target /var/log/application/deploy.log furthermore locally captures additional process information for deeper downstream analysis.

  4. Exit Codes are returned for programmatic integration e.g. in CI/CD (details can be found below).

Response Example

Supported methods for loading the source code

Method

Authentication

Description

git

Private-public-key via SSH

Clones a Git repository over SSH (recommended)

svn 

Username Password

Clones an SVN repository over HTTP / HTTPS 

HTTP / HTTPS 

Username Password 

Loads packed source code (eg Zip / Tar) 

rsync 

Private-public-key via SSH 

Synchronizes source code from a server via SSH 

Exit codes

The Deploy script returns different exit codes in case of an error.

These can be read in the shell with the following command, for example:  

Breakdown of the codes

code

importance

solution

0

Deployment was successful

 

1

Could not run install.sh

Read the error message (red) accurately and correct the error

2

Error updating from project sources

Access to the location of the project sources (eg customer Git servers)

3

Failed to determine the number of servers to update

Open the support ticket

4

Failed to update servers

Check log file /var/log/application/deploy.log for issues

5

Users can not be resolved for hooks

Open support ticket and append Deployment Log at /var/log/application/deploy.log

6

A hook terminated with non-zero return code

Check the output of the hook and correct the fault

7

There was a global Hook execution error

Check output of hooks and eliminate errors

8

No valid hooks found in the specified path

Hook option or at least one valid hook script

9

A deployment is already in progress

Check who started a deployment and wait for it to complete

10

An unknown error occurred

Open support ticket and append Deployment Log at /var/log/application/deploy.log

11

Can not connect to the configuration management system

Open support ticket and append Deployment Log at /var/log/application/deploy.log

12

Maximum number (10) achieved at simultaneous deployments

Wait for the ongoing deployments to terminate

13

The user canceled the deployment with Ctrl + C

Ask users for the reason and, if necessary, start deployment again

15

project is missing and could not be determined

Specify project using '–project' option

16

role is missing and could not be determined

Specify role using '–role' option

17

given role is unknown

check role given with '–role' option for typos and fix those

18

Encountered a timeout while waiting for status messages

Open a support ticket mentioning the used commandline and the whole command output

19

Found some minions that cannot be deployed

wait up to 10 minutes and try again

20

Got several different states during minion count resulting in deploy stop

check messages returned by the minions and solve the specified issues, if that's not possible contact our support with the output

21

Retry limit for getting available port reached

Contact our support with the output and deploy command

22

revision is unknown and could not be determined

Revision parameter (--rev) missing

23

unable to detect IP address

Contact our support with the output and deploy command

 

Related tutorials

Related components

 

 


root360 Knowledge Base - This portal is hosted by Atlassian (atlassian.com | Privacy Policy)