Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Typesense #655

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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