/deploy-meilisearch

Operations L3 Production low usage

/deploy-meilisearch

Overview

The /deploy-meilisearch command manages the complete lifecycle of Meilisearch search engine instances across the Prismatic Platform's deployment environments. Meilisearch provides the platform's full-text search capabilities, powering real-time search across business entities, OSINT intelligence data, agent registries, and documentation indexes. This command handles installation, configuration, index creation, health validation, and integration with the platform's storage adapter layer.

Meilisearch serves as the search backbone for several critical platform capabilities. The Czech Autocrawler indexes business entities in real-time for instant search across thousands of corporate records. The agent registry enables rapid lookup across 400+ agents by name, capability, or domain. The documentation system provides full-text search across 11,000+ documentation files. Without a properly configured Meilisearch instance, these capabilities degrade to sequential scanning, reducing search performance by orders of magnitude.

This command operates under the L3 authority level and is executed by the meilisearch-deployment-agent agent. It is part of the platform's 216-command slash command registry, built on the AIAD (Autonomous Intelligence Agent Design) standard. The L3 authority level reflects the infrastructure-level impact of search engine deployment -- misconfiguration can affect multiple platform subsystems simultaneously.

The deployment process follows a five-phase protocol: prerequisites verification (Docker availability, port allocation, key management), instance deployment (container or native service), configuration (index creation, search settings, filterable/sortable attributes), validation (health checks, connectivity tests, search functionality verification), and integration (runtime configuration update, storage adapter registration, platform connectivity confirmation). Each phase includes rollback procedures in case of failure.

Architecture

Deployment Architecture

MEILISEARCH DEPLOYMENT
=======================

PREREQUISITES
    +-- Docker engine availability check
    +-- Port 7700 allocation verification
    +-- Master key generation/validation
    +-- Data volume preparation
    |
    v
DEPLOYMENT
    +-- Docker image pull (getmeili/meilisearch)
    +-- Container configuration
    +-- Volume mounting (meili_data)
    +-- Environment variable injection
    |
    v
CONFIGURATION
    +-- Index creation (czech_business_entities, agents, docs)
    +-- Filterable attributes setup
    +-- Sortable attributes setup
    +-- Search ranking rules configuration
    +-- Synonyms and stop words
    |
    v
VALIDATION
    +-- Health endpoint check (/health)
    +-- Search functionality test
    +-- Index status verification
    +-- Performance benchmark
    |
    v
INTEGRATION
    +-- Runtime config update (config/runtime.exs)
    +-- PrismaticStorageMeilisearch adapter registration
    +-- Platform connectivity confirmation
    +-- Telemetry event registration

Environment Configuration

EnvironmentApp NamePortData PersistenceMaster Key
Developmentmeilisearch-dev7700Local volumeAuto-generated
Stagingmeilisearch-staging7700Persistent volumeEnvironment variable
Productionmeilisearch-prod7700Persistent volume (backed up)Secrets manager

Usage

Basic Deployment

# Deploy to development environment (Docker, default settings)
/deploy-meilisearch development

# Deploy to staging with master key
/deploy-meilisearch staging --master-key=$MEILI_MASTER_KEY

# Deploy specific version to production
/deploy-meilisearch production --version=1.6.0

Custom Configuration

# Deploy on custom port
/deploy-meilisearch development --port=7701

# Deploy without Docker (native binary)
/deploy-meilisearch development --docker=false

# Deploy latest version
/deploy-meilisearch development --version=latest

Validation Only

# Run health check on existing instance
curl http://localhost:7700/health
# Expected: {"status":"available"}

# Verify index configuration
curl http://localhost:7700/indexes --header "Authorization: Bearer $MEILI_MASTER_KEY"

Options & Parameters

ParameterPosition/FlagRequiredTypeDefaultDescription
environment$1NoenumdevelopmentTarget: development, staging, production
--versionflagNostringlatestMeilisearch version to deploy
--master-keyflagNostringauto-generatedMaster API key for authentication
--portflagNointeger7700Service port for Meilisearch
--dockerflagNobooleantrueDeploy using Docker container

Execution Flow

/deploy-meilisearch [environment] [options]
    |
    v
PHASE 1: PREREQUISITES (< 5s)
    +-- Verify Docker availability (if --docker)
    +-- Check port availability (netstat/lsof)
    +-- Generate or validate master key
    +-- Prepare data volume directory
    |
    v
PHASE 2: DEPLOYMENT (< 30s)
    +-- Pull Meilisearch Docker image
    +-- Configure container environment
    +-- Start container with volume mount
    +-- Wait for startup completion
    |
    v
PHASE 3: CONFIGURATION (< 10s)
    +-- Create platform indexes
    +-- Configure filterable attributes
    +-- Set sortable attributes
    +-- Apply search ranking rules
    |
    v
PHASE 4: VALIDATION (< 5s)
    +-- Health check (/health endpoint)
    +-- Test search functionality
    +-- Verify index creation
    +-- Run performance benchmark
    |
    v
PHASE 5: INTEGRATION (< 5s)
    +-- Update runtime.exs configuration
    +-- Register with PrismaticStorageMeilisearch
    +-- Test adapter connectivity
    +-- Emit deployment telemetry event

Docker Command

docker run -d \
  --name meilisearch \
  -p 7700:7700 \
  -v $(pwd)/meili_data:/meili_data \
  -e MEILI_MASTER_KEY=$MEILI_MASTER_KEY \
  -e MEILI_ENV=production \
  getmeili/meilisearch:latest

Platform Configuration

# config/runtime.exs
config :prismatic_storage_meilisearch,
  url: System.get_env("MEILISEARCH_URL", "http://localhost:7700"),
  api_key: System.get_env("MEILISEARCH_API_KEY"),
  timeout: 10_000,
  pool_size: 10

Integration Points

ComponentRelationshipDetails
Prismatic AgentsExecuted by meilisearch-deployment-agentAgent manages full deployment lifecycle
AIAD RegistryCommand specification and discoveryOperations category registration
Quality GatesPost-deployment validationHealth checks gate deployment success
TelemetryDeployment metricsDeployment time, health status, index counts
PrismaticStorageMeilisearchStorage adapterElixir adapter for Meilisearch operations
Czech AutocrawlerEntity indexingReal-time entity search index
Docker EngineContainer runtimeContainer lifecycle management

Index Configuration

IndexPurposeFilterableSortable
czech_business_entitiesBusiness entity searchregion, industry, legal_form, statusname, created_at, revenue
agentsAgent registry searchdomain, authority, status, categoryname, priority
documentationDocumentation searchsection, type, apptitle, updated_at
osint_intelligenceOSINT data searchsource, confidence, typetimestamp, relevance

Best Practices

  1. Always use master keys in non-development environments -- Auto-generated keys are acceptable for local development, but staging and production must use environment-managed keys stored in secrets managers.

  2. Back up data volumes before upgrades -- Meilisearch data volumes contain all indexed data. Back up meili_data/ before deploying new versions to enable quick recovery.

  3. Monitor index sizes -- Large indexes (100K+ documents) require more memory. Monitor Meilisearch memory usage and scale resources accordingly.

  4. Use version pinning in production -- Always specify explicit versions for production deployments (--version=1.6.0) rather than using latest to prevent unexpected behavior changes.

  5. Test search quality after deployment -- Run representative search queries after deployment to verify that search ranking, filtering, and sorting behave as expected.

  6. Configure appropriate timeouts -- The default 10-second timeout in the Elixir adapter is suitable for most queries. Increase for complex faceted searches or large result sets.

Error Handling

ErrorCauseResolution
DOCKER_NOT_FOUNDDocker engine not installed or not runningInstall Docker or start Docker daemon
PORT_IN_USEPort 7700 already allocatedUse --port to specify alternative port, or stop existing service
IMAGE_PULL_FAILEDCannot pull Meilisearch Docker imageCheck network connectivity; verify image name and version
HEALTH_CHECK_FAILEDInstance started but not respondingCheck container logs; verify port mapping; check master key
INDEX_CREATION_FAILEDCannot create required indexesCheck API key permissions; verify Meilisearch version compatibility
ADAPTER_CONNECTION_FAILEDElixir adapter cannot connectVerify URL and API key in runtime.exs; check network connectivity

Troubleshooting

# Check container status
docker ps -a | grep meilisearch

# View container logs
docker logs meilisearch

# Test direct connectivity
curl -v http://localhost:7700/health

# Test authenticated access
curl http://localhost:7700/indexes \
  --header "Authorization: Bearer $MEILI_MASTER_KEY"

# Restart container
docker restart meilisearch

Advanced Usage

Multi-Index Management

# Create a custom index programmatically
{:ok, _} = PrismaticStorageMeilisearch.create_index("custom_index", %{
  primary_key: "id",
  filterable_attributes: ["category", "status"],
  sortable_attributes: ["created_at", "score"],
  ranking_rules: ["words", "typo", "proximity", "attribute", "sort", "exactness"]
})

# Bulk index documents
documents = [%{id: 1, title: "Doc 1"}, %{id: 2, title: "Doc 2"}]
{:ok, task} = PrismaticStorageMeilisearch.add_documents("custom_index", documents)

# Search with filters
{:ok, results} = PrismaticStorageMeilisearch.search("custom_index", "query",
  filter: "category = 'intelligence'",
  sort: ["created_at:desc"],
  limit: 20
)

Production Deployment Checklist

[ ] Master key configured via secrets manager
[ ] Data volume mounted on persistent storage
[ ] Backup procedure verified
[ ] Health monitoring configured
[ ] Memory limits set (--memory flag)
[ ] Version pinned to specific release
[ ] Indexes created and verified
[ ] Search quality validated
[ ] Adapter connectivity confirmed
[ ] Telemetry events flowing

Performance Tuning

SettingDevelopmentStagingProduction
Max indexing memory200MB500MB2GB
Max indexing threads248
Log leveldebuginfowarn
Snapshot intervaldisabled24h6h

Doctrine Compliance

All commands operate under the NO MERCY, NO DOUBTS doctrine:

  • NO MERCY: Zero tolerance for unhealthy Meilisearch instances. Every deployment must pass health validation before being declared successful. No partial deployments. No skipped configuration steps.
  • NO DOUBTS: Full health verification through active probing. Search functionality tested with real queries. Index creation confirmed through API verification. Integration validated end-to-end from Elixir adapter through to search results.

Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL