electerious / Ackee

Self-hosted, Node.js based analytics tool for those who care about privacy.
https://ackee.electerious.com
MIT License
4.2k stars 351 forks source link

Update guide for MongoDB #293

Closed BrookeDot closed 2 years ago

BrookeDot commented 2 years ago

🐞 Describe the bug

I'm not sure how this happens, but my current MongoDB version is 4.4.6 with Ackee 3.1.1. Whenever I try to upgrade the images using docker-composer Mongo throws a few errors.

sudo docker-compose exec  mongo sh
# mongod --version
db version v4.4.6
Build Info: {
    "version": "4.4.6",
    "gitVersion": "72e66213c2c3eab37d9358d5e78ad7f5c1d0d0d7",
    "openSSLVersion": "OpenSSL 1.1.1  11 Sep 2018",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "ubuntu1804",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

mongo | {"t":{"$date":"2021-09-21T16:45:34.628+00:00"},"s":"F", "c":"CONTROL", "id":20573, "ctx":"initandlisten","msg":"Wrong mongod version","attr":{"error":"UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: Location4926900: Invalid featureCompatibilityVersion document in admin.system.version: { _id: \"featureCompatibilityVersion\", version: \"4.2\" }. See https://docs.mongodb.com/master/release-notes/4.4-compatibility/#feature-compatibility. :: caused by :: Invalid value for featureCompatibilityVersiondocument in admin.system.version, found 4.2, expected '4.4' or '4.9' or '5.0. See https://docs.mongodb.com/master/release-notes/4.4-compatibility/#feature-compatibility.). If the current featureCompatibilityVersion is below 4.4, see the documentation on upgrading at https://docs.mongodb.com/master/release-notes/4.4/#upgrade-procedures."}}

It looks like at some point MongoDB was updated to v5 and now v6. It would be great to have documentation on how to upgrade Ackee that includes how to upgrade MongoDB

πŸ“š To Reproduce

Have an Ackee instance running an older version of Ackee and try to upgrade. Run docker-composer pull && docker-compose up and you'll see MongoDB failures and Ackee fail to start.

πŸ’‘ Expected behavior

I would expect Mongo DB to be updated and all code just to work.

βš™οΈ Environment

BrookeDot commented 2 years ago

My package.json does show "mongoose": "^5.11.12",

mathe42 commented 2 years ago

Can you show you docker-compose.yml? What version do you use there for mongo?

BrookeDot commented 2 years ago

Can you show you docker-compose.yml? What version do you use there for mongo?

It doesn't seem to have a Mongo version there. It's the stock file from the repo. Is that part of the problem?

$ more docker-compose.yml
version: "2"
services:
  ackee:
    image: electerious/ackee
    container_name: ackee
    restart: always
    ports:
      - "3000:3000"
    environment:
      - WAIT_HOSTS=mongo:27017
      - ACKEE_MONGODB=mongodb://mongo:27017/ackee
    env_file:
      - .env
    depends_on:
      - mongo
  mongo:
    image: mongo
    container_name: mongo
    restart: always
    volumes:
      - ./data:/data/db
electerious commented 2 years ago

Have an Ackee instance running an older version of Ackee and try to upgrade. Run docker-composer pull && docker-compose up and you'll see MongoDB failures and Ackee fail to start.

Hm, that what I'm doing, too. Docker should pull the latest image for both ackee and mongo when running docker-composer pull && docker-compose up.

BrookeDot commented 2 years ago

Closing this, deleting the GitHub codebase then doing a clean checkout "fixed" it. Have no idea what was going on but here we are :D