devops - RicoJia/notes GitHub Wiki
========================================================================
========================================================================
- 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:
- layer 4: transport layer (TCP/IP): IP address, port number, packet size
- Layer 7: application layer: depending on HTTP requests, distribute requests.
- working principle: round robin, least connections,
- Do other things, like health check; SSL
- can cache static content
- A pod is not an EC2 (a virtual machine )
========================================================================
========================================================================
-
CI_COMMIT_TAG, CI_COMMIT_BRANCH
are pre-defined. - 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 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,
- molecule tests, spins up a docker container. (how) - item potency? verge, run the role twice; should be no changes on the second test - like in math, f(x) = f(f(x)) - test itself.
https://www.jeffgeerling.com/blog/2018/testing-your-ansible-roles-molecule
molecule test --destroy=never molecule login
- molecule tests, spins up a docker container. (how) - item potency? verge, run the role twice; should be no changes on the second test - like in math, f(x) = f(f(x)) - test itself.
https://www.jeffgeerling.com/blog/2018/testing-your-ansible-roles-molecule
-
Ansible Env vars:
- Create liftnet_api_keys.yml
- encrypt it using
ansible-vault encrypt filename
- ansible-playbook playbooks/robot_specific.yml -v -e site=$SITE -kK --limit $ROBOT
-
How to create API keys:
-
make sure you can see the
ansible-vault
password on 1password -
If you are creating a yml file, do
ansible-vault create <NAME>.yml
-
Then, populate Yaml in the form. Or, you can take a look at existing examples, using the diligent credentials above
--- FIELD: Value
-