Ubuntu 22.04 LTS 出版

Okay,各家 DevOps Engineers & SRE 可能又要忙碌了,兩年一度的盛事,Ubuntu 22.04 LTS 出版:「Canonical Ubuntu 22.04 LTS is released」。

其中有一些比較特別的消息,像是這次是 Ubuntu Desktop 這邊正式支援 Raspberry Pi 4 平台:

For innovators on Raspberry Pi, Ubuntu 22.04 LTS marks the first LTS release with Ubuntu Desktop support on the Raspberry Pi 4.

照慣例先放一個月再看看,通常三個月後應該會把大家常見的問題都修差不多,我這邊 Desktop 是用換成 XfceXubuntu,要再等一下...

Amazon CloudFront 要增加自訂網域名稱需要先過認證...

大概猜得到原因,總算是把這塊做下去了...

AWS 宣佈 CloudFront 增加自訂網域名稱需要先過認證才能啟用:「Amazon CloudFront enhances the security for adding alternate domain names to a distribution」,也就是把自己的 domain name 掛到 CloudFront 上需要先認證過。

這邊的認證需要用公開被信任的 SSL Certificate,而大多數人應該會直接拿 AWS 提供的 ACM 來用:

With this change, when you add an alternate domain name using the AWS Management Console or the CloudFront API, you will now need to attach a certificate to the distribution to confirm that you have authorized rights to use the alternate domain name. The certificate must be valid and come from a publicly trusted Certificate Authority like AWS Certificate Manager which provides public SSL/TLS certificates for free.

申請 ACM 也需要確認身分,印象中沒記錯的話是透過 DNS 或是 e-mail 認證。

會有這個改變是因為有一個 DDoS 的攻擊手法可以「造成困擾」。在沒有認證就可以增加網域名稱的情況下 (假設是 assets.gslin.com),AWS 需要把不同帳號設定同一組 domain name (assets.gslin.com) 的 IP address 分開,這樣才能確保安全性。而 IPv4 address 是有限的,用很多帳號申請就有機會讓真正的 assets.gslin.com 擁有人想要用的時候沒有資源可以用。

其實在 Route53 也有類似的問題,但因為是個雞生蛋蛋生雞的問題,就更不好解決了,在 DNS 還沒設定好之前要怎麼確認身分是一個更頭痛的問題... e-mail 認證可能是一個方法,但流程上就多了不少步驟。

各種 Java 的版本

看到這則 tweet,提到 Java 的支援度:

主要是裡面有張圖列出了目前市場上有的選擇,可以當關鍵字來查:

目前看起來如果要 Java 8 只有三個方案,其中有過 TCK 的只有兩個,看起來用 Amazon Corretto 算是個還不錯的選擇?

AWS 決定花力氣支援 OpenJDK (Corretto 計畫)

AWS 推出了 Amazon Corretto (其中 Corretto 這個名字應該是取自 Caffè corretto,還是跟咖啡有關的字),提供 OpenJDK 的長期支援:「Introducing Amazon Corretto, a No-Cost Distribution of OpenJDK with Long-Term Support」。

文章裡提到了幾個重點,第一個是目前先推出了 Corretto 8 Preview (對應到 OpenJDK 8),而之後 GA 會推出 UbuntuRHEL 上的套件,另外也打算推出 Corretto 11 (對應到將來的 OpenJDK 11):

The Corretto 8 preview corresponding to OpenJDK 8 is available at this time for Amazon Linux 2, Microsoft Windows, and macOS platforms and Docker image. Preview builds can be downloaded by visiting aws.amazon.com/corretto. General Availability is planned for Q1 2019, and will also include Ubuntu and Red Hat Enterprise Linux platforms. Corretto 11 builds corresponding to Open JDK 11 on these platforms will follow with ample time for testing before April 2019.

再來是支援期都差不多是四~五年:

Amazon will distribute security updates to Corretto 8 at no cost until at least June, 2023, and to Corretto 11 until at least August, 2024.

這樣在又多了一些選擇...

PHP 的 Memcached 的眉眉角角...

PHPMemcached 整理一下,未必適合其他人用。

設定上:

  • 平常應該要打開 libketama 相關設定,包含了 OPT_DISTRIBUTIONOPT_LIBKETAMA_COMPATIBLE
  • 多台 server 要注意使用 hostname 或是 IP address 連線 (尤其跨程式語言時),在 consistent hash 時會有差異。要避免因為 hostname 發生的問題,可以把這段設定放到 JSON 檔裡與其他程式語言共用。
  • 使用 SERIALIZER_JSON,一樣是為了與其他程式語言相容。

使用上:

  • add() 在 key 存在時會失敗,set() 則會覆蓋過去。
  • add()set() 裡的 expiration 參數是 UNIX timestamp,而非直覺的秒數...
  • get() 的 callback 不應該使用,因為無法設定 expire time。
  • memcached 的 manual 有寫預設值是使用冒號 (:) 當作 key 的分隔,這對於統計資料會有幫助。

先整理到這...

Amazon CloudFront 支援 Wildcard 了...

Amazon CloudFront 在 CNAME 的地方可以填 *.example.com 表示這個 distribution 要吃所有 domain:「CNAME Wildcard Support for Amazon CloudFront」。

這用在 asset 類的服務很好用,可以設定 *.asset.example.com,然後就可以用 {1,2,3,4}.asset.example.com 打散掉。以往則是要手動設多個 domain,沒辦法隨便調整...