DEV Community

JakovGlavac
JakovGlavac

Posted on

10 2 1 1

Deploy Meilisearch on Fly.io

Introduction

This guide explains how to deploy a ready-to-use Meilisearch instance on Fly.io.
First time I tried this I've had some problems that wasted me a lot of time, so to save you the time I'll create step-by-step instructions.

Just do it

So if you want to deploy it to fly io as fast as possible, this is the way.

In any folder create fly.toml, and copy the content

app = "my-meilisearch"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[build]
  image = "getmeili/meilisearch"

[env]

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[mounts]]
  source = "disc1"
  destination = "/meili_data"

[[services]]
  http_checks = []
  internal_port = 7700
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"
Enter fullscreen mode Exit fullscreen mode

then login in fly io!

flyctl login

and then deploy it!

flyctl deploy

Theory

persistent storage

So, the "hard" part of deploying is to create persistent storage.
Fly.io has a guide on that here, but in short you need to add this part to your toml.

[[mounts]]
  source = "disc1"
  destination = "/meili_data"
Enter fullscreen mode Exit fullscreen mode

This creates disc, that is mapped to this folder meili_data.

Why use /meili_data, because there is where melisearch stores your data.

docker image

If you want fly io to use docker image from docker hub you need to specify image in build step like this:

[build]
  image = "getmeili/meilisearch"
Enter fullscreen mode Exit fullscreen mode

port

Meilisearch is by default on port 7700, so you need to tell fly io to listen to internal 7700 port.

[[services]]
  internal_port = 7700
Enter fullscreen mode Exit fullscreen mode

Everything else is pretty much default.

And that's it 🎉!

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (3)

Collapse
 
hiccupq profile image
hiccupq •

Saved my ass thanks a lot!

Collapse
 
pierratono profile image
Pierratono Costa MAHORO •

How to set master key?

Collapse
 
jakovglavac profile image
JakovGlavac •

set it as an environment variable, use the following syntax: MEILI_MASTER_KEY="MASTER_KEY". For more information, refer to the documentation meilisearch.com/docs/learn/securit...

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up