Skip to content

Instantly share code, notes, and snippets.

@AniTexs
Created July 22, 2025 17:57
Show Gist options
  • Select an option

  • Save AniTexs/99e66d818a21cdce70c6c0f3f256c99a to your computer and use it in GitHub Desktop.

Select an option

Save AniTexs/99e66d818a21cdce70c6c0f3f256c99a to your computer and use it in GitHub Desktop.
OpenAI Codex Laravel Meilisearch Setup
#!/usr/bin/env bash
MEILI_VERSION="${MEILI_VERSION:-latest}"
MEILI_MASTER_KEY="${MEILI_MASTER_KEY:-masterKey}"
MEILISEARCH_BIN="/usr/local/bin/meilisearch"
MEILISEARCH_HOST="http://127.0.0.1:7700"
if [ ! -x "$MEILISEARCH_BIN" ]; then
echo "Installing Meilisearch ($MEILI_VERSION) …"
if [ "$MEILI_VERSION" = "latest" ]; then
curl -L https://install.meilisearch.com | sh
else
ASSET_URL="https://github.com/meilisearch/meilisearch/releases/download/${MEILI_VERSION}/meilisearch-linux-amd64"
if ! curl -fSL "$ASSET_URL" -o meilisearch; then
echo "⚠️ Version $MEILI_VERSION not found – falling back to latest" >&2
curl -L https://install.meilisearch.com | sh
fi
fi
chmod +x ./meilisearch
mv ./meilisearch "$MEILISEARCH_BIN"
fi
export MEILISEARCH_HOST MEILISEARCH_KEY="$MEILI_MASTER_KEY"
nohup "$MEILISEARCH_BIN" --master-key "$MEILI_MASTER_KEY" --http-addr "127.0.0.1:7700" \
> /tmp/meilisearch.log 2>&1 &
printf "Waiting for Meilisearch"; for _ in {30..0}; do
if curl -sf "$MEILISEARCH_HOST/health" >/dev/null; then
echo -e "\r✅ Meilisearch healthy "; break; fi
printf "."; sleep 1; done
curl -sf "$MEILISEARCH_HOST/health" >/dev/null || { echo; tail -n 50 /tmp/meilisearch.log; exit 1; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment