Meilisearch: 4. Create the service

This documentation is part of the Automate with the CLI guide. View the full guide here: Start Meilisearch, retrieve its credentials, and change its configuration programmatically with the Stackhero CLI.

Welcome to the Stackhero documentation!

If you need a fast, typo-tolerant search engine that is easy to deploy, Stackhero's Meilisearch cloud service lets you get started in minutes. Here is what you get:

  • Custom domain support with integrated HTTPS for secure access.
  • Simple, one-click updates. No manual work is needed.
  • Consistent performance and strong isolation with your own private, dedicated infrastructure.

You can be up and running with Meilisearch cloud hosting on Stackhero in just 5 minutes. The setup is designed to save you time and keep your deployment straightforward.

Here is a sample script that creates a stack, adds your Meilisearch service to it, waits for it to start, retrieves its configuration (including generated credentials), and then applies a new configuration.

#!/bin/bash
set -e

export STACKHERO_TOKEN="usr-xxxxxx:your-token"

serviceStore="meilisearch"   # The Meilisearch service store name (see step 2)
instance="..."                # An instance size from step 3
region="europe"               # A region name from step 3

# Create a stack for your service (uses your default organization; add --organization if needed)
stackId=$(stackhero --format=script stack-create \
  --name="My Meilisearch stack")
echo "Stack created: ${stackId}"

# Add Meilisearch to the stack (names are resolved automatically)
serviceId=$(stackhero --format=script service-add \
  --stack="My Meilisearch stack" \
  --service-store="${serviceStore}" \
  --instance="${instance}" \
  --region="${region}")
echo "Service added: meilisearch"

# Wait for the service to be fully running (this may take a couple of minutes)
stackhero service-wait-for --service="meilisearch"

# Retrieve the service configuration, including generated credentials
stackhero service-configuration-get --service="meilisearch" --format=json