devops - RicoJia/notes GitHub Wiki

========================================================================

Amazon EKS

========================================================================

  • multiple pods so you can horizontally scale for peak hours, instead of a single ec2 instance
    • create a cluster -> deploy app in pod, using CI/CD, or amazon ECR (container registery)
  • load balancers:
    1. layer 4: transport layer (TCP/IP): IP address, port number, packet size
    2. Layer 7: application layer: depending on HTTP requests, distribute requests.
    3. working principle: round robin, least connections,
      • Do other things, like health check; SSL
      • can cache static content
    4. A pod is not an EC2 (a virtual machine )

========================================================================

Gitlab CI

========================================================================

  1. CI_COMMIT_TAG, CI_COMMIT_BRANCH are pre-defined.
  2. can create a deb package. Which installs scripts to /usr/sbin:
    driver-armhf-build:
      script:
        - mkdir -p ${DEB_NAME}_${DEB_VERSION}${DEB_BRANCH_SUFFIX}_${DEB_ARCH}/usr/sbin
        - cp bash_scripts/* ${DEB_NAME}_${DEB_VERSION}${DEB_BRANCH_SUFFIX}_${DEB_ARCH}/usr/sbin/
    

========================================================================

Ansible

========================================================================

  1. Ansible Basics: a role has a playbook, there's a tasks; yaml.

    • for deploying onto multiple robots
    • role: to group tasks together
    • playbook: yaml file that defines the desired states of systems.
      • task: small unit like install a package, start a service
      • tags: can pass to --tags tag1,tag2 ... so make it "_"
    • inventory: contains list of hosts to control, like moxis
    • update tasks with the script,
  2. Ansible Env vars:

    1. Create liftnet_api_keys.yml
    2. encrypt it using ansible-vault encrypt filename
    3. ansible-playbook playbooks/robot_specific.yml -v -e site=$SITE -kK --limit $ROBOT
  3. How to create API keys:

    1. make sure you can see the ansible-vault password on 1password

    2. If you are creating a yml file, do

      ansible-vault create <NAME>.yml
      
    3. Then, populate Yaml in the form. Or, you can take a look at existing examples, using the diligent credentials above

      ---
      
      FIELD: Value
      
⚠️ **GitHub.com Fallback** ⚠️