Add Meilisearch deploy support and studio grid tweak

This commit is contained in:
2026-04-06 09:33:28 +02:00
parent 08ad757bcb
commit 23d363a50c
4 changed files with 78 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ local_build_command="${LOCAL_BUILD_COMMAND:-}"
run_local_build=1
run_remote_migrations=1
run_db_sync=0
run_meilisearch_setup=0
db_sync_source=""
legacy_db_sync_mode=0
force_db_sync=0
@@ -37,6 +38,7 @@ Options:
Must equal 'replace production db from local' when running non-interactively.
--with-db Legacy alias for --with-db-from=local.
--force-db-sync Legacy extra confirmation flag for --with-db.
--with-meilisearch Sync index settings then reimport all searchable models.
--no-maintenance Skip php artisan down/up during deploy.
--help Show this help.
@@ -157,6 +159,9 @@ while [[ $# -gt 0 ]]; do
--confirm-db-sync-phrase=*)
db_sync_confirm_phrase="${1#*=}"
;;
--with-meilisearch)
run_meilisearch_setup=1
;;
--no-maintenance)
skip_maintenance=1
;;
@@ -235,6 +240,7 @@ echo "Running remote Composer and Artisan steps..."
COMPOSER_BIN="$(printf '%q' "$composer_bin")" \
RUN_REMOTE_MIGRATIONS="$run_remote_migrations" \
SKIP_MAINTENANCE="$skip_maintenance" \
RUN_MEILISEARCH_SETUP="$run_meilisearch_setup" \
'bash -s' <<'EOF'
set -euo pipefail
@@ -263,6 +269,18 @@ fi
"$PHP_BIN" artisan view:cache
"$PHP_BIN" artisan queue:restart || true
if [[ "$RUN_MEILISEARCH_SETUP" -eq 1 ]]; then
echo "Importing searchable models into Meilisearch (auto-creates indexes)..."
"$PHP_BIN" artisan scout:import "App\\Models\\Artwork"
"$PHP_BIN" artisan scout:import "App\\Models\\User"
"$PHP_BIN" artisan scout:import "App\\Models\\Group"
"$PHP_BIN" artisan scout:import "App\\Models\\Post"
"$PHP_BIN" artisan scout:import "App\\Models\\Message"
echo "Syncing Meilisearch index settings..."
"$PHP_BIN" artisan scout:sync-index-settings
echo "Meilisearch setup complete."
fi
if [[ "$SKIP_MAINTENANCE" -eq 0 ]]; then
"$PHP_BIN" artisan up
trap - EXIT