mercredi 17 janvier 2024

Conventional Commits specification

 https://www.conventionalcommits.org/en/v1.0.0/

The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.



for example, to be used with commitlint : 

https://github.com/conventional-changelog/commitlint 



example, on gitlab-ci : https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/merge_requests/85#587d266bb27a4dc3022bbed44dfa19849df3044c


or, at changelog level :

https://github.com/conventional-changelog/conventional-changelog


also cf. commitzen  :

https://github.com/commitizen/cz-cli

lundi 15 janvier 2024

terraform, then ansible

Terraform creates the infra, 
then we want to use ansible to actually configure it...

Different solutions exist to run Terraform, and them ansible:

  • Using Terraform Output as Ansible Inventory :
    https://github.com/adammck/terraform-inventory
     $ terraform-inventory -inventory terraform.tfstate [all] 10.10.1.2 10.10.1.3


  • `local-exec` / `remote-exec` : terraform runs ansible locally 

     ``` provisioner "local-exec" {command = "ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u {var.user} -i '${self.ipv4_address},' --private-key ${var.ssh_private_key} playbook.yml"} ```
    key component here is the ${self.ipv4_address} variable. After provisioning the machine, Terraform knows its IP address. And we need to pass an IP address for Ansible.

     (cf https://www.cprime.com/resources/blog/terraform-and-ansible-tutorial-integrating-terraform-managed-instances-with-ansible-control-nodes )

     

  • using dynamic inventory and cloud providers specific ansible modules 

    •  AWS : https://docs.ansible.com/ansible/latest/collections/amazon/aws/aws_ec2_inventory.html 
    •  GCP : https://docs.ansible.com/ansible/latest/collections/google/cloud/gcp_compute_inventory.html#ansible-collections-google-cloud-gcp-compute-inventory and so on...



AWS example of the dynamic inventory:


ansible.cfg :
enable_plugins=aws_ec2

aws_ec2.yml (example):
plugin: aws_ec2
regions:
  - "us-east-1"
keyed_groups:
  - key: tags.Name
  - key: tags
    prefix: tag
  - prefix: instance_type
    key: instance_type
  - key: placement.region
    prefix: aws_region
filters:
  instance-state-name : running
  # All instances with their `Environment` tag set to `dev`
  tag:Environment: dev
  # All dev and QA hosts
  tag:Environment:
    - dev
    - qa
compose:
  ansible_host: public_ip_address



Good way to test : 
ansible-inventory -i aws_ec2.yml --graph
ansible all –list-hosts



To run a playbook have/generate 4 files : myplaybook.yml, key.pem, aws_ec2.yml (seen before), and ansible.cfg (seen after)


ansible.cfg
[defaults]
inventory=./aws_ec2.yml
host_key_chekcing=false
remote_user=ec2-user
private_key_file=key.pem

[privilege_escalation]
become=true
become_method=sudo
become_user=root


Run 

ansible <group-name> -i aws_ec2.yaml -m ping --private-key=<private-key-name> 

ansible-playbook myplaybook.yml
 (with hosts: _Ansible_TargetNode or whatever you have validated in the output of the inventory)






# sources : 
https://www.cloudthat.com/resources/blog/step-by-step-guide-to-integrate-ansible-dynamic-inventory-plugin-for-aws-ec2-instances#why-ansible-dynamic-inventory-

https://medium.com/geekculture/a-complete-overview-of-ansible-dynamic-inventory-a9ded104df4c



jsonnet

K8s mixins & jsonnet demo : https://youtu.be/GDdnL5R_l-Y?si=6stnX7hCbdfidIK2&t=413 Jsonnet tester : https://jsonnet.org/

vendredi 10 novembre 2023

Quantum Careers - Part 2: Learning about Quantum Computing in Healthcare (meetup, ref links)

From : https://www.meetup.com/technical-group-hosted-by-ibm/events/296566612
Here are links to the resources that Aarushi and Wiktor discussed during the session, which will allow you to explore this content at your own pace. For those who were unable to attend, these links will provide you with some of what you missed and more! - https://www.mckinsey.com/industries/pharmaceuticals-and-medical-products/our-insights/real-world-evidence-from-activity-to-impact-in-healthcare-decision-making - https://www.scientificamerican.com/article/genetics-start-up-wants-to-sequence-peoples-genomes-for-free/ - https://phys.org/news/2018-10-people-dna-sequenced-theyve-privacy.html - https://www.sciencemag.org/news/2018/10/we-will-find-you-dna-search-used-nab-golden-state-killer-can-home-about-60-white - https://media.nature.com/original/magazine-assets/d41586-019-02873-1/d41586-019-02873-1.pdf - https://scienceblog.cancerresearchuk.org/2014/09/22/saving-lives-and-averting-costs-the-case-for-earlier-diagnosis-just-got-stronger/ - https://www.ohe.org/system/files/private/publications/401%20-%20Trajectory_dementia_UK_2014.pdf - https://www.nature.com/articles/s41592-021-01199-z - https://link.springer.com/article/10.1007%2Fs42484-020-00017-7 - https://www.t-systems.com/en/best-practice/03-2018/focus/digital-twin/healthcare-840446 - https://www.who.int/cancer/prevention/en/ - http://lexisnexis.com/risk/downloads/idm/bending-the-cost-curve-analytic-driven-enterprise-fraud-control.pdf - https://www.insurancejournal.com/news/national/2019/10/08/544846.htm - https://www.scientificamerican.com/article/genetics-start-up-wants-to-sequence-peoples-genomes-for-free/ - https://phys.org/news/2018-10-people-dna-sequenced-theyve-privacy.html - https://www.sciencemag.org/news/2018/10/we-will-find-you-dna-search-used-nab-golden-state-killer-can-home-about-60-white - https://www.sciencedirect.com/science/article/abs/pii/S0167629616000291 - https://pharmaintelligence.informa.com/~/media/informa-shop-window/pharma/2020/files/reports/top-10-best-selling-drugs-of-2019.pdf - https://arxiv.org/abs/1802.00810 - https://www.ncbi.nlm.nih.gov/books/NBK116445/ - https://www.nature.com/articles/nature03192 - https://www.pnas.org/content/pnas/89/1/20.full.pdf - https://www.ncbi.nlm.nih.gov/pmc/articles/PMC48166/pdf/pnas01075-0036.pdf - https://books.google.de/books?id=ZVEUniZITlEC&pg=PA194&lpg=PA194&dq=levinthal+10143&source=bl&ots=rj16K98Pl6&sig=ACfU3U3W5LiaEdUX73fh-aiGcF6bg9_idg&hl=en&sa=X&ved=2ahUKEwjqoNX75aDlAhUeAhAIHWXHA_oQ6AEwC3oECAsQAQ#v=onepage&q=levinthal%2010143&f=false - https://www.globenewswire.com/news-release/2019/04/04/1797292/0/en/Biologics-Market-Size-to-cross-USD-285-520-4-Million-by-2023-at-6-95-CAGR-Highly-Competitive-Pharmaceutical-Sector-to-Boost-Global-Industry-Growth.html - https://arxiv.org/abs/2307.05734

jeudi 26 octobre 2023

dev hub / plateform engineering : backstage.io

 https://backstage.io/ 

from spotify, released open source.

"An open platform for building developer portals

Powered by a centralized software catalog, Backstage restores order to your infrastructure and enables your product teams to ship high-quality code quickly — without compromising autonomy."




https://backstage.io/plugins/


Red Hat developer-hub is a backstage implementation :

https://developers.redhat.com/articles/2023/05/23/developers-guide-red-hat-developer-hub-and-janus#

https://developers.redhat.com/products/plugins-for-backstage/overview

mardi 17 octobre 2023

prometheus, grafana, alertmanager: number of alerts

 prometheus alerts counts


from : https://jaanhio.me/blog/visualizing-alerts-metrics-grafana/ + https://community.grafana.com/t/how-to-get-the-time-range-selected-on-the-dashboard-into-a-variable/2868/3

(sum by (alertname) (changes(ALERTS_FOR_STATE[$__range]) AND ignoring(alertstate) max_over_time(ALERTS{alertstate="firing"}[$__range])) + (count by (alertname) (changes(ALERTS_FOR_STATE[$__range]) AND ignoring(alertstate) max_over_time(ALERTS{alertstate="firing"}[$__range])) * 1))


Then use a grafana panel as "Gauge" with the following options :

* Value options: show calculate, Last *

* Orientation = horizontal, and 



Number of alerts by alert name of the last 2 months

PromQL = sum by(alertname) (changes(ALERTS_FOR_STATE[65d]))



Number of alerts by instance over the last 2 months

PromQL = sum by(instance_name) (changes(ALERTS_FOR_STATE[65d]))

vendredi 22 septembre 2023

Google post-mortem culture (SRE)

 https://sre.google/sre-book/postmortem-culture/

and links to :

https://sre.google/sre-book/bibliography/





More generally included in :

https://sre.google/sre-book/foreword/


platforms/products to manage an API

 platforms/products  to manage an API

Kong