Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Laravel sail with Meilisearch: write a Wiki page #67

Closed
marky291 opened this issue Dec 18, 2020 · 6 comments
Closed

Laravel sail with Meilisearch: write a Wiki page #67

marky291 opened this issue Dec 18, 2020 · 6 comments
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@marky291
Copy link

marky291 commented Dec 18, 2020

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

@shokme shokme self-assigned this Dec 18, 2020
@shokme
Copy link
Collaborator

shokme commented Dec 18, 2020

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

@shokme
Copy link
Collaborator

shokme commented Dec 18, 2020

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.

@curquiza
Copy link
Member

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.

@curquiza curquiza changed the title Laravel sail with Meilisearch Laravel sail with Meilisearch: write a Wiki page Dec 18, 2020
@curquiza curquiza added documentation Improvements or additions to documentation good first issue Good for newcomers labels Dec 18, 2020
@marky291
Copy link
Author

marky291 commented Dec 18, 2020

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 😁

@marky291
Copy link
Author

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

@curquiza
Copy link
Member

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants