I recently began using TypeSense and I have to say it was surprisingly easy to setup and deploy. I had a simple use case that I’m hoping to expand over the next few months. In this guide I’ll show you how and why I setup and deployed a standalone instance of Typesense to the cloud, with a focus on Oracle Cloud Infrastructure (OCI).
What is TypeSense?
Typesense is an open-source and easy-to-use search engine.
From their website:
Typesense is a modern, privacy-friendly, open source search engine meticulously engineered for performance & ease-of-use.
It is similar to Algolia or Elasticsearch. If you are not familiar with those technologies, then you could think of Typesense as a service that enables you to quickly and easily store and retrieve text-based data using various types of search queries, similar to what Google does.
You can checkout a few of their use cases for examples of what it could be used for.
Why TypeSense?
I chose Typesense as I was looking for an open-source search solution that I could quickly start using without a lot of setup steps. I had used Elasticsearch in the past and was satisfied with it, but after googling for a bit I found Typesense and was excited to try it out. Some reasons I was excited to give it a try, and now recommend:
- Quick and easy setup: I was up on running with data indexing and search in a few minutes.
- Useful features beyond just text search: Other useful features like vector search, filtering, and synonyms are included out of the box. You can see their full list of features here.
Their website also has a page comparing alternatives if you would find that useful.
What is OCI?
OCI (Oracle Cloud Infrastructure) is a cloud computing platform provided by Oracle. From their website, it can be described as:
The next-generation cloud designed to run any application, faster and more securely, for less.
If you have used other platforms like AWS or GCP, then you could think of OCI as similar, except provided by a different vendor. They offer many of the same, or comparable services such as virtual machines, databases, object storage, container services, and more.
Why OCI?
I wanted to iterate quickly on my noncommittal idea and wanted a free tier for a cloud platform that I could experiment with — and OCI had just that, a generous always-free tier. Some other reasons I’d recommend OCI are:
- Intuitive user experience: The OCI UI is quite straightforward, and it was easy for me to navigate and make changes to the different services I needed.
- Great customer service: I reached out with questions multiple times when trying to figure out how to use the various OCI services.
Deployment Steps
To deploy a standalone instance of Typesense, all you need is Docker and a free OCI account. I chose Docker mainly for portability and ease of use. I already had an instance of Typesense configured locally with docker-compose, so it just made sense for me to use a similar configuration for my deployment.
You can deploy Typesense instance to OCI by following these steps:
- Create a Compute Instance: Begin by creating a Linux compute instance on OCI. This virtual machine (VM) will serve as your Typesense instance host.
- Connect to the Compute Instance: You need to do this to install Docker and Typesense.
- Install Docker and the Compose plugin: You will be running Typesense using docker-compose.
- Configure and run Typesense: With Docker installed, you can configure and run your Typesense instance. You'll define the Typesense container, its environment, and other necessary settings in a docker-compose.yml file. Typesense graciously provides an example you can copy here. Remember to edit the configuration based on your needs.
- Allow connections to Port 8108: You'll need to configure your security rules in OCI to allow incoming connections to port 8108, which is the default port for Typesense. This step ensures that your Typesense instance is accessible.
At this point, you should be able to connect to your Typesense instance on http://[your-oci-instance-public-ip]:8108
.
Optional Additional Steps:
- Setup Load-Balancing and SSL for your Typesense connection: To enhance your Typesense deployment, consider setting up load balancing for improved performance and SSL (Secure Sockets Layer) for secure connections. This is particularly important if you're dealing with sensitive data or providing services over the internet.
- Link your Domain Name: If you have a domain name and wish to use it to access your Typesense instance, you can configure DNS settings to link your domain to your OCI instance's IP address.
Conclusion
In conclusion, TypeSense is a remarkably user-friendly and versatile search engine that can significantly enhance your application's search capabilities. Oracle Cloud Infrastructure (OCI) provides a reliable and cost-effective platform for hosting TypeSense instances.
I enjoyed setting Typesense up because it was mostly painless. It took me some time to figure out OCI, but it was a positive experience in general. I look forward to building more with both platforms. Feel free to reach out if you have any questions, or have anything interesting to discuss.
Cover Photo by Markus Winkler on Unsplash