Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Current »

Preconditions

General usage instructions

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

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
Deploy software to instances in project environment

optional arguments:
  -h, --help            show this help message and exit
  -d                    run in debug mode
  -q                    run in quiet mode (only errors are shown)
  -p PROJECT, --project PROJECT
                        The necessary name of the project to work on
  -r ROLE, --role ROLE  Server role to work on
  --pre-hook [PRE_HOOK]
                        run pre-deploy hook scripts in default path "pre-
                        hook.d/" or given directory (optional)
  --post-hook [POST_HOOK]
                        run post-deploy hook scripts in default path "post-
                        hook.d/" or given directory (optional)
  --rev REV             specify tag/branch/revision to clone (git deployment
                        only!)
  --list-roles          list deployable roles and exit
  --list-sources        list source details and exit
  -n                    skip update of source code (optional)
  -m                    skip distribution of source code (optional)

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

~$: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

 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:  

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

Related components


  • No labels