The chewy gem is an excellent framework that enables simple integration with the equally fantastic elasticsearch-ruby gem.
This demo project is a simple demonstration of how the chewy gem can operate within a Rails project using a PostgreSQL.
These instructions are for Ubuntu 16.04 LTS, but will be roughly similar for other Linux distributions and Mac.
- Install RVM (https://rvm.io/rvm/install)
\curl -sSL https://get.rvm.io | bash -s stable --ruby
- Install PostgreSQL and create credentials (http://postgresguide.com/setup/install.html)
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib libpq-dev
sudo -u postgres createuser -s chewy_demo
sudo -u postgres psql
\password chewy_demo
# Enter 'chewy_demo_password' at the prompt
\q
- Install elasticsearch (https://www.elastic.co/guide/en/elasticsearch/guide/master/running-elasticsearch.html)
curl -O "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.tar.gz"
tar -zxf elasticsearch-5.5.1.tar.gz
rm -f elasticsearch-5.5.1.tar.gz
sudo elasticsearch-5.5.1/bin/elasticsearch-plugin install analysis-phonetic
- Download code source
git clone https://github.com/alanbuttars/chewy-demo.git
- Register for a Google API Key
- Go to the Google Developer Console
- Login or register an account if you do not have one
- Create a project
- Create an API key
- Enable the Google Maps JavaScript API for your API key
- Run the application
cd /path/to/chewy-demo
gem install bundler
bundle install
rake elasticsearch:go
rake db:go
GOOGLE_API_KEY=your-api-key rails server