Discourse setup on EC2 and RDS. but Error rake db:migrate


(Yokochi) #1

I am trying to install the Discourse on EC2 and RDS.

EC2: Amazon Linux
RDS: PostgreSQL 9.4.1

Errors such as the following will appear after rake db:migrate. Would you know how to solve?

RAILS_ENV=production bundle exec rake db:create
RAILS_ENV=production bundle exec rake db:migrate

== Seed from /opt/discourse/db/fixtures/500_lounge_category.rb
rake aborted!
ActiveRecord::StatementInvalid: PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
: DELETE FROM "topic_links" WHERE ((post_id = 1 AND NOT reflection) OR (link_post_id = 1 AND reflection))
/opt/discourse/app/models/topic_link.rb:206:in `block in extract_from'
/opt/discourse/app/models/topic_link.rb:106:in `extract_from'
/opt/discourse/lib/post_creator.rb:365:in `extract_links'
/opt/discourse/lib/post_creator.rb:127:in `block in create'
/opt/discourse/lib/post_creator.rb:225:in `call'
/opt/discourse/lib/post_creator.rb:225:in `block in transaction'
/opt/discourse/lib/post_creator.rb:223:in `transaction'
/opt/discourse/lib/post_creator.rb:123:in `create'
(eval):23:in `block (3 levels) in run_file'
(eval):8:in `block (2 levels) in run_file'
/opt/discourse/lib/tasks/db.rake:8:in `block in <top (required)>'
PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
/opt/discourse/app/models/topic_link.rb:206:in `block in extract_from'
/opt/discourse/app/models/topic_link.rb:106:in `extract_from'
/opt/discourse/lib/post_creator.rb:365:in `extract_links'
/opt/discourse/lib/post_creator.rb:127:in `block in create'
/opt/discourse/lib/post_creator.rb:225:in `call'
/opt/discourse/lib/post_creator.rb:225:in `block in transaction'
/opt/discourse/lib/post_creator.rb:223:in `transaction'
/opt/discourse/lib/post_creator.rb:123:in `create'
(eval):23:in `block (3 levels) in run_file'
(eval):8:in `block (2 levels) in run_file'
/opt/discourse/lib/tasks/db.rake:8:in `block in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

(Yokochi) #2

I soleved this the problem.

config/site_settings.yml

before

basic:
  default_locale:
    default: 'ja'

after

basic:
  default_locale:
    default: 'en'

(Kane York) #3

Why are you editing site_settings.yml? That file should contain defaults, and all overrides should be in the DB. Editing that file will only bring pain later when you try to upgrade.

Also, because you’re using Postgres 9.4, you need to install a 9.4 pg_dump binary, otherwise backups will fail.