Yooooomi / your_spotify

Self hosted Spotify tracking dashboard
GNU General Public License v3.0
2.67k stars 109 forks source link

cant connect to mongodb #325

Closed kajvans closed 3 months ago

kajvans commented 7 months ago

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 commented 7 months ago

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

kajvans commented 7 months ago

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

kajvans commented 7 months ago

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 https://github.com/docker-library/mongo/issues/485#issuecomment-970864306

thiagosanches commented 4 months ago

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