エラーがさっきと違う…??
$ RAILS_ENV=production bundle exec rails db:migrate
rails aborted!
PG::ConnectionBad: ERROR: pgbouncer cannot connect to serve
ちゃんと立ち上がっているはずだが…
…
# systemctl status pgbouncer
● pgbouncer.service - LSB: start pgbouncer
Loaded: loaded (/etc/init.d/pgbouncer; generated)
Active: active (running) since Sun 2019-03-03 11:12:37 UTC; 16min ago
これが原因か?
$psql -p 6432 -U mastodon mastodon_production
psql: ERROR: pgbouncer cannot connect to server
@BananaGiko_cle 認証はちゃんとできてる?
@Kirishimalab21 認証…?
@Kirishimalab21 @BananaGiko_cle pgbouncer通してるなら、migrationはこんな感じでpgbouncerを迂回して実行ね。
RAILS_ENV=production DB_PORT=5432 bundle exec rails db:migrate
@BananaGiko_cle @Kirishimalab21 psql -p 5432 -U mastodon mastodon_production ではDB_PASSのパスワード通る?
@noellabo @Kirishimalab21
password,かかってなくて入れましたね…??
元はpassword入ってなかったということかな
@BananaGiko_cle @Kirishimalab21 通常のセットアップでは、パスワードなしでdb作られます。なので、pgbouncer導入の際にパスワード設定する感じです。
DBにパスワード設定しましょう!
ALTER ROLE mastodon WITH PASSWORD 'xxxxxxxxx';
@noellabo @Kirishimalab21
$ psql -p 5432 -U mastodon mastodon_production
mastodon_production=> ALTER USER mastodon WITH PASSWORD '*******';
ALTER ROLE
これで通りました!
$ RAILS_ENV=production DB_PORT=5432 bundle exec rails db:migrate
完了しました!
@noellabo @Kirishimalab21
RAILS_ENV=production DB_PORT=5432 bundle exec rails db:migrate
rails aborted!
PG::ConnectionBad: FATAL: password authentication failed for user "mastodon"
FATAL: password authentication failed for user "mastodon"
pgbouncerを通さないとパスワードが違うと怒られますね…なんでなんだろう
元のデータにパスワードが設定されていて、それと現状が合ってないから??