In this section:

Customer Method to Install Life Cycle Manager 

The Ribbon Life Cycle Manager (LCM) provides SBC upgrades in AWS. Once the LCM AMI is launched, files aws_access.yml and upgrade-revert.yml templates (needed for upgrade) are located in the /home/ec2-user/raf-240/management/SBC/upgrade directory.

Prerequisite

Steps

  1. Launch a t2.micro instance with LCM AMI
  2. Once successfully instantiated, log into the instance as ec2-user and switch to root:

    ssh -i lcm.pem ec2-user@<LCM instance IP address>
    sudo su -
  3. Create a directory within /home/ec2-user/ using the command:

    mkdir /home/ec2-user/raf-240
  4. Copy the LCM tarball "iac_sustaining_21.10_b286.tar.gz" to /home/ec2-user/raf-240.
  5. Untar the tarball inside /home/ec2-user/raf-240 using the command: 

    tar -xzvf iac_sustaining_21.10_b286.tar.gz
  6. Change to the /home/ec2-user/raf-240 directory and view the README file for any updated instructions.
  7.  Install python-pip package using method appropriate for OS - see examples:

    1. Amazon Linux 2 AMI (HVM), SSD Volume Type (x86_64): amazon-linux-extras install epel; yum install -y python-pip
    2. CentOS7 : yum install -y epel-release; yum install -y python2-pip
    3. RHEL7: yum install -y python2-pip
    4. Debian9/Ubuntu18: apt-get install python-pip
  8. Install Python virtual environment using command "pip install virtualenv".
    Refer to: https://packaging.python.org/guides/installing-using-pip-and-virtualenv/ for additional info on pip virtualenv
  9. Activate the python virtualenv with command "python -m virtualenv rafenv"
  10. Run the RAF activate script  using command:

    sudo source /home/ec2-user/raf-240/rafenv/bin/activate


  11. Complete the LCM instance setup by running the command: 
    ./setup.py
  12. Change directory to /home/ec2-user/raf-240/management/SBC/upgrade.
  13. List the contents of the directory.
  14. Ensure the following files are present:
    1. upgrade.py
    2. aws_access.yml
    3. upgrade-revert.yml


It is safe to shut down the LCM instance after the process finishes. If you decide to terminate/remove the LCM instance, ensure to take a backup of the entire /home/ec2-user/raf-240 directory that you can use, if needed, for a future rollback.

Customer Methods for Upgrading and Reverting

Prerequisites

  • The new SBC and LCM AMI must be uploaded and available in AWS.
  • You must have an AWS Instance (t2.micro) with installed Life Cycle Manager (LCM) AMI. (The default aws_access.yml, upgrade-revert.yml, will be present in the /home/ec2-user/raf-240/management/SBC/upgrade/ directory of the LCM instance.)
  • The minimum requirements for this setup are 4 GB RAM, 10 GB HDD, and 2 virtual CPUs.
  • Make sure that the SBC instances' security group setting allow the LCM instances to reach the SBC instances' mgmt IP on ports 22, 443 and 444 for ssh, sftp and http services.
  • The LCM instance must have enough privileges to access AMI, start/stop instances, make volume, attach, detach volume, show, start, stop, reboot and update instances.

Steps

  1. Open a session to the Life Cycle Manager instance (LCM) and switch to root.
  2. Enter the LCM virtual environment using command "source rafenv/bin/activate".
  3. Change to /home/ec2-user/raf-240/management/SBC/upgrade and enter the workflow directory:

    ssh -i lcm.pem ec2-user@<LCM instance IP address>
    
    sudo su - source rafenv/bin/activate
    
    cd /home/ec2-user/raf-240/management/SBC/upgrade
  4. Edit the file /home/ec2-user/raf-240/management/SBC/upgrade/aws_access.yml to provide AWS access details and HA pairing information. This information is used for mapping HA pairs. An example of a completed aws_access.yml file is shown below.

    Note

    Use either the private management IP address or the elastic IP address of instance1/instance2. Whichever you chose, ensure the IP address is reachable from the RAF/LCM server to the SBC SWe.

    aws_access.yml
    ############################################################################
    # This file has 2 blocks of information:
    #   1) AWS access details
    #   2) SBC Instance/group details
    # Update this file as per the directions provided at respective fields
    #############################################################################
    #AWS access details should be sourced as environment variables as follows:
    #export AWS_ACCESS_KEY_ID=my-aws-access-key
    #export AWS_SECRET_ACCESS_KEY=my-aws-secret-key
    #############################################################################
    #
    # Update AWS region and zone
    #
    provider: "aws"
    region: "ap-southeast-1"
    zone: "ap-southeast-1c"
     
    #
    # Update SBC instance's CLI login details, user must be Administrator group, e.g. default user 'admin'
    #
    login_details:
          username: "admin"
          password: "myAdminPassword"
    #
    # Update redundancy group details
    #    1) In case of active/standby (1:1) configuration, provide details of both the instances in a redundancy group. Order doesn't matter.
    #    2) In case of standalone (single node) configuration, a redundancy group will have info of the single instance only.
    # If username and password are same for all the instances and same as in "login_details" above,
    # can remove those lines, e.g. a simpler version looks like this:
    #      instance1:
    #            instance_id: "i-my-instance-id-1"
    #            instance_ip: "1.2.3.4"
    #
    # Note: The script is limited to support just 1 redundancy group. Please dont add other redundancy group to this file else it will fail.
    redundancy_group:
          instance1:
                instance_id: "i-my-instance-id-1"
                instance_ip: "1.2.3.4"
                login_details:
                      username: "admin"
                      password: "myAdminPassword"
     
          instance2:
                instance_id: "i-my-instance-id-2"
                instance_ip: "1.2.3.5"
                login_details:
                      username: "admin"
                      password: "myAdminPassword"

Upgrading


  1. Edit the file /home/ec2-user/raf-240/management/SBC/upgrade/upgrade-revert.yml to provide AMI ID, Upgrade Tag and order of instance upgrade to the new SBC version. The following example provides the  AMI version to use for the upgrade and specifies to upgrade instance i-0987654321dcba and then instance i-0123456789abcd.

    upgrade-revert.yml
    #
    # Image/AMI id to use for upgrade
    #
    image_id: ami-001122334455abcd
    #
    # A tag to uniquely identify this upgrade. Logs and directory structure of logs are tagged
    # with these so that future reference to these will be easier with appropriate tag.
    # When the same system goes through multiple upgrades, this becomes a very handy way to jump to right set of logs.
    #
    upgrade_tag: RAF_UPGRADE_70S406_72S400_344
    #
    # Order of upgrade:
    # All the instances listed under one group gets upgraded in parallel, so they get stopped, rebuilt and started in parallel.
    #
    # WARNING: If both active and standby of a HA pair are listed in the same group, that will impact service.
    #
    # On successful upgrade of instances in one group, instances in next group will be picked.
    # Example Usecases:
    #   1) While upgrading a 1:1(active/standby), list standby in first group and active in second group
    #   2) If want to upgrade just standby, list that in first group and remove group 2
    #
    tasks:
          # Each upgrade group should have a list of instance that will be upgraded in parallel
          upgradeGroup1:
                tag: RAF_UPGRADE_ACTIVENEW-1
                instances:
                      - i-0987654321dcba
          upgradeGroup2:
                tag: RAF_UPGRADE_STDBYNEW-1
                instances:
                      - i-0123456789abcd
  2. From the LCM session /home/ec2-user/raf-240/management/SBC/upgrade, run the upgrade command with aws_access.yml and upgrade-revert.yml as inputs:

    ./upgrade.py -a aws_access.yml -u upgrade-revert.yml

    For an offline upgrade, use the command:  ./upgrade.py -a aws_access.yml -u upgrade-revert.yml -o

    Upgrade progress and logs are shown on-screen and also logged in /home/ec2-user/raf-240/management/log/SBC/upgrade/aws/latest.

  3. After successfully upgrading all nodes listed in upgrade-revert.yml, timestamped logs are moved to /home/ec2-user/raf-240/management/log/SBC/upgrade/aws/history.

    Volumes with older software versions are left intact on AWS in case they are needed for future reversions. Information about these volumes is stored in the file with instance-id as part of its name. Do not delete these older volumes – you must have these volumes in order to perform a reversion.

Reverting

  1. Edit the file /home/ec2-user/raf-240/management/SBC/upgrade/upgrade-revert.yml by designating the instances to revert. The following example provides a list of instances. 

    • The reversion process runs in parallel on all the instances, and could impact service.
    • Make sure that all the instances of a redundancy group get reverted to same SBC version, failure to maintain the same version within a group will cause unknown behavior and could cause a service outage.
    upgrade-revert.yml
    #
    # Image/AMI id to use for upgrade
    #
    image_id: ami-001122334455abcd
    #
    # A tag to uniquely identify this upgrade. Logs and directory structure of logs are tagged
    # with these so that future reference to these will be easier with appropriate tag.
    # When the same system goes through multiple upgrades, this becomes a very handy way to jump to right set of logs.
    #
    upgrade_tag: RAF_UPGRADE_70S406_72S400_344
    #
    # Order of upgrade:
    # All the instances listed under one group gets upgraded in parallel, so they get stopped, rebuilt and started in parallel.
    #
    # WARNING: If both active and standby of a HA pair are listed in the same group, that will impact service.
    #
    # On successful upgrade of instances in one group, instances in next group will be picked.
    # Example Usecases:
    #   1) While upgrading a 1:1(active/standby), list standby in first group and active in second group
    #   2) If want to upgrade just standby, list that in first group and remove group 2
    #
    tasks:
          # Each upgrade group should have a list of instance that will be upgraded in parallel
          upgradeGroup1:
                tag: RAF_UPGRADE_ACTIVENEW-1
                instances:
                      - i-0987654321dcba
          upgradeGroup2:
                tag: RAF_UPGRADE_STDBYNEW-1
                instances:
                      - i-0123456789abcd
  2. From the LCM session //home/ec2-user/raf-240/management/SBC/upgrade/, run the revert command with aws_access.yml and upgrade-revert.yml as inputs:

     ./revert.py -a aws_access.yml -u upgrade-revert.yml

    Reversion progress and logs are shown on-screen and also logged in /home/ec2-user/raf-240/management/log/SBC/revert/aws/latest.

  3. After successfully reverting all nodes listed in upgrade-revert.yml, timestamped logs are moved to /home/ec2-user/raf-240/management/log/SBC/revert/aws/history.

    Volumes with older software versions are left intact on AWS in case they are needed for future reversions. Information about these volumes is stored in the file with instance-id as part of its name. Do not delete these older volumes – you must have these volumes in order to perform a reversion.