Skip to content

Commit

Permalink
Perform SOLR indexing as last step and not in background
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed Aug 1, 2024
1 parent 30adf79 commit f79a711
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions initialize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ check_for_preseeds() {
for file in db/backups/docker_development/*.sql; do
[[ $file -nt $latest ]] && latest=$file
done

bundle exec rails db:restore pattern=$(echo $latest | rev | cut -d "/" -f1 | rev | cut -d "_" -f1)
bundle exec rails db:create:interactions
bundle exec rails db:migrate
fi

Expand All @@ -32,6 +32,7 @@ fi

echo Waiting for redis to come online
wait-for-it redis:6379 -t 30 || exit 1

if ! [ -f /completed_initial_run ]; then
echo Initialising MaMpf
echo Waiting for the DB to come online
Expand All @@ -49,10 +50,6 @@ if ! [ -f /completed_initial_run ]; then
bundle exec rails db:create:interactions
bundle exec rails db:create

echo Waiting for SOLR to come online
wait-for-it ${SOLR_HOST}:${SOLR_PORT} -t 30 || exit 1
bundle exec rake sunspot:solr:reindex &

if [ "$RAILS_ENV" = "docker_development" ]; then
check_for_preseeds
fi
Expand All @@ -61,6 +58,10 @@ if ! [ -f /completed_initial_run ]; then
bundle exec rails db:schema:load
fi

echo Waiting for SOLR to come online
wait-for-it ${SOLR_HOST}:${SOLR_PORT} -t 30 || exit 1
bundle exec rake sunspot:solr:reindex

echo 'finished initialisation'
touch /completed_initial_run
fi

0 comments on commit f79a711

Please sign in to comment.