Best way to add Elasticsearch to App

Posted July 31, 2021 485 views
DjangoElasticsearchDigitalOcean App Platform

I have Django app running on DO, and I want to add Elasticsearch to it. I have the two containers running on my desktop with Docker compose, and I’m trying to figure out what the simplest (and cheapest!) way to deploy it is.

I’m using the stock docker image for ES. This is a prototype, and the data is all sourced from a Postgres managed database, so I’m ok with reloading the data on deployment or droplet failure.

I was thinking of adding it as a component to my existing app, but am not sure how to do that. Or I could set it up on a droplet fairly easily. Or is it time to start with Kubernetes? (

what’s a good way to do this?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @digitaloceancomSquid,

I’ll recommend adding ES on a different Droplet, then you can configure logstash or filebeat or whatever ES addon you need on the Droplet and connect it to your Application’s Droplet to collect the information you need.

I'l suggesting a separate Droplet for ES as it would be easier in the future when you possibly have more than one App on different Droplets. That’s my view.

Having said that, deploying it on the same droplet as the current app, will save you some money and it can be more convenient for a short term project.

  • Thanks for the response!

    I may not have been clear on my question, or am not quite getting the answer.

    I was wondering if I should deploy ES as a digital ocean App, or on a droplet. I think these are two different things, so your response “App on different Droplets” confused me.

    What I think I want to do is deploy ES as an App from a docker image. This would allow me to just point to docker hub, and load the standard ES image. It has the disadvantage that containers are non-persistent, which would be a non-starter for production, but works for me for a prototype (I can reload the data in seconds, if the container fails.). I just need to figure out the syntax for the .yaml file. (suggestions welcome!)

    I could install ES on a droplet. That has persistent storage, so works better for a real app, but requires more management time, which is in short supply.


    • Hi @digitaloceancomSquid,

      Excuse me for just getting back to the question and not being clear enough as well.

      I believe while writing you’ve found the best solution at this stage. Since it’s still a prototype, I don’t believe you should put too much effort in managing it rather that it just working. As such, I’ll recommend using ES as a DigitalOcean App.

      About the Kubernetes part, I don’t think what you’ve provided from StackOverflow is correct. I don’t agree at all as Kubernetes should be used in my opinion for a much larger project in order to fully use it’s potential. Using it for smaller projects is just a waste of time and money(my opinion).