hi! can i ask question that is laravel package-rel...
# community-help
j
hi! can i ask question that is laravel package-related? (
typesense/laravel-scout-typesense-driver
)
k
Yes, please post here and will get someone to respond.
❤️ 1
j
@Kishore Nallan thanks! I’ll paste here since I asked this in github Description Hi! im getting networkexception, but im not sure if this has something to do with me setting up from docker or something else.
Copy code
Http\Client\Exception\NetworkException with message 'Failed to connect to localhost port 8108: Connection refused for "<http://localhost:8108/collections/todo>".'
Steps to reproduce 1. added in my existing docker-compose.yml
Copy code
...
  typsense:
    image: typesense/typesense:0.22.2
    container_name: typesense
    environment:
      TYPESENSE_DATA_DIR: /data
      TYPESENSE_API_KEY: xyz
    volumes:
      - /tmp/typesense-server-data:/data
    ports:
      - "8108:8108"
    restart: "no"
    networks:
      laravel:
...
2. docker compose up -d, then
curl <http://localhost:8108/health>
which returned
{"ok":true}
3. Followed the readme instructions section: - dependencies (guzzle7 adapter and laravel-scout-typesense-driver) - service provider -
artisan vendor:publish ...
-
config/scout.php
-
Searchable
trait as well as
TypesenseDocument
interface - setting
SCOUT_DRIVER
value to typesense -
php artisan scout:import App\\Models\\Todo
Expected Behavior returning the searched results Actual Behavior After the installation and syncing, I tried this inside `tinker`:
Todo::search('Test')->get();
then i get this
Copy code
>>> Images::search('female')->get()
Http\Client\Exception\NetworkException with message 'Failed to connect to localhost port 8108: Connection refused for "<http://localhost:8108/collections/todo>".'
Metadata Typsense Version: 0.22.2 OS: macos 12.4 Laravel v8
e
Shouldn't it connect to host "typesense" instead of localhost? It's not the app container (localhost) that's running typesense, right? I'm guessing a bit now. I'm using Lando, which is using docker under the hood, so it's a bit different than using docker directly.
2
Also, this is assuming you're running the web/php server in a separate container as well, and not natively on your machine.
j
@em1nos ah mybad, took me days before i realized the hostname is
typesense
(
container_name
) 🤦. It’s now working, thanks so much for pointing it out!!!
k
Thanks for the help @em1nos
e
I'm glad I could help :)