I am using django-haystack and whoosh search engine in my django app. Everything is working alright, except when I git push
new version to my OpenShift server, search stops working. It simply does not return any results. If I run ./manage.py update_index
it starts working.
I have whoosh_index/
in my .gitignore
file. I checked by git ls-files
and whoosh_index folder is not there. So my localhost files should not be overwriting any whoosh_index files.
Currently I use post_deploy
script:
echo "Executing 'python ${OPENSHIFT_REPO_DIR}wsgi/app/manage.py update_index'"
python "$OPENSHIFT_REPO_DIR"wsgi/app/manage.py update_index
But is there another way so that I do not have to update_index everytime I push new version of my app? What am I missing?
All OpenShift applications are built around a Git source control workflow - you code locally, then push your changes to the server. The server then runs a number of hooks to build and configure your application, and finally restarts your application. Optionally, applications can elect to be built using Jenkins, or run using hot deployment which speeds up the deployment of code to OpenShift.
There are 5 phases for the changes done:
You can add the index update operation to the build phase by adding it to the file:
.openshift/action_hooks/build
You can disable the whole operation of modifying of open shift by require the hot deploy mode:
$ touch .openshift/markers/hot_deploy
With hot deployment the changes to application code are applied without restarting the application cartridge, resulting in increased deployment speed and minimized application downtime.