voxsar / medusa-plugin-typesense-voxsar

MIT License
2 stars 0 forks source link

[FEAT] Configuration example using Docker #1

Open SalahAdDin opened 1 month ago

SalahAdDin commented 1 month ago

Installing and configuring the plugin is easy, but we want to test it properly using Docker for Typesense.

Right now we have the following compose file:

services:

  typesense:
    image: typesense/typesense:0.24.0
    environment:
      TYPESENSE_API_KEY: typesense-api-key
      TYPESENSE_DATA_DIR: /data
    ports:
      - "8108:8108"
    volumes:
      - typesense_data:/data
    networks:
      - medusa-network

And we are setting up with the following .env variables:

TYPESENSE_NODES=/etc/typesense/nodes
TYPESENSE_API_KEY=typesense-api-key

We are not sure about this.

Could you help us?

SalahAdDin commented 1 month ago

So, we updated the compose file adding the following:

  typesense:
    image: typesense/typesense:27.0
    environment:
      TYPESENSE_API_KEY: typesense-api-key
      TYPESENSE_DATA_DIR: /data
    #ports:
    #  - "8108:8108"
    volumes:
      - typesense_data:/data
    networks:
      - medusa-network
    deploy:
      replicas: 3 # Number of Typesense nodes for high availability
      placement:
        constraints: [node.role == manager]

volumes:
  postgres_data:
  typesense_data:

networks:
  medusa-network:
    driver: bridge

And:

TYPESENSE_NODES=http://typesense-node1:8108,http://typesense-node2:8108,http://typesense-node3:8108
TYPESENSE_API_KEY=typesense-api-key

But it gives up an error in the first node:

⠹ Initializing plugins
Request #1727285157196: Request to Node 0 failed due to "ERR_BAD_REQUEST Unsupported protocol typesense-1:"
⠸ Initializing plugins
Request #1727285157196: Request to Node 0 failed due to "ERR_BAD_REQUEST Unsupported protocol typesense-1:"
✔ 

Is it normal?

SalahAdDin commented 1 month ago

We tried adding localhost keyword after the container name since it works for the database and redis:

DATABASE_TYPE=postgres
DATABASE_URL=postgres://medusa:medusastore@localhost/medusa-tLKI

STORE_CORS=http://localhost:8000,http://localhost:7001

MEDUSA_ADMIN_ONBOARDING_TYPE=nextjs
MEDUSA_ADMIN_ONBOARDING_NEXTJS_DIRECTORY=test-storefront

OPEN_BROWSER=true

REDIS_URL=redis://localhost:6379

TYPESENSE_NODES=typesense-1://localhost:8108,typesense-2://localhost:8108,typesense-3://localhost:8108
TYPESENSE_API_KEY=typesense-api-key

Yet it does not work.

Could it be related to this issue?

SalahAdDin commented 1 month ago

It was checked with TYPESENSE_NODES=http://typesense:8108 following the documentation's given node options.

But it does not work:

Request #1727294949320: Request to Node 0 failed due to "ENOTFOUND getaddrinfo ENOTFOUND typesense"
⠸ Initializing plugins
Request #1727294949320: Request to Node 0 failed due to "ENOTFOUND getaddrinfo ENOTFOUND typesense"

We think it is related to the Typesense.

SalahAdDin commented 1 month ago

Finally, passing the ip itself does fix the issue: http://172.19.0.3:8108