今使ってるassetのdigestを確認する
consoleとかで実行すればよさそう。
Rails.application.assets.find_asset(asset_name).digest
指定したファイルのdigestを確認する
このようにしたらいいらしい。
Rails.application.assets['jquery'].digest
consoleとかで実行すればよさそう。
Rails.application.assets.find_asset(asset_name).digest
このようにしたらいいらしい。
Rails.application.assets['jquery'].digest
慌てないのが一番です。 ぼくは徹夜でリリースなのと、前日夜に風邪を発症して全身が痛いでしゅ……。
httpの監視をしていたサービスが急遽failedを送信してきました。 そのサーバはいつも夜間のバックアップやバッチ実行時、よくスワップアウトして度々警告がくる環境です。 たぶんそんな環境もあるでしょう。
ここで慌てずdmesgです。
[root@localhost ~]# dmesg ... possible SYN flooding on port 3306. Sending cookies. possible SYN flooding on port 3306. Sending cookies. possible SYN flooding on port 3306. Sending cookies. possible SYN flooding on port 3306. Sending cookies. possible SYN flooding on port 3306. Sending cookies. possible SYN flooding on port 3306. Sending cookies. possible SYN flooding on port 3306. Sending cookies. possible SYN flooding on port 3306. Sending cookies.
OOM Killerかと思いましたが違うようですね。3306といえばMySQLです。グローバルに開放はしていませんがどうしたのでしょう。プロセスの状態を確認してみます。
[root@localhost ~]# /etc/init.d/mysqld status mysqld (pid 11451) is running...
動作していますね? ではSYN floodingとはなんでしょう。以下の記述が参考になります。
サーバーで受け付けられない(受け付けてない)SYNが大量に来た場合にサーバーがどうしたかを教えてくれている模様。
どこからかアタックを食らったのかもしれませんね。 MySQLのプロセスを再起動してみましょう。
[root@localhost ~]# /etc/init.d/mysqld stop [root@localhost ~]# /etc/init.d/mysqld start
restartしないのはサーバのSWAPが9割食われてて一度失敗したからです。 これで再起動できた後しばらくおけば、正常にアクセスできるようになるはずです。
rubyバージョンアップにともなって、した。
rvm gemset copy 1.9.3-p551@rails 2.0.0-p648@rails
そもそもメンテナンス切れてるバージョンやんけ!みたいなツッコミは勘弁してくだち……。 んでcopyしたら、gemsetの中にbundler入ってなくてデプロイしたアプリ動かなくて死ぬかと思った。
productionモードだと、nginxのアクセスログに500出すだけで、production.logまで到達しなくて何事かと思った。
location / { passenger_enabled on; rails_env development; }
developmentで動かすことでエラーが見えたので、gem listしたらbundlerがなくてうわぁぁぁ。 gem install bundlerしてNginx再起動したら無事動作して、めでたしめでたし。
うおおおmasterに取り込むときに発生するのはやめろー!心臓に悪い!
コンテンツの修正で、feature/modify_images_20160805などというブランチで作業していた所、pushしてgitlabからmerge rewuest出したら「コンフリクトしてだめなんでコマンドラインで解決して?」と言われるなどしたので。
[example@localhost example-temp]$ git push origin master To git@git.example.co.jp:example/example.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@git.example.co.jp:example/example.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details. [example@localhost example-temp]$ git pull warning: Cannot merge binary files: img/img_main.png (HEAD vs. 114514.......................) Auto-merging img/img_main.png CONFLICT (content): Merge conflict in img/img_main.png Automatic merge failed; fix conflicts and then commit the result.
うおおおおおお?!
gitlabの提示した解決方法が何も役に立たなくてあーん?みたいになったので、以下のようにcheckout --theirsして解決しました。
[example@localhost example-temp]$ git checkout --theirs img/img_main.png [example@localhost example-temp]$ git add img/img_main.png [example@localhost example-temp]$ git commit -m "conflictの解消" [example@localhost example-temp]$ git push origin master
--theirsだとmasterに元々存在するファイルになるようです。 とりあえずこれで解消できたのでよかった……。 ダメな場合は、reset --hardとかして過去ま戻るしかないかも。
わりと忘れがち。
Apacheの場合は「X-Sendfile」、Nginxの場合は「X-Accel-Redirect」を使う。
# Specifies the header that your server uses for sending files #config.action_dispatch.x_sendfile_header = "X-Sendfile" # For nginx: #config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
と思った時に確認するファイル。
特にリポジトリ切り替えたり、検証で複数のリポジトリ行ったり来たりする時、FETCH_HEAD/HEAD/configあたり見るとずっと古いリポジトリの情報書いてあって「あびゃあ」って顔になる。 なんかCapistranoの使い方間違ってる気がするけど、前のエントリでも書いたとおり、repoディレクトリをとりあえず削除することで回避できるから何も考えずにそうしてるマン。
よく読んでないけどrepo消せって書いてあるし、さすがやなって。
既存の本番環境にURL変更してデプロイするときに躓いた。
以下のようにして、set-urlすると解決できるので、むやみにrepoディレクトリを消すのはやめようという知見。
cd /path/to/capistrano/repo git remote -v 変更前のリポジトリが出てくる git remote set-url origin "新しいgitリポジトリ" git remote -v "新しいgitリポジトリ"に変わってることを確認する
古いプロジェクトメンテしようとしたらこけるよー。
Could not find rack-cache-1.6.0 in any of the sources
yanked!!
All versions of rack-cache | RubyGems.org | your community gem host
依存関係のあるgemのバージョンは1.6.0→1.6.1で変わらないようなので、そのままbundle upadte rake-cacheすれば大体の人は解決するでしょう!
多分Gemfileに以下のように書けばgithubから持ってこれるので、なんとかなると思います。
gem 'rack-cache', :git => 'git@github.com:rtomayko/rack-cache.git', :tag => 'v1.6.0'
当然githubと通信しないといけないので、アカウント取って~/.ssh/configあたりに設定書いといてください。なんかhttpsを指定も出来るみたいだけど、そっちは試してないので……。