星期六, 7月 13, 2024

helm images

 適用情境,客戶是離線環境,沒辦法直接拉 container image,所以要先知道 helm chart 裏面用到的 container image,用這指令,就可以找到所有 helm chart 所使用到的 image,再用 skopeo/podman pull/docker pull 拉取下來,存為 tarball ,並帶到客戶端。

專案網址:https://github.com/nikhilsbhat/helm-images

安裝

安裝好 helm 以後,可以用以下指令安裝

helm plugin install https://github.com/nikhilsbhat/helm-images

使用

簡單說,就是拿 helm install 的指令來用,並改為 helm images get。

所以在配置好 helm repo 以後,就可以用 helm images 取得

例如 redis-operator

helm images get redis redis-operator/redis-operator

又例如 zabbix operator

helm images get zabbix zabbix-chart-7.0/zabbix-helm-chrt

就可以取得 container images 的網址。


題外話,應該要來熟悉一下 skopeo 怎麼用才是。

星期五, 6月 21, 2024

使用systemctl 啟用podman出現Failed to connect to bus

在使用 sudo/su 切換身份以後,用以下指令去啟用/啟動 podman 服務,會出現以下錯誤

Failed to connect to bus: No such file or directory

查了以後,才知道是少了 DBUS 環境變數的問題:https://stackoverflow.com/questions/73814619/permission-denied-trying-to-use-rootless-podman-docker-compose-traefik-with

這個時候,只要查到 DBUS 的 socket 路徑,再去 export DBUS 環境變數即可

export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
$ systemctl --user enable --now podman

啟用以後,會有 podman.sock 檔案,這個檔案的位置跟 root 身份的位置不一樣,會是在

/run/user/$UID/podman/podman.sock

這邊是要特別注意的。

星期日, 4月 07, 2024

終端機快速複製檔案內容到剪貼簿

資料來源:How to copy and paste within a terminal in macOS or Linux?

在 MacOS 下,可以用 pbcopy/pbpaste

cat file.txt | pbcopy
pbpaste | tee foo.txt

在 Linux 下,要用 xsel,主要是參數 –input 跟 –output

# 複製到剪貼簿
cat file.txt | xsel --clipboard --input
xsel --clipboard --output | tee foo.txt

若要讓指令一致,可以用 alias

alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'

星期日, 3月 03, 2024

如何使用podman volume掛載nfs分享

資料來源:Mount an NFS Share Using a Rootful Podman Volume (oracle.com)

在建立 volume 時,就可以指定 nfs 的資訊

sudo podman volume create --opt type=nfs --opt o=rw --opt device=10.0.0.150:/nfs-share nfsvol

在建立完成後,podman 會去掛載 nfs 分享,這部份可以使用 mount 查看到掛載到哪個資料夾。接下來 podman 就可以使用 -v 參數,去指定要使用剛剛建立的 volume ,容器啟動後,就可以使用了。

例如

sudo podman run -v nfsvol:/foo -it --rm oraclelinux:9 ls -al /foo

這就表示把建立好的 nfsvol ,掛載到容器裡面的 /foo ,應用程式就可以存取到了。

網站是用wordpress做的嗎?

最近在幫朋友找 wordpress 佈景主題,所以在找是不是有工具可以分析網站,取得資訊。

結果就找到這篇:How to Discover Which WordPress Theme a Site is Using – GreenGeeks

這篇文章介紹了四個方法,其中一個方法是借助 IsItWP 這個網站。這個網站除了可以偵測網站是否用 wordpress 做的之外,也可以分析裡面用到的 plugin 或是 theme,真的是很方便。

其他兩個網站分別是

使用方法都很簡單,貼上要分析的網址就可以了。

最後一個萬不得已的方法就是看網頁原始碼了。