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。
浪费了我一晚上的青春。