From a8b9e98e19362c28d29b6dc95a9990e41358abc6 Mon Sep 17 00:00:00 2001 From: Jason Bosco Date: Tue, 16 Jan 2024 19:12:57 -0600 Subject: [PATCH] Add support for Typesense --- .../InteractsWithDockerComposeServices.php | 11 ++++++++++- stubs/typesense.stub | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 stubs/typesense.stub diff --git a/src/Console/Concerns/InteractsWithDockerComposeServices.php b/src/Console/Concerns/InteractsWithDockerComposeServices.php index d0821c67..f9b0664b 100644 --- a/src/Console/Concerns/InteractsWithDockerComposeServices.php +++ b/src/Console/Concerns/InteractsWithDockerComposeServices.php @@ -19,6 +19,7 @@ trait InteractsWithDockerComposeServices 'redis', 'memcached', 'meilisearch', + 'typesense', 'minio', 'mailpit', 'selenium', @@ -86,7 +87,7 @@ protected function buildDockerCompose(array $services) // Merge volumes... collect($services) ->filter(function ($service) { - return in_array($service, ['mysql', 'pgsql', 'mariadb', 'redis', 'meilisearch', 'minio']); + return in_array($service, ['mysql', 'pgsql', 'mariadb', 'redis', 'meilisearch', 'typesense', 'minio']); })->filter(function ($service) use ($compose) { return ! array_key_exists($service, $compose['volumes'] ?? []); })->each(function ($service) use (&$compose) { @@ -143,6 +144,14 @@ protected function replaceEnvVariables(array $services) $environment .= "\nMEILISEARCH_NO_ANALYTICS=false\n"; } + if (in_array('typesense', $services)) { + $environment .= "\nSCOUT_DRIVER=typesense"; + $environment .= "\nTYPESENSE_HOST=typesense"; + $environment .= "\nTYPESENSE_PORT=8108"; + $environment .= "\nTYPESENSE_PROTOCOL=http"; + $environment .= "\nTYPESENSE_API_KEY=xyz\n"; + } + if (in_array('soketi', $services)) { $environment = preg_replace("/^BROADCAST_DRIVER=(.*)/m", "BROADCAST_DRIVER=pusher", $environment); $environment = preg_replace("/^PUSHER_APP_ID=(.*)/m", "PUSHER_APP_ID=app-id", $environment); diff --git a/stubs/typesense.stub b/stubs/typesense.stub new file mode 100644 index 00000000..dd3b8f44 --- /dev/null +++ b/stubs/typesense.stub @@ -0,0 +1,16 @@ +typesense: + image: 'typesense/typesense:0.25.2' + ports: + - '${FORWARD_TYPESENSE_PORT:-8108}:8108' + environment: + TYPESENSE_DATA_DIR: '${TYPESENSE_DATA_DIR:-/typesense-data}' + TYPESENSE_API_KEY: '${TYPESENSE_API_KEY:-xyz}' + TYPESENSE_ENABLE_CORS: '${TYPESENSE_ENABLE_CORS:-true}' + volumes: + - 'sail-typesense:/typesense-data' + networks: + - sail + healthcheck: + test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:8108/health"] + retries: 5 + timeout: 7s