Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cant connect to mongodb #325

Closed
kajvans opened this issue Dec 17, 2023 · 4 comments
Closed

cant connect to mongodb #325

kajvans opened this issue Dec 17, 2023 · 4 comments

Comments

@kajvans
Copy link

kajvans commented Dec 17, 2023

running the docker on a remote server and when i run the docker the server does not load anything
docker-compose.yml:

version: "3"

services:
  server:
    image: yooooomi/your_spotify_server
    restart: always
    ports:
      - "8080:8080"
    links:
      - mongo
    depends_on:
      - mongo
    environment:
      API_ENDPOINT: urlserver # This MUST be included as a valid URL in the spotify dashboard (see below)
      CLIENT_ENDPOINT: urlclient
      SPOTIFY_PUBLIC: pub
      SPOTIFY_SECRET: priv
  mongo:
    container_name: mongo
    image: mongo:6
    volumes:
      - ./your_spotify_db:/data/db

  web:
    image: yooooomi/your_spotify_client
    restart: always
    ports:
      - "3000:3000"
    environment:
      API_ENDPOINT: urlsever

networks:
  default:
    external: true
    name: services

i get this error on the server:

$ node ./lib/migrations.js
[info]  Trying to connect to database at mongodb://mongo:27017/your_spotify
/app/node_modules/mongoose/lib/connection.js:805
    err = new ServerSelectionError();
          ^

MongooseServerSelectionError: getaddrinfo ENOTFOUND mongo
    at _handleConnectionErrors (/app/node_modules/mongoose/lib/connection.js:805:11)
    at NativeConnection.openUri (/app/node_modules/mongoose/lib/connection.js:780:11) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) {
      'mongo:27017' => ServerDescription {
        address: 'mongo:27017',
        type: 'Unknown',
        hosts: [],
        passives: [],
        arbiters: [],
        tags: {},
        minWireVersion: 0,
        maxWireVersion: 0,
        roundTripTime: -1,
        lastUpdateTime: 176592678,
        lastWriteDate: 0,
        error: MongoNetworkError: getaddrinfo ENOTFOUND mongo
            at connectionFailureError (/app/node_modules/mongoose/node_modules/mongodb/lib/cmap/connect.js:379:20)
            at Socket.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/cmap/connect.js:285:22)
            at Object.onceWrapper (node:events:628:26)
            at Socket.emit (node:events:513:28)
            at emitErrorNT (node:internal/streams/destroy:157:8)
            at emitErrorCloseNT (node:internal/streams/destroy:122:3)
            at processTicksAndRejections (node:internal/process/task_queues:83:21) {
          [Symbol(errorLabels)]: Set(1) { 'ResetPool' },
          [cause]: Error: getaddrinfo ENOTFOUND mongo
              at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) {
            errno: -3007,
            code: 'ENOTFOUND',
            syscall: 'getaddrinfo',
            hostname: 'mongo'
          }
        },
        topologyVersion: null,
        setName: null,
        setVersion: null,
        electionId: null,
        logicalSessionTimeoutMinutes: null,
        primary: null,
        me: null,
        '$clusterTime': null
      }
    },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

also when running the command docker ps i dont see the mongodb docker
do i need to install mongodb myself or?

@Yooooomi
Copy link
Owner

Hello, please send the mongo container logs. I would be your mongo instance fails to start.

@kajvans
Copy link
Author

kajvans commented Dec 18, 2023

i dont have a mongo container so i cant send it, when running docker ps the mongo container does not show.

@kajvans
Copy link
Author

kajvans commented Dec 18, 2023

found the error:

WARNING: MongoDB requires ARMv8.2-A or higher, and your current system does not appear to implement any of the common features for that!
applies to all versions ≥5.0, any of 4.4 ≥4.4.19
see https://jira.mongodb.org/browse/SERVER-71772
see https://jira.mongodb.org/browse/SERVER-55178
see also https://en.wikichip.org/wiki/arm/armv8#ARMv8_Extensions_and_Processor_Features
see also docker-library/mongo#485 (comment)

@thiagosanches
Copy link

I had to stick to the 4.4.6 version:

image

And the docker-compose stack started properly, even running the database migration (as far I looked at the logs).

server-1  | [info]  Running migration: add dark mode
server-1  | [info]  Running migration: fixing first listened at
server-1  | [info]  Running migration: create private data
server-1  | [info]  Running migration: add metadata to infos
server-1  | [info]  Checking database for missing track data...
server-1  | [warn]  No user is admin, cannot auto fix database

@kajvans kajvans closed this as completed Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants