#community-help

Laravel Package related Issue Resolved (`typesense/laravel-scout-typesense-driver`)

TLDR Jaeyson faced a network exception while setting up typesense/laravel-scout-typesense-driver on Docker. em1nos solved the issue by suggesting changing the hostname to "typesense".

Powered by Struct AI

2

1

8
19mo
Solved
Join the chat
Jun 09, 2022 (19 months ago)
Jaeyson
Photo of md5-7be554727c46b2e8b385c6cb00b24d2c
Jaeyson
08:40 AM
hi! can i ask question that is laravel package-related? (typesense/laravel-scout-typesense-driver)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:52 AM
Yes, please post here and will get someone to respond.

1

Jaeyson
Photo of md5-7be554727c46b2e8b385c6cb00b24d2c
Jaeyson
08:55 AM
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.

Http\Client\Exception\NetworkException with message 'Failed to connect to localhost port 8108: Connection refused for "".'

Steps to reproduce

1. added in my existing docker-compose.yml
...
  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')-&gt;get(); then i get this

>>> Images::search('female')->get()
Http\Client\Exception\NetworkException with message 'Failed to connect to localhost port 8108: Connection refused for "".'

Metadata

Typsense Version: 0.22.2

OS: macos 12.4

Laravel v8
em1nos
Photo of md5-f33ae8b829901656b655c985c894be3a
em1nos
12:39 PM
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

12:42
em1nos
12:42 PM
Also, this is assuming you're running the web/php server in a separate container as well, and not natively on your machine.
Jaeyson
Photo of md5-7be554727c46b2e8b385c6cb00b24d2c
Jaeyson
12:56 PM
em1nos ah mybad, took me days before i realized the hostname is typesense (container_name) :face_palm:. It’s now working, thanks so much for pointing it out!!!
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:44 PM
Thanks for the help em1nos
em1nos
Photo of md5-f33ae8b829901656b655c985c894be3a
em1nos
01:46 PM
I'm glad I could help :)

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3011 threads (79% resolved)

Join Our Community

Similar Threads

Collaborative Project on Laravel Scout Integration with Typesense

Joe used Typesense and Laravel to index documents quickly. He suggested adding Typesense to Laravel Scout docs. Jason agreed and asked community members for help. Abdullah volunteered to maintain the integration. Raises were raised and plans discussed, with unexpected resistance from official channels.

7

28
26mo
Solved

Collaborating on Laravel Scout Engine for Typesense

Jason invited contributors Abdullah and Tim for a collaboration on the Laravel Scout engine for Typesense. They discussed framework intricacies and agreed to collaborate under Typesense's GitHub organization.

4

22
33mo
Solved

Incorporation of Laravel Scout Engine to TypeSense Organization

Jason and Alex discuss adopting Abdullah's Laravel Scout Engine into the TypeSense organization. Abdullah agrees, leading to Jason creating a repo within the organization and hi019 helping to complete transition tasks.

3

13
31mo
Solved

Issue with Laravel Scout After Typesense 0.24 Update

em1nos had issues with Laravel Scout after Typesense 0.24 update. Jason suggested rolling back to v5.1.0, which resolved the issue.

1

5
10mo
Solved

Installing and Running Typesense Server on Fedora 35

User Edson struggled to initiate Typesense server. Jason suggested using the RC build for Fedora 35. After troubleshooting and following instructions, Edson was finally able to start their server. They discussed the need for clearer installation documentation since it was an incompatibility issue with Fedora 35.

3

32
24mo
Solved