[Docker] Tentative fix for intermittent CI test failures

Elastic indicies aren't ready sometimes. I don't know where they are
created, but it seems to be too late. Move creation into the seeds file
and execute it in all environments.

Calling create_index! multiple times is fine, this is important because
the seeds file should be idempotent
This commit is contained in:
Earlopain 2023-05-15 13:58:41 +02:00
parent 4bc3f744b4
commit f722dbb4c3
No known key found for this signature in database
GPG Key ID: 237AA8F8D0D0577F
2 changed files with 3 additions and 11 deletions

View File

@ -24,12 +24,6 @@ FileUtils.chdir APP_ROOT do
system! 'RAILS_ENV=development bin/rails db:schema:load'
system! 'RAILS_ENV=development DANBOORU_DISABLE_THROTTLES=true bin/rails db:seed'
puts "\n== Preparing search indices =="
system! 'bin/rails r Post.__elasticsearch__.create_index!'
system! 'bin/rails r Post.import'
system! 'bin/rails r PostVersion.__elasticsearch__.create_index!'
system! 'bin/rails r PostVersion.import'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
end

View File

@ -4,11 +4,9 @@ require "digest/md5"
require "net/http"
require "tempfile"
unless Rails.env.test?
puts "== Creating elasticsearch indices ==\n"
Post.__elasticsearch__.create_index!
end
puts "== Creating elasticsearch indices ==\n"
Post.__elasticsearch__.create_index!
PostVersion.__elasticsearch__.create_index!
puts "== Seeding database with sample content ==\n"