I need to ensure that Apache Solr is installed with my django-oscar application, and have been using these instructions with an .ebextensions config file to automatically install Solr and rebuild the index.
Here is the .ebextensions/03_solr.config
container_commands:
01_install_solr:
command: "wget http://archive.apache.org/dist/lucene/solr/4.7.2/solr-4.7.2.tgz &&
tar xzf solr-4.7.2.tgz &&
cd solr-4.7.2.example/solr/collection1 &&
mv conf conf.original &&
ln -s /opt/python/current/app/deploy/solr conf &&
cd ../.. &&
java -jar start.jar"
02_rebuild_index:
command: "python manage.py rebuild_index --noinput"
What do I need to add/update here to get the solr to install automatically on
eb deploy
?
Update: changed the bash to a single command. It looks like the process is completing, but on executing java -jar start.jar, the .ebextensions/03_solr.config
task executes the
org.eclipse.jetty.server.AbstractConnector - Started SocketConnector@0.0.0.0:8983
This process should really be a background process, as currently it is causing the deploy to hang, and timeout without deploying the new application. According to this SO post, to start a delayed job AFTER the new application version is deployed takes some work. Any suggestions? To clarify:
Run the
java -jar start.jar
command as a non-blocking, background process for EB?
Note that each of these steps is executed in the default folder, so issuing a
cd
command is ineffective. You should run all those steps in a single command rather than multiple ones.step 04 will fail as it starts in the default directory rather than the solr one
So the answer did end up being the need to use the post deployment hooks, as described. Terminating and restarting the EB EC2 instance and a fresh deploy solved the issue.