諸行無常

IT色々お勉強中のブログ

2016-09-01から1ヶ月間の記事一覧

railsでのflash使い方

基本 flash[:notice] = 'hoge' 現在のアクションのみ有効 flash.now[:notice] = 'hoge' 破棄 flash.discard(キー) flash[:notice]=nil

急にpostgresが繋がらなくなった

急にpostgresが繋がらなくなった psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? postmaster.pidを消したら何か動くようなった /usr…

bundle install で gem install nokogiriで失敗する

久しぶりにrailsアプリを作ろうとしたらnokogiriエラー いつも直し方を忘れるのでメモ エラー↓ -[2197]% bundle install Fetching gem metadata from https://rubygems.org/.......... Fetching version metadata from https://rubygems.org/.. Fetching dep…

負荷テスト、アラートテスト用

cpu負荷を上げる yes >> /dev/null ps aux | grep yes | grep -v grep top メモリ負荷上げる /dev/null < $(yes) free -m

ログインした後に元のページにリダイレクトする

DeviseManager::SessionsController protected def after_sign_in_path_for(resource) after_sign_in_path = session[:request_from] || manager_root_path session.delete(:request_from) return after_sign_in_path end ApplicationController def request…

Capistranoでstage環境のプロセスを起動停止する方法

ステージング環境に直接入ってコマンド打っても起動せぇへん bundle exec unicorn -c /var/www/hogehoge/current/config/unicorn/stage.rb -E deployment -D 停止はできるっぽい kill -QUIT `cat /var/www/hogehoge/current/tmp/pids/unicorn.pid` 入らんで…

CloudWatchでEC2を監視

標準だけだと足り無いのでカスタム用メトリックスを作成 [hoge@ip-2342-234 cloudwatch]$ ls credential custom_metrics.sh http_status_check.sh #!/bin/bash export JAVA_HOME=/usr/lib/jvm/jre export AWS_CLOUDWATCH_HOME=/opt/aws/apitools/mon export …