2019年3月14日 星期四

Hygieia

Github : https://github.com/Hygieia/Hygieia/tree/gh-pages/pages/hygieia
Document : http://hygieia.github.io/Hygieia/getting_started.html

Architecture of Hygieia

Components

LayerDescription
UI LayerThe UI layer (User Interface) is Hygieia’s front- end and contains all the Graphical User Interface (GUI) elements for users to view. It is here where users are also able to configure the dashboard.
API LayerThe Hygieia API layer contains Hygieia APIs and Audit APIs. Hygieia APIs contain all the typical REST API services that work with the source system data (collected by service tasks) and the Internet. Hygieia audit APIs are a collection of API endpoints that serve to audit CI/CD data gathered by Hygieia collectors. This layer is an abstraction of the local data layer and the source system data layer.
DevOps ToolsThis layer entails the multitude of DevOps tools in a CI/CD pipeline. In the diagram, Jira, Git, Sonar, and XLDeploy are listed as examples.
Collectors’ LayerThe Collectors’ Layer fetches data from your DevOps tools. In turn, this data then appears on your Hygieia Dashboard. You can choose to install the collectors applicable to your DevOps tool set from the Hygieia Collectors Inventory.
Database LayerHygieia uses MongoDB as the database for storage and retrieval of data.

Build Hygieia

Build 的時候遇到的問題很多,所幸找到了一個連結。
https://github.com/pravsingh/HygieiaLight
裡面很多指令免得大家踩坑。

Build hygieia-core (這個會過)

git clone https://github.com/Hygieia/hygieia-core
cd hygieia-core
mvn clean install package (need to sudo apt install maven at first)

Build Hygieia (這個有點問題)

git clone https://github.com/Hygieia/Hygieia
cd Hygieia
mvn clean install package (不會過)

找到了這個可以直接 build image 的方法
find . | grep Dockerfile | sed -e 's#/docker/Dockerfile##g' | awk '{print "mvn clean package -pl "$1" docker:build";}' | grep -v "/target" | sh

(似乎要用 sudo )



2019年3月13日 星期三

AWS DynamoDB

AWS DynamoDB

https://docs.aws.amazon.com/en_us/amazondynamodb/latest/developerguide/GettingStarted.Python.04.html


2019年3月12日 星期二

AWS Lambda 自動打包

AWS Lambda 有好工具自動打包,事實上也可以打包到各個雲上。

工具 serverless ,是用 node.js 開發的。只要用 npm 安裝即可,npm 這個工具的介紹就不贅述,網路上資料很多。

安裝工具

npm install -g serverless

試用 serverless

這個工具有提供 很多範例程式 供人測試,我們這次使用 python / aws dynamoDB 這個例子。

git clone https://github.com/serverless/examples.git  (載下範例來)

cd aws-python-rest-api-with-dynamodb  (我們選用這個範例)

原本是可以直接用 serverless deploy 這個指令做 deploy,但是我們現在還沒有設好我們 AWS 上的 credentials,所以還需要設定。

設定 AWS credentials 

這個影片教你如何在 IAM 中拿到 key ID 以及 secret,並且透過指令

serverless config credentials --provider aws --key xxxx --secret xxxx

將其存成預設執行的設定檔。


也有一些設定 credentials 的其他方法。

正式執行 deploy

serverless deploy

輸出如下: 
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
.....
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service serverless-rest-api-with-dynamodb.zip file to S3 (5.37 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
......................................................................................................
Serverless: Stack update finished...
Service Information
service: serverless-rest-api-with-dynamodb
stage: dev
region: us-east-1
stack: serverless-rest-api-with-dynamodb-dev
resources: 34
api keys:
  None
endpoints:
  POST - https://0c1qlf7h8a.execute-api.us-east-1.amazonaws.com/dev/todos
  GET - https://0c1qlf7h8a.execute-api.us-east-1.amazonaws.com/dev/todos
  GET - https://0c1qlf7h8a.execute-api.us-east-1.amazonaws.com/dev/todos/{id}
  PUT - https://0c1qlf7h8a.execute-api.us-east-1.amazonaws.com/dev/todos/{id}
  DELETE - https://0c1qlf7h8a.execute-api.us-east-1.amazonaws.com/dev/todos/{id}
functions:
  create: serverless-rest-api-with-dynamodb-dev-create
  list: serverless-rest-api-with-dynamodb-dev-list
  get: serverless-rest-api-with-dynamodb-dev-get
  update: serverless-rest-api-with-dynamodb-dev-update
  delete: serverless-rest-api-with-dynamodb-dev-delete
layers:
  None

部署完畢。

測試一下能否執行

範例裡面,會個別教學怎麼執行測試。我們直接列出執行狀況:

注意,REST 接觸的端口,就是上面部署完後的輸出結果,上面我用紅色標註。

建立 Todo 資料
$curl -X POST https://0c1qlf7h8a.execute-api.us-east-1.amazonaws.com/dev/todos --data '{ "text": "Learn Serverless" }'

輸出
{"text": "Learn Serverless", "checked": false, "id": "0828b186-4549-11e9-923d-eaf73cc0b517", "createdAt": 1552451558329, "updatedAt": 1552451558329}

查詢 Todo 資料
$ curl https://0c1qlf7h8a.execute-api.us-east-1.amazonaws.com/dev/todos

輸出
[{"text": "Learn Serverless", "checked": false, "id": "0828b186-4549-11e9-923d-eaf73cc0b517", "createdAt": 1552451558329, "updatedAt": 1552451558329}]

是可以正確執行的。


2019年2月11日 星期一

FMEA

FMEA
失效模式效應分析(Failure Mode Effect Analysis: FMEA)
  • 由美國陸軍在 1949 年開發出來的(Military Procedure MIL-P-1629)
  • 現在 FMEA 分析模式是以國際電工委員會 International Electrotechnical Commission ;IEC)所提出之規格為主


FMEA手法最初是用來
  • 改善產品的可靠性
  • 目前其應用跨越產品的生命週期,從產品規劃到設計、製造、建造以及使用等階段,以提高產品或系統的可靠性
  • 預防性技術,分析方法,為了排除失效,在設計確定之前先尋求可能原因或徵兆,在失效發生前,設法減少發生機率,提高產品可靠性


FMEA的實行方式
  • 是以表單形式來解析,指出故障原因,思考對策來改善系統品質
  • 如:對產品地識別名稱、圖面編號、使用條件、故障對系統的影響度、故障等級、故障發生頻率等,找出故障模式的影響度與發生頻率,將其量化可進行故障效應分析
  • 10 個步驟 https://fmea-training.com/10-steps-process-failure-mode-and-effects-analysis/
    • STEP 1: Review the process. ...
      STEP 2: Brainstorm potential failure modes. ...
      STEP 3: List potential effects of each failure. ...
      STEP 4: Assign Severity rankings. ...
      STEP 5: Assign Occurrence rankings. ...
      STEP 6: Assign Detection rankings. ...
      STEP 7: Calculate the RPN.


PFMEA vs DFMEA
  • Process FMEA's (PFMEA) and Design FMEA's (DFMEA) defined in the AIAG FMEA 4th edition


論文


模板

2019年1月31日 星期四

2019年1月28日 星期一

Mirror

git clone --mirror source_repo
git push --mirror dest_repo

即使 更新也可以這樣使用

2019年1月14日 星期一

OpenShift 介紹

OpenShift 介紹


Openshift 是一個 Redhat 所建的 PaaS 服務,讓使用者可以在 k8s 跟 docker 的基礎上,方便快速建構應用程式。



整體架構如下,包含可以讓使用者程式碼可以被建成 image 的 source-to-image


Openshift Overview (10 mins)


詳細 stack 說明


- Redhat 的 OpenShift 投影片

Openshift Workshop (很多實作)

- 超推薦
https://github.com/RedHatWorkshops/openshiftv3-workshop

- AWS 上實現 openshift
https://aws.amazon.com/tw/quickstart/architecture/openshift/

- AWS 快速開始 openshift

Openshift CI/CD Demo (17mins)


    Sonar : 代碼品質管理
    Nexus : Maven Repo 管理器
    Apache Maven : Java 專案管理與自動構建工具


Openshift Source-to-Image (s2i)



Openshift 產品線(紅帽)

PDF 檔案

紅帽被 IBM 收購後,有風險與質疑。但似乎金融界很多都採用紅帽方案。

認證相關課程
 - Linux Academy 
 - Redhat