Skip to content

Commit

Permalink
Add support for Typesense (#655)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbosco authored Jan 17, 2024
1 parent 5f38e71 commit 988961f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Console/Concerns/InteractsWithDockerComposeServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ trait InteractsWithDockerComposeServices
'redis',
'memcached',
'meilisearch',
'typesense',
'minio',
'mailpit',
'selenium',
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 16 additions & 0 deletions stubs/typesense.stub
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 988961f

Please sign in to comment.