This is a simple demo app powered by Ruby, Postgres, and ElasticSearch. It's not intended to be overly complex; rather, it serves as a straightforward example app to demonstrate how to utilize ElasticSearch via the Searchkick gem.
The app is dockerized and can be executed using docker-compose. There are three services: app, db, and elasticsearch. The app service represents the Rails app, the db service hosts the Postgres database, and the elasticsearch service runs the ElasticSearch instance.
Visit DEMOLINK to see the app in action. The app is hosted on raspberry pi, so don't expect blazing fast speeds. 😅
I hope the network stays strong, the Raspberry Pi manages ElasticSearch well, and the frpc tunnel keeps sending traffic smoothly from my home network to the Hetzner Cloud. 🤞
I was going to host it on Heroku, but the free tier doesn't support ElasticSearch. I could have used a third-party ElasticSearch service, but I wanted to keep it simple.
- Clone the repository.
- Create a
.envfile in the root of the project by copying the.env.samplefile:cp .env.sample .env. - Execute
docker-compose up -dto initiate the services. You can access the app at http://localhost:3000.
- The app service constructs the image using the Dockerfile.
- The db service fetches the PostgreSQL image from Docker Hub.
- The elasticsearch service fetches the ElasticSearch image from Docker Hub.
- Once the services are up and running (using
./bin/wait_for_services). - The
./bin/setupscript will execute to configure the database. - The
./bin/importscript will run to import data from the Parquet file into the database. This is achieved using a simple Python script. - After the import is complete, the ElasticSearch index will be established and the data will be indexed.
- You're now ready to run the Rails app, accessible at http://localhost:3000.
- Clone the repository.
- Create a
.envfile in the project root by copying the.env.samplefile:cp .env.sample .env. - Install the required dependencies:
- Ruby 3.2.2
- Postgres 14 (ensure port 5432 is available)
- ElasticSearch 7.15.0 (higher versions are untested with the Searchkick gem, ensure port 9200 is available)
- Python 3+
- Run
bundle installto install the necessary gems. - Run
pip3 install -r bin/requirements.txtto install the Python dependencies. - Execute
./bin/setupto set up the database. - Use
rails sto launch the app. Access it at http://localhost:3000.
- The app isn't production-ready; proper configuration of environment variables is necessary.
- Additional testing is needed, particularly for the search functionality.
- Implementing a CI/CD pipeline would be beneficial, possibly utilizing GitHub Actions or similar platforms.
- Integration of an autosuggest feature during search would enhance user experience.
- Enhancing the UI/UX design is required.
- Implement pagination in the user interface.
- Expand the UI with additional search filters.
- Determine a meaningful purpose for utilizing this dataset! 😅
- As for now, the dataset is static. But, if at some point it becomes dynamic, we'll need to implement a mechanism to update the index accordingly.