Meilisearch-laravel-scout: Laravel sail with Meilisearch: write a Wiki page

Created on 18 Dec 2020  ·  6Comments  ·  Source: meilisearch/meilisearch-laravel-scout

Not sure if right place to put this, but since laravel valet is going to be removed in the future.

I was wondering if this laravel driver supports the usage of laravel sail (dockerized container) https://laravel.com/docs/8.x/sail.

Or if there could be documentation to show how to implement, I have been unable to get this working.

The instance it creates does not get read by this driver is the impression I am getting, though I could easily be wrong.

Screenshot 2020-12-18 at 00 46 38

Screenshot 2020-12-18 at 00 47 06

Screenshot 2020-12-18 at 00 50 12

documentation good first issue

Most helpful comment

Sorry, I am working through docker on LinkedIn courses for a better understanding of its internals, I was just thinking a documentation with a few lines would be nice to have for those who will run into same issue if any, although I can see why it’s not really the responsibility of this package. Appreciate the replies and @shokme for better understanding of docker, helps greatly. Thanks guys 😁

All 6 comments

Hello @marky291
Is hard to write how works docker.
But 0.0.0.0:7700 just mean meilisearch bind the port 7700 on your localhost to be available on your machine. (localhost:7700)
here you are in a laravel container, so you don't want to communicate by port but by service.

If you take a closer look at your .env you can see
DB_HOST=mysql
MAIL_HOST=mailhog
They refer to the service name in your docker-compose.yml
so for meilisearch you need to do
MEILISEARCH_HOST=meilisearch:7700
:7700 because there is no MEILISEARCH_PORT env

I don't know if it's clear for you, this is hard to me to explain how works docker.

docker-compose.yml you need to add this

    meilisearch:
      image: 'getmeili/meilisearch:latest'
      ports:
          - 7700:7700
      networks:
          - sail
      volumes:
      - 'meilisearch:/data.ms'

volumes:
    sailmysql:
        driver: local
    sailredis:
        driver: local
    meilisearch:
        driver: local

About the documentation I'm ok to write a wiki page on how to setup with sail. (let's see with @curquiza)
But in my opinion, when you're using laravel sail, if you don't limit yourself to what sail provides:

Sail provides a great starting point for building a Laravel application using PHP, MySQL, and Redis without requiring prior Docker experience.

You should understand how docker works and how to use it.

Hello @shokme and @marky291!
If it's a wrong usage or a miss understanding of docker or laravel sail I'm not sure this is a priority to add this kind of tutorial. However, if someone would enjoy writing the wiki page, I'm not against at all 😄 Not sure this is your case @shokme haha, so we can wait for another contributor, this tutorial is definitely not an emergency.

Sorry, I am working through docker on LinkedIn courses for a better understanding of its internals, I was just thinking a documentation with a few lines would be nice to have for those who will run into same issue if any, although I can see why it’s not really the responsibility of this package. Appreciate the replies and @shokme for better understanding of docker, helps greatly. Thanks guys 😁

Hello @marky291
Is hard to write how works docker.
But 0.0.0.0:7700 just mean meilisearch bind the port 7700 on your localhost to be available on your machine. (localhost:7700)
here you are in a laravel container, so you don't want to communicate by port but by service.

If you take a closer look at your .env you can see
DB_HOST=mysql
MAIL_HOST=mailhog
They refer to the service name in your docker-compose.yml
so for meilisearch you need to do
MEILISEARCH_HOST=meilisearch:7700
:7700 because there is no MEILISEARCH_PORT env

I don't know if it's clear for you, this is hard to me to explain how works docker.

docker-compose.yml you need to add this

    meilisearch:
      image: 'getmeili/meilisearch:latest'
      ports:
          - 7700:7700
      networks:
          - sail
      volumes:
      - 'meilisearch:/data.ms'

volumes:
    sailmysql:
        driver: local
    sailredis:
        driver: local
    meilisearch:
        driver: local

This worked perfect, only adjustment is the driver requires a protocol, using the following fixed it with the above.
MEILISEARCH_HOST=http://meilisearch:7700

Thanks for your feedback @marky291 and thanks @shokme for having taken the time to answer!
Can I close this issue then?

Was this page helpful?
0 / 5 - 0 ratings