Coder Social home page Coder Social logo

Comments (7)

jsonsmth avatar jsonsmth commented on May 16, 2024

I had the same issue on my Mac with M1 chip. I installed MongoDB locally on my Mac using Homebrew and updated the .env file to point to the local host to connect to MongoDB. Here are some links that might be helpful:

https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-os-x/

https://stackoverflow.com/questions/65357744/how-to-install-mongodb-on-apple-m1-chip

Here's the updated MongoDB connection string in my .env file:

DATABASE_URL=mongodb://docker.for.mac.host.internal:27017/lms

from serge.

nsarrazin avatar nsarrazin commented on May 16, 2024

Oh interesting. Unfortunately I can't replicate this since I don't have a mac.

Could one of you try replacing this line in the docker compose file
https://github.com/nsarrazin/serge/blob/b4c329286c8ce611ddcad2301aecfff09ae580fd/docker-compose.yml#L17
by

    image: mongo

and let me know if it works ?

from serge.

kells1986 avatar kells1986 commented on May 16, 2024

I just tried changing the image tag and it didn't make any difference for me (I'm on M1).

Here's the traceback:

serge-api-1      | ERROR:    Traceback (most recent call last):
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 677, in lifespan
serge-api-1      |     async with self.lifespan_context(app) as maybe_state:
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 566, in __aenter__
serge-api-1      |     await self._router.startup()
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 654, in startup
serge-api-1      |     await handler()
serge-api-1      |   File "/usr/src/app/main.py", line 50, in start_database
serge-api-1      |     await initiate_database()
serge-api-1      |   File "/usr/src/app/utils/initiate_database.py", line 25, in initiate_database
serge-api-1      |     await init_beanie(
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/beanie/odm/utils/init.py", line 528, in init_beanie
serge-api-1      |     await Initializer(
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/beanie/odm/utils/init.py", line 89, in __await__
serge-api-1      |     yield from self.init_class(model).__await__()
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/beanie/odm/utils/init.py", line 498, in init_class
serge-api-1      |     await self.init_document(cls)
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/beanie/odm/utils/init.py", line 322, in init_document
serge-api-1      |     build_info = await self.database.command({"buildInfo": 1})
serge-api-1      |   File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
serge-api-1      |     result = self.fn(*self.args, **self.kwargs)
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/pymongo/_csot.py", line 105, in csot_wrapper
serge-api-1      |     return func(self, *args, **kwargs)
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/pymongo/database.py", line 805, in command
serge-api-1      |     with self.__client._socket_for_reads(read_preference, session) as (
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/pymongo/mongo_client.py", line 1296, in _socket_for_reads
serge-api-1      |     server = self._select_server(read_preference, session)
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/pymongo/mongo_client.py", line 1257, in _select_server
serge-api-1      |     server = topology.select_server(server_selector)
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/pymongo/topology.py", line 272, in select_server
serge-api-1      |     server = self._select_server(selector, server_selection_timeout, address)
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/pymongo/topology.py", line 261, in _select_server
serge-api-1      |     servers = self.select_servers(selector, server_selection_timeout, address)
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/pymongo/topology.py", line 223, in select_servers
serge-api-1      |     server_descriptions = self._select_servers_loop(selector, server_timeout, address)
serge-api-1      |   File "/usr/local/lib/python3.10/dist-packages/pymongo/topology.py", line 238, in _select_servers_loop
serge-api-1      |     raise ServerSelectionTimeoutError(
serge-api-1      | pymongo.errors.ServerSelectionTimeoutError: mongodb:27017: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: 641b09503ff17e5cf2a90bc7, topology_type: Unknown, servers: [<ServerDescription ('mongodb', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('mongodb:27017: [Errno 111] Connection refused')>]>
serge-api-1      | 
serge-api-1      | ERROR:    Application startup failed. Exiting.

I'll try the workaround suggested above.

Great project, really excited to get it up and running!

from serge.

kells1986 avatar kells1986 commented on May 16, 2024

OK, I think it might be working!

mongodb:
    image: mongo:6.0.4-jammy
    ports:
      - "27017"
    volumes:
      - data:/data/db

I'm not seeing any errors, but I've clicked "start new chat" and it's hanging.

from serge.

nawalnew avatar nawalnew commented on May 16, 2024

Thank you all very much.
@kells1986 Solution works. Thank you very much!!

I just cant chose a model, but this seems to have another problem.

from serge.

nsarrazin avatar nsarrazin commented on May 16, 2024

OK, I think it might be working!

mongodb:
    image: mongo:6.0.4-jammy
    ports:
      - "27017"
    volumes:
      - data:/data/db

I'm not seeing any errors, but I've clicked "start new chat" and it's hanging.

Alright good to hear! Also still works for me on linux so I pushed it to main with b824261

I think the bitnami image was the problem.

Feel free to open new issues if you find any bugs ! I can help fix them, this is a pretty new project so there might be things that work on my machine that don't work for others.

from serge.

nawalnew avatar nawalnew commented on May 16, 2024

Thank you very much. I am excited to try it.

from serge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.