Heroku で Gmail SMTP を使うにはちょっと準備がいる。「Heroku で Gmail を使う時に注意すること」通りにやればいい。
しばらく経って Gmail smtp の設定したことを忘れた頃に Gmail のパスワードを変えると...
最近 Heroku からメールこないなぁ....などと思っていた。
heroku config:add GMAIL_SMTP_PASSWORD=寿限無寿限無...
heroku config:add GMAIL_SMTP_PASSWORD=寿限無寿限無...
ActiveRecord::StatementInvalid: PGError: no connection to the server
: SELECT "hoges".* FROM "hoges"
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:202:in `rescue in log'
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:194:in `log'
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:496:in `execute'
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:982:in `select_raw'
def Process.su(file)
fstat = File::Stat.new file
if fstat.uid != uid
self.gid = self.egid = fstat.gid
self.uid = self.euid = fstat.uid
end
end
require 'process_su' Process.su __FILE__ sleep
start on started postgres stop on stopping postgres exec /usr/local/ruby-1.8.7/bin/ruby /home/shingo/Redmine/script/server -e production 2>> /home/shingo/Redmine/log/production.log
require 'process_su' Process.su __FILE__
start on filesystem stop on runlevel [016] exec /usr/local/ruby-1.9.2/bin/ruby /home/shingo/PostgresData/postgres_startup
require 'process_su' Process.su __FILE__ system '/usr/local/pgsql/bin/postgres -D /home/shingo/PostgresData > /dev/null 2>> /home/shingo/PostgresData/postgres.log' sleep
initctl stop postgresとすれば redmine(rails) が止まったのち postgres が SIGINT で正常に終わってくれるし、もう一度
intctl start postgresすればpostgres が上げてから redmnine を起動してくれる。