Author SHA1 Message Date
arvanitakis c7bd1efdaa Feature: Adding Meilisearch to 3dealer 2026-08-05 23:12:22 +03:00
7 changed files with 1377 additions and 268 deletions
+6
View File
@@ -79,6 +79,11 @@ STOIC_SECRET=dev-secret-change-me
STOIC_SSO_SECRET=dev-sso-secret-change-me STOIC_SSO_SECRET=dev-sso-secret-change-me
STOIC_HOST=http://localhost:2727 STOIC_HOST=http://localhost:2727
SCOUT_DRIVER=meilisearch
SCOUT_QUEUE=true
MEILISEARCH_KEY=dev-meilisearch-key-change-me
MEILISEARCH_HOST=http://meilisearch:7700
# Host-side ports — change these if another project on this machine already uses the defaults # Host-side ports — change these if another project on this machine already uses the defaults
APP_PORT=8090 APP_PORT=8090
STOIC_PORT=2727 STOIC_PORT=2727
@@ -86,3 +91,4 @@ VALKEY_PORT=6339
POSTGRES_HOST_PORT=5436 POSTGRES_HOST_PORT=5436
MAILPIT_PORT=8025 MAILPIT_PORT=8025
VITE_PORT=5173 VITE_PORT=5173
MEILISEARCH_PORT=7700
Generated
+1127 -267
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -49,7 +49,7 @@
Lunar\Models\Collection::class => Lunar\Search\CollectionIndexer::class, Lunar\Models\Collection::class => Lunar\Search\CollectionIndexer::class,
Lunar\Models\Customer::class => Lunar\Search\CustomerIndexer::class, Lunar\Models\Customer::class => Lunar\Search\CustomerIndexer::class,
Lunar\Models\Order::class => Lunar\Search\OrderIndexer::class, Lunar\Models\Order::class => Lunar\Search\OrderIndexer::class,
Lunar\Models\Product::class => Lunar\Search\ProductIndexer::class, Lunar\Models\Product::class => Modules\Core\Search\ProductIndexer::class,
Lunar\Models\ProductOption::class => Lunar\Search\ProductOptionIndexer::class, Lunar\Models\ProductOption::class => Lunar\Search\ProductOptionIndexer::class,
], ],
+210
View File
@@ -0,0 +1,210 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Search Engine
|--------------------------------------------------------------------------
|
| This option controls the default search connection that gets used while
| using Laravel Scout. This connection is used when syncing all models
| to the search service. You should adjust this based on your needs.
|
| Supported: "algolia", "meilisearch", "typesense",
| "database", "collection", "null"
|
*/
'driver' => env('SCOUT_DRIVER', 'collection'),
/*
|--------------------------------------------------------------------------
| Index Prefix
|--------------------------------------------------------------------------
|
| Here you may specify a prefix that will be applied to all search index
| names used by Scout. This prefix may be useful if you have multiple
| "tenants" or applications sharing the same search infrastructure.
|
*/
'prefix' => env('SCOUT_PREFIX', ''),
/*
|--------------------------------------------------------------------------
| Queue Data Syncing
|--------------------------------------------------------------------------
|
| This option allows you to control if the operations that sync your data
| with your search engines are queued. When this is set to "true" then
| all automatic data syncing will get queued for better performance.
|
*/
'queue' => env('SCOUT_QUEUE', false),
/*
|--------------------------------------------------------------------------
| Database Transactions
|--------------------------------------------------------------------------
|
| This configuration option determines if your data will only be synced
| with your search indexes after every open database transaction has
| been committed, thus preventing any discarded data from syncing.
|
*/
'after_commit' => false,
/*
|--------------------------------------------------------------------------
| Chunk Sizes
|--------------------------------------------------------------------------
|
| These options allow you to control the maximum chunk size when you are
| mass importing data into the search engine. This allows you to fine
| tune each of these chunk sizes based on the power of the servers.
|
*/
'chunk' => [
'searchable' => 500,
'unsearchable' => 500,
],
/*
|--------------------------------------------------------------------------
| Soft Deletes
|--------------------------------------------------------------------------
|
| This option allows to control whether to keep soft deleted records in
| the search indexes. Maintaining soft deleted records can be useful
| if your application still needs to search for the records later.
|
*/
'soft_delete' => false,
/*
|--------------------------------------------------------------------------
| Identify User
|--------------------------------------------------------------------------
|
| This option allows you to control whether to notify the search engine
| of the user performing the search. This is sometimes useful if the
| engine supports any analytics based on this application's users.
|
| Supported engines: "algolia"
|
*/
'identify' => env('SCOUT_IDENTIFY', false),
/*
|--------------------------------------------------------------------------
| Algolia Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your Algolia settings. Algolia is a cloud hosted
| search engine which works great with Scout out of the box. Just plug
| in your application ID and admin API key to get started searching.
|
*/
'algolia' => [
'id' => env('ALGOLIA_APP_ID', ''),
'secret' => env('ALGOLIA_SECRET', ''),
'index-settings' => [
// 'users' => [
// 'searchableAttributes' => ['id', 'name', 'email'],
// 'attributesForFaceting'=> ['filterOnly(email)'],
// ],
],
],
/*
|--------------------------------------------------------------------------
| Meilisearch Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your Meilisearch settings. Meilisearch is an open
| source search engine with minimal configuration. Below, you can state
| the host and key information for your own Meilisearch installation.
|
| See: https://www.meilisearch.com/docs/learn/configuration/instance_options#all-instance-options
|
*/
'meilisearch' => [
'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'),
'key' => env('MEILISEARCH_KEY'),
'index-settings' => [
// 'users' => [
// 'filterableAttributes'=> ['id', 'name', 'email'],
// ],
],
],
/*
|--------------------------------------------------------------------------
| Typesense Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your Typesense settings. Typesense is an open
| source search engine using minimal configuration. Below, you will
| state the host, key, and schema configuration for the instance.
|
*/
'typesense' => [
'client-settings' => [
'api_key' => env('TYPESENSE_API_KEY', 'xyz'),
'nodes' => [
[
'host' => env('TYPESENSE_HOST', 'localhost'),
'port' => env('TYPESENSE_PORT', '8108'),
'path' => env('TYPESENSE_PATH', ''),
'protocol' => env('TYPESENSE_PROTOCOL', 'http'),
],
],
'nearest_node' => [
'host' => env('TYPESENSE_HOST', 'localhost'),
'port' => env('TYPESENSE_PORT', '8108'),
'path' => env('TYPESENSE_PATH', ''),
'protocol' => env('TYPESENSE_PROTOCOL', 'http'),
],
'connection_timeout_seconds' => env('TYPESENSE_CONNECTION_TIMEOUT_SECONDS', 2),
'healthcheck_interval_seconds' => env('TYPESENSE_HEALTHCHECK_INTERVAL_SECONDS', 30),
'num_retries' => env('TYPESENSE_NUM_RETRIES', 3),
'retry_interval_seconds' => env('TYPESENSE_RETRY_INTERVAL_SECONDS', 1),
],
// 'max_total_results' => env('TYPESENSE_MAX_TOTAL_RESULTS', 1000),
'model-settings' => [
// User::class => [
// 'collection-schema' => [
// 'fields' => [
// [
// 'name' => 'id',
// 'type' => 'string',
// ],
// [
// 'name' => 'name',
// 'type' => 'string',
// ],
// [
// 'name' => 'created_at',
// 'type' => 'int64',
// ],
// ],
// 'default_sorting_field' => 'created_at',
// ],
// 'search-parameters' => [
// 'query_by' => 'name'
// ],
// ],
],
'import_action' => env('TYPESENSE_IMPORT_ACTION', 'upsert'),
],
];
+12
View File
@@ -113,6 +113,17 @@ services:
ports: ports:
- "${VALKEY_PORT:-6339}:6379" - "${VALKEY_PORT:-6339}:6379"
meilisearch:
image: getmeili/meilisearch:v1.10
ports:
- "${MEILISEARCH_PORT:-7700}:7700"
environment:
MEILI_MASTER_KEY: ${MEILISEARCH_KEY:?MEILISEARCH_KEY is required}
MEILI_NO_ANALYTICS: "true"
MEILI_ENV: development
volumes:
- meilidata:/meili_data
stoic: stoic:
image: ghcr.io/lexx27/stoic:latest image: ghcr.io/lexx27/stoic:latest
user: root user: root
@@ -149,3 +160,4 @@ volumes:
vendor: vendor:
node_modules: node_modules:
pgdata: pgdata:
meilidata:
+15
View File
@@ -115,6 +115,20 @@ services:
volumes: volumes:
- valkeydata:/data - valkeydata:/data
meilisearch:
image: getmeili/meilisearch:v1.10
restart: unless-stopped
environment:
MEILI_MASTER_KEY: ${MEILISEARCH_KEY:?MEILISEARCH_KEY is required}
MEILI_NO_ANALYTICS: "true"
volumes:
- meilidata:/meili_data
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:7700/health"]
interval: 5s
timeout: 5s
retries: 10
otel-collector: otel-collector:
image: otel/opentelemetry-collector-contrib:latest image: otel/opentelemetry-collector-contrib:latest
restart: unless-stopped restart: unless-stopped
@@ -145,3 +159,4 @@ volumes:
logs: logs:
framework: framework:
valkeydata: valkeydata:
meilidata:
+6
View File
@@ -6,6 +6,7 @@ set -e
if [ "$APP_ENV" != "production" ]; then if [ "$APP_ENV" != "production" ]; then
echo "[entrypoint] Installing Composer dependencies..." echo "[entrypoint] Installing Composer dependencies..."
git config --global --add safe.directory /var/www/html 2>/dev/null || true git config --global --add safe.directory /var/www/html 2>/dev/null || true
git config --global --add safe.directory /var/www/boboko-core 2>/dev/null || true
composer install --no-interaction --prefer-dist composer install --no-interaction --prefer-dist
# Re-resolve boboko/* on every boot, whether it's a local path-repo checkout # Re-resolve boboko/* on every boot, whether it's a local path-repo checkout
@@ -42,6 +43,11 @@ if [ "$APP_ENV" != "production" ]; then
# this themselves, since the country import's check-then-insert isn't safe to # this themselves, since the country import's check-then-insert isn't safe to
# run concurrently. # run concurrently.
php artisan lunar:install --quiet || true php artisan lunar:install --quiet || true
# Upserts by primary key (no --refresh), so this stays cheap and idempotent on
# every boot rather than flushing and rebuilding the whole index each time.
echo "[entrypoint] Syncing search indexes..."
php artisan lunar:search:index --quiet || true
fi fi
exec "$@" exec "$@"