Versions Compared

Key

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

On the jump server the CLI-suite is installed. It initiates the rollout by notifying the configuration management system that this application deployment is to be initiated. The current source code is loaded from the specified sources and stored on a distributed file system for further processing.

Preconditions

General usage instructions

The general usage instructions for the CLI-suite r3can be found at CLI-Suite (root360) or at Code Deploy (root360)

Parallel deployments

Note

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

Code Block
languagebash
~$ r3 deploy -h

# Response
Deploy software to instances in project environment

optional arguments
usage: r3 deploy [-h,] [--helpr ROLE] [--init-hook [INITHOOKDIR]] [--pre-hook [PREHOOKDIR]] [--post-hook [POSTHOOKDIR]] [--rev REV] [-n]  show this help message and exit
  -d                    run in debug mode
  -q       [-m] [--sanity-check] [--list-roles | --list-sources] [-d] [-q]

optional arguments:
  -h, --help            show runthis inhelp quietmessage modeand (onlyexit
errors are shown)
  -pr PROJECTROLE, --projectrole PROJECTROLE  Server role to work on
  --init-hook [INITHOOKDIR]
               The necessary name of the project to work on Run initial -rhook ROLE, --role ROLE  Server role to work onscripts in default path "init-hook.d/" or given directory (optional)
  --pre-hook [PRE_HOOKPREHOOKDIR]
                        runRun pre-deploy hook scripts in default path "pre-
                        hook.d/" or given directory (optional)
  --post-hook [POST_HOOKPOSTHOOKDIR]
                        runRun post-deploy hook scripts in default path "post-
                        hook.d/" or given directory (optional)
  --rev REV             specifySpecify tag/branch/revision to clone (git deployment only!)
  -n, --skip-update     Skip update of source code (optional)
  -m, --skip-deploy     Skip distribution of source code only!(optional)
  --listsanity-rolescheck        only check listthe deployablesanity rolesof andall exitcomponents
  --list-sourcesroles          listList sourcedeployable detailsroles and exit
  --list-nsources        List source details and exit
  -d, --debug    skip update of source code (optional)  Run -min debug mode.
  -q, --quiet           Run in quiet skipmode distribution(only oferrors source code (optional)are shown).

List available applications/roles, which can be deployed

Code Block
languagebash
~$ r3 deploy --list-roles

# Response
+-------+
| Roles |
+-------+
| admin |
+-------+
| api   |
+-------+
| web   |
+-------+

Start a deployment process for application/role

Code Block
languagebash
~$ 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

Code Block
languagebash
~$:r3 [instance] deploy --list-sources [--role ROLE]

# Response
+-------+-------------------+-------------------------------------------------------------+--------+----------+
| Roles | Deployment Method | Source                                                      | Branch | Excludes |
+-------+-------------------+-------------------------------------------------------------+--------+----------+
| web   | git               | ssh://gogs@git.root360.de:2222/3rd-party/simple-php-app.git | master | None     |
+-------+-------------------+-------------------------------------------------------------+--------+----------+

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

Code Block
languagebash
 2016-01-25 22: 34: 16,087 - deploy.py - INFO - Starting Deploying for role "web" in project "xxxxxxxx"
 2016-01-25 22: 34: 16,088 - deploy.py - INFO - Checking out project.
 ************
 2016-01-25 22: 34: 28.957 - deploy.py - INFO - SourcesTests updated
 2016-01-25 22: 34: 29.958 - deploy.py - INFO - Calculating the number of deployed targets.
 2016-01-25 22: 34: 31.891 - deploy.py - INFO - Deploying for 2 target (s).
 2016-01-25 22: 34: 31.892 - deploy.py - INFO - total: 2, success: 0, fail: 0
 ************************************************** **********
 ****************************
 2016-01-25 22: 39: 00.596 - deploy.py - INFO - total: 2, success: 1, fail: 0
 ****************************
 2016-01-25 22: 39: 28.673 - deploy.py - INFO - total: 2, success: 2, fail: 0
 2016-01-25 22: 39: 28,673 - deploy.py - INFO - Deploy finished without errors 

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:  

Code Block
r3 deploy ...;  echo $?

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

Filter by label (Content by label)
showLabelsfalse
max10
sorttitle
showSpacefalse
titleRelated questions
cqllabel in ( "deployment" , "r3-suite" , "application" ) and ancestor = "2014352487" and space = currentSpace ( )

Related components

Filter by label (Content by label)
showLabelsfalse
max10
sorttitle
showSpacefalse
titleRelated questions
cqllabel in ( "deployment" , "r3-suite" , "application" ) and ancestor = "2014350220" and space = currentSpace ( )

Status
colourYellow
titleintermediate

Table of Contents
exclude(Related * | Recommended * |Table of contents).*


Filter by label (Content by label)
showLabelsfalse
max10
sorttitle
showSpacefalse
titleRelated questions
cqllabel in ( "deployment" , "application" , "r3-suite" ) and ancestor = "2014351598" and space = currentSpace ( )