The following is taken from a production system that we run, which I found might be helpful to others that are enjoying the happiness of using systemd.
交叉編譯openresty,修復支持大文件 (LFS)
老文存檔,有時間補全
http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
http://cgit.openembedded.org/meta-openembedded/tree/meta-webserver/recipes-httpd/nginx/files/nginx-cross.patch
https://stackoverflow.com/questions/4357570/use-file-offset64-vs-file-offset-bits-64
https://digital-domain.net/largefiles.html
https://stackoverflow.com/questions/35575749/how-to-define-file-offset-bits-large-files-macro-for-solaris-and-hp-aix
http://users.suse.com/~aj/linux_lfs.html
Jenkins 中構建有私有模塊的Go項目
更新:
可以使用 athens 來建立全局go modules緩存,管理SSH密鑰會更加方便。
go get
的底層會調用git來clone模塊,因此我們只要保證git clone repo_url
可以無交互正常運行,就可以讓go get
也正常下載模塊。
如果是在本地使用, 則可以安裝hub或者設置將https重寫成ssh地址,以自動使用私鑰下載,而無需交互輸入用戶名密碼。
如果在Jenkins中使用,就算可以馬上使用後刪除,任何時候讓一個ssh私鑰保存在磁盤上都是不安全的。所以我們使用credential.helper + 環境變量,並且用https地址的方式來給git提供用戶名密碼。
使用credential.helper 可以允許git調用配置的命令獲取用戶名和密碼,我們使用一個一行的shell腳本把環境變量$USERNAME
和 $PASSWORD
打印出來:
1 |
git config credential.helper \'!f() { sleep 1; echo "username=${USERNAME}\npassword=${PASSWORD}"; }; f\'' |
這樣,任何時候我們都不會在磁盤上保存用戶名和密碼,所有信息都在內存里。
然後,因為go get
會clone一個新的repo到本地,我們沒有辦法在這之前設置每個repo的credential.helper,所以這個配置必須是全局的設置。我們用一個docker容器來完成整個項目,然後把這個配置通過docker volume掛載到$HOME/.gitconfig下:
1 2 |
[credential] helper = "!f() { sleep 1; echo \"username=${USERNAME}\npassword=${PASSWORD}\"; }; f" |
注意Jenkins的docker插件會傳遞當前的HOME等環境變量,這個目錄往往在容器中不存在,所以我們覆蓋容器中的用戶目錄到/tmp。
完整的Jenkinsfile如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
def GOLANG_VERSION = 1.12 pipeline { agent { docker { image "golang:${GOLANG_VERSION}" args '-v ${WORKSPACE}/.gitconfig:/tmp/.gitconfig -e HOME=/tmp' } } environment { GO111MODULE = "on" GOCACHE = "/tmp/.gocache" GOPATH = "${WORKSPACE}" PATH = "${GOPATH}/bin:$PATH" } stages { stage('Checkout') { steps { withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'CREDENTIAL_ID', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { checkout scm sh 'git config credential.helper \'!f() { sleep 1; echo "username=${USERNAME}\npassword=${PASSWORD}"; }; f\'' sh 'git fetch' } } } stage('Install dependencies') { steps { sh 'go version' script { withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'CREDENTIAL_ID', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { sh "go get -v" } } } } stage('Run tests') { steps { script { sh "go test" } } } stage('Build') { steps { script { sh "go build -o ${item}" } } } } } |
HPE Microserver Gen8 升級安裝 Windows Server 2019
原先安裝的是Windows Server 2016鮮嫩多汁學生版,決定安裝一個成人版操作系統。
下載MSDN的iso鏡像,掛載之後,雙擊setup.exe
- 提示 Windows安裝程序無法找到存儲臨時安裝文件所在的位置。若要安裝Windows,請確保啟動磁盤上分區至少具有xxx兆字節(MB)的可用空間
我這裡的原因是用了TF卡啟動,windows發現啟動分區和系統分區不一致,就哭了。解決辦法是恢復用系統分區引導進入系統。我把存儲池的四塊硬盤都拔掉了,裝完之後可以重新識別,不怕。
還需要把這個註冊表的值改成0或者刪掉:
1 2 3 |
[HKEY_LOCAL_MACHINE\system\ControlSet001\Control] "PortableOperatingSystem"=dword:00000001 |
- 提示 Windows無法從無人參與應答文件讀取<ProductKey>設置
因為之前用了HP的Intelligent Provisioning,系統分區的辣雞還沒清理,刪除系統分區下的autounattend.xml後,問題解決。
安裝前,需要關閉Hyper-V的虛擬機,如果虛擬機用了直通磁盤,則不能為“已保存”狀態。
安裝時,選擇保留用戶設置和文件,泡一杯茶,等待安裝完成。
快一年沒發博客了
大家好,我還活着
近期計劃把草稿都發了
SIM800L EVB x 樹莓派
從Aliexpress上剁了一個SIM800L模塊,長這樣:
VDD接TTL參考電平,需要串口輸出5v(比如51)就接5v,需要輸出3.3v(比如樹莓派)就接3.3v。
要注意的是TTL需要交叉連接,即這個PCB板上的TxD和RxD應該分別接樹莓派上的RxD和TxD。
浪費了我一晚上的青春。