Git stash したら add しておいたファイル(stagedなファイル)が消えた?
消えてません。 戻すコマンドは
git stash pop
chefでgitのdeploy key使うサンプル
deploy keyを使ったりするサンプル privateでも使える
stackoverflowで見かけたやつにちょっと手を入れてます
ssh_configにgithubの接続先書きわけてもいいんですけど単一のrecipeにぺぺっとコピペする用
deploy keyだけfiles/に置いて上三行書き換えれば使えるはず。。。
private_repository = "git@github.com:org/repo.git" deploy_directory = "/opt/toolname" source_ssh_deploykey = "github-deploy.pem" github_ssh_wrapper = "/root/.ssh/github_git_wrapper_#{source_ssh_deploykey}.sh" github_ssh_deploykey = "/root/.ssh/#{source_ssh_deploykey}" cookbook_file "#{github_ssh_deploykey}" do source "#{source_ssh_deploykey}" mode 0600 end file "#{github_ssh_wrapper}" do mode 0755 content "#!/bin/sh\nexec /usr/bin/ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i #{github_ssh_deploykey} \"$@\"" end package "git" do action :install end git "#{deploy_directory}" do repository "#{private_repository}" action :sync ssh_wrapper "#{github_ssh_wrapper}" end
GCP(GCE)でalias ipを使う
IPエイリアスとかVIPとかeth0:0みたいなやつです。
と言っても現状、
Configuring an Instance's IP Addresses - Compute Engine — Google Cloud Platform
Choose an IP address that doesn't belong to any network in your project.
なので物理と同じ感覚では使えません。
AWSのVPCでもインターフェース付け替えとか似たようなものですが…。
一台だけの場合
- IP転送オプション付きでinstanceを起動する
- VIPを決めてeth0:0に付与する
- routingでinstanceを指定して転送する
二台以上準備してVIPを付け替えたい場合
- 該当するすべてのinstanceで上記の2.までの処理をしておく
- 付け替え時はroutingの宛先を変更する
- 前のルールを削除→宛先を再作成、またはroutingのpriorityを高くして差し込む
ぐらいでしょうか。
付け替えるには、APIアクセスを許可したinstanceを使うのが楽です。
もしgoogleで辿り着いた方はMHAやredis-sentinelをGCE上で運用したいのかもしれませんが、素直にCloudSQL使ったりtwemproxy-agent使ったりするほうがいいでしょう。
curlでbashスクリプトを実行して引数も与える
curl -L https://www.chef.io/chef/install.sh | bash -s -- -v 12
まあこういうやつですね。
bashのオプション
-s
-s オプションが指定された場合と、 オプションを全て処理した後に引き数が残っていなかった場合には、 コマンドは標準入力から読み込まれます。 このオプションを使うと、 対話的シェルを起動するときに 位置パラメータを設定できます。--
-- はオプションの終わりを示し、それ以降のオプション処理を行いません。 -- 以降の引き数は全て、ファイル名や引き数として扱われます。 引き数 - は -- と同じです。
[改訂新版] シェルスクリプト基本リファレンス ??#!/bin/shで、ここまでできる (WEB+DB PRESS plus)
- 作者: 山森丈範
- 出版社/メーカー: 技術評論社
- 発売日: 2011/04/27
- メディア: 単行本(ソフトカバー)
- 購入: 9人 クリック: 119回
- この商品を含むブログ (10件) を見る
OSXのcurlで正しいSSL証明書でInvalid certificate chainと警告が出る
最新版のchromeでは正常に表示される証明書がcurl経由だとエラーになる。
* SSL certificate problem: Invalid certificate chain curl: (60) SSL certificate problem: Invalid certificate chain More details here: http://curl.haxx.se/docs/sslcerts.html
どうもバグがあるようなのだけど、証明書とkeychainは触り始めると深淵なので一旦brewでcurlを入れる。
brew install curl --with-openssl && brew link curl --force
更新前
# curl -V curl 7.30.0 (x86_64-apple-darwin13.0) libcurl/7.30.0 SecureTransport zlib/1.2.5 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz
更新後
# curl -V curl 7.46.0 (x86_64-apple-darwin13.4.0) libcurl/7.46.0 OpenSSL/1.0.2e zlib/1.2.5 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets
私の環境では無事警告が出なくなりました。
問題があったらunlinkで切り戻せば大丈夫。
参考