Skip to content

Deploying a Meilisearch App

Introduction

Meilisearch is a fast, open-source search engine optimized for instant search experiences. Deploying Meilisearch with a Dockerfile on Klutch.sh delivers reproducible builds, managed secrets, and persistent storage for your indexes—all managed from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample API usage, and production tips.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your Meilisearch Dockerfile (GitHub is the only supported git source)
  • API keys for Meilisearch (master key and optional search-only keys)
  • Storage planning for your indexes

For onboarding, see the Quick Start.


Architecture and ports

  • Meilisearch serves HTTP on internal port 7700; choose HTTP traffic.
  • Persistent storage is required for indexes.
  • No external database is needed; Meilisearch stores data on disk.

Repository layout

meilisearch/
├── Dockerfile # Must be at repo root for auto-detection
└── README.md

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Validate locally before pushing to GitHub:

Terminal window
docker build -t meilisearch-local .
docker run -p 7700:7700 -e MEILI_MASTER_KEY=local_master meilisearch-local

Dockerfile for Meilisearch (production-ready)

Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):

FROM getmeili/meilisearch:v1.7
ENV MEILI_HTTP_ADDR=0.0.0.0:7700 \
MEILI_MASTER_KEY=${MEILI_MASTER_KEY:-change_me} \
MEILI_ENV=production
EXPOSE 7700
CMD ["meilisearch"]

Notes:

  • Pin the version for stability (e.g., v1.7.x); update intentionally.
  • Use environment variables to configure keys and tuning flags (MEILI_MAX_INDEX_SIZE, MEILI_MAX_TASK_DATABASE_SIZE, MEILI_LOG_LEVEL).

Environment variables (Klutch.sh)

Set these in Klutch.sh before deploying:

  • MEILI_MASTER_KEY=<secure-master-key>
  • MEILI_ENV=production
  • MEILI_HTTP_ADDR=0.0.0.0:7700
  • Optional tuning: MEILI_MAX_INDEX_SIZE, MEILI_MAX_TASK_DATABASE_SIZE, MEILI_LOG_LEVEL=info

If you deploy without the Dockerfile and need Nixpacks overrides (binary service):

  • NIXPACKS_START_CMD=meilisearch
  • NIXPACKS_RUST_VERSION=1.75 (only if you build from source)

Attach persistent volumes

In Klutch.sh storage settings, add mount paths and sizes (no names required):

  • /meili_data — indexes and snapshots.

Ensure this directory is writable.


Deploy Meilisearch on Klutch.sh (Dockerfile workflow)

  1. Push your repository—with the Dockerfile at the root—to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  3. Select HTTP traffic and set the internal port to 7700.
  4. Add the environment variables above, including your master key and any tuning flags.
  5. Attach a persistent volume for /meili_data sized to fit your indexes.
  6. Deploy. Your Meilisearch instance will be reachable at https://example-app.klutch.sh; attach a custom domain if desired.

Sample API usage

Create an index and add documents:

Terminal window
curl -X POST "https://example-app.klutch.sh/indexes" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <MEILI_MASTER_KEY>" \
-d '{ "uid": "movies", "primaryKey": "id" }'
curl -X POST "https://example-app.klutch.sh/indexes/movies/documents" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <MEILI_MASTER_KEY>" \
-d '[{"id":1,"title":"Inception"},{"id":2,"title":"Arrival"}]'

Search:

Terminal window
curl -X POST "https://example-app.klutch.sh/indexes/movies/search" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <MEILI_MASTER_KEY>" \
-d '{ "q": "Inception" }'

Health checks and production tips

  • Add an HTTP probe to /health or /version.
  • Enforce HTTPS at the edge; forward internally to port 7700.
  • Keep the master key secret; generate search-only keys for clients.
  • Monitor disk usage for /meili_data and resize before it fills.
  • Pin image versions and plan rolling upgrades to preserve data.

Meilisearch on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root, port 7700 configured, and a secure master key, you can deliver instant search without extra YAML or workflow overhead.