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

Migrate from MongoDB 4.x to @next #1825

Closed
16 tasks done
Martii opened this issue Jul 18, 2021 · 6 comments
Closed
16 tasks done

Migrate from MongoDB 4.x to @next #1825

Martii opened this issue Jul 18, 2021 · 6 comments
Labels
CODE Some other Code related issue and it should clearly describe what it is affecting in a comment. enhancement Something we do have implemented already but needs improvement upon to the best of knowledge. HOST Usually the VPS. migration Use this to indicate that it may apply to an existing or announced migration.

Comments

@Martii
Copy link
Member

Martii commented Jul 18, 2021

  1. Convert to newer style GPG key, stored at /usr/share/keyrings/, for existing MongoDB 4.4 (NOTE keys are different between ...4.0.asc and ...4.4.asc)
  2. Check with backend to make sure VPS is supported (lsb_release -a with https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/#platform-support)
  3. Works with buster and focal (however not working with bullseye¹ and jammy² yet)
  4. Schedule notice on OUJS
  5. Take OUJS offline
  6. Compact DB
  7. Backup existing pro DB (ex. mongodump --gzip --db openuserjs_devel --archive=./dev/devDBdirty.gz but productions)
  8. Backup VPS (will require additional time)
  9. Purge 4.x (remove old signing key for 4.x)
  10. Target new sources
  11. Install @next (may need db tools from .deb package... local installation was a bit weird with apt)
  12. Import pro DB (ex. mongorestore --gzip --db openuserjs_devel --archive=./dev/devDBdirty.gz but productions)
  13. Backup VPS (will require additional time)
  14. Restore VPS backup (storage opt)
  15. Put OUJS online (possibly in read only mode just for initial checking)
  16. Purge old VPS running backup when all is "well"

NOTE(S)

Possible dev installation when available for 6.x

KEY=https://www.mongodb.org/static/pgp/server-6.0.asc
KEYRING=/usr/share/keyrings/mongodb-org-6.0-keyring.gpg
REPO=https://repo.mongodb.org/apt/ubuntu
LIST=/etc/apt/sources.list.d/mongodb-org-6.0.list 

curl -fsSL $KEY | sudo gpg --batch --yes --dearmor -o $KEYRING
echo "deb [signed-by=$KEYRING] $REPO $(lsb_release -cs)/mongodb-org/6.0 multiverse" | sudo tee $LIST > /dev/null

sudo apt update

apt-cache policy mongodb-org
N: Unable to locate package mongodb-org

Possible pro installation when available for 6.x (2022 09 01 ... missing in buster, present in bullseye)

KEY=https://www.mongodb.org/static/pgp/server-6.0.asc
KEYRING=/usr/share/keyrings/mongodb-org-6.0-keyring.gpg
REPO=https://repo.mongodb.org/apt/debian
LIST=/etc/apt/sources.list.d/mongodb-org-6.0.list 

curl -fsSL $KEY | sudo gpg --batch --yes --dearmor -o $KEYRING
echo "deb [signed-by=$KEYRING] $REPO $(lsb_release -cs)/mongodb-org/6.0 main" | sudo tee $LIST > /dev/null
@Martii Martii added the enhancement Something we do have implemented already but needs improvement upon to the best of knowledge. label Jul 18, 2021
@Martii Martii self-assigned this Jul 18, 2021
@Martii Martii added CODE Some other Code related issue and it should clearly describe what it is affecting in a comment. migration Use this to indicate that it may apply to an existing or announced migration. HOST Usually the VPS. labels Jul 18, 2021
@Martii
Copy link
Member Author

Martii commented Dec 23, 2021

This is starting to get important. mongo is starting to show bitrot as an updated element didn't update but it said it did. Need mongosh soon as it is more actively developed (same with mongoose and mongodb deps). Blehh.... more work for the coming new year as usual.

See also:

@Martii Martii added the sooner Sooner would be appreciated. label Dec 23, 2021
@Martii
Copy link
Member Author

Martii commented Jan 7, 2022

Interesting:

MongoDB 4.x seems to allow one only on production however local dev here (MongoDB 5.x) says the index was created when I did 2. Since pro is a slightly different platform may not work with 2... but now there is an option. Been waiting for this feature for several years now. We can query multiple "parallel arrays" for years however we can't index them is what they are saying in the docs... paraphrased of course.

Martii added a commit to Martii/OpenUserJS.org that referenced this issue Jan 7, 2022
* This is one of the last recommendations that mLabs said to try.
* Also paired with re-investigation mentioned at OpenUserJS#1825 (comment)
Martii added a commit that referenced this issue Jan 7, 2022
* Try alt index

* This is one of the last recommendations that mLabs said to try.
* Also paired with re-investigation mentioned at #1825 (comment)

* Index reordering again

* Seems to be happier. Not quite the ESR rules because isLib has to be first and in those locations or the index never gets used... more likely boolean equality, semi-static preferred equality, semi-static less preferred equality, etc.
* We'll try this for a while.

Ref:
* https://www.mongodb.com/blog/post/performance-best-practices-indexing

Auto-merge
@Martii
Copy link
Member Author

Martii commented Jan 28, 2022

Misc critical error encountered:

MongoDB Script save critical error
iFelix18/Monkey_Utils.js
{
 "version": 0,
 "modifiedPaths": [
  "meta",
  "uses",
  "hash",
  "updated"
 ]
}
0bc2e3b4-803a-11ec-868a-26da9250a6e2 statusError: {
 "message": "Database write error",
 "code": 502
}
    at ~/OpenUserJS.org1/controllers/scriptStorage.js:2178:27
    at ~/OpenUserJS.org1/node_modules/mongoose/lib/model.js:5074:18
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  status: { message: 'Database write error', code: 502 },
  code: undefined
}

No further updates to mongoose@5.x and mongodb@3.x at this time.

Could be related to https://stackoverflow.com/questions/70536836/unreachable-mongodb-once-memory-is-being-allocated-on-the-swap since that's what came up on a log investigation.

Author is sending both normal and minified scripts from GH to OUJS on sync.

@Martii Martii changed the title Migrate from MongoDB 4.x to 5.x Migrate from MongoDB 4.x to @next Aug 16, 2022
@Martii
Copy link
Member Author

Martii commented Nov 22, 2022

Hoping to get this started next week after the holiday... still have https://repo.mongodb.org/apt/ubuntu/dists/jammy/mongodb-org/5.0/multiverse/binary-amd64/ missing for dev station but 6.0 does exist at this time.

Been a seriously long wait for them to get the completed new versions out. Last weeks check yielded the 6.0 for pro and dev available... currently testing on dev:

$ apt-cache policy mongodb-org
mongodb-org:
  Installed: 6.0.3
  Candidate: 6.0.3
  Version table:
 *** 6.0.3 500
        500 https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0/multiverse amd64 Packages
        100 /var/lib/dpkg/status

NOTE: At this time neither doc pages show jammy or bullseye support yet the repo has support... wondering if they are expecting real world testing instead of internal.

@Martii Martii added expedite Immediate and on the front burner. and removed sooner Sooner would be appreciated. labels Dec 1, 2022
@Martii
Copy link
Member Author

Martii commented Dec 1, 2022

This is now scheduled to happen with the next 96 hours. I'm quite busy off and on but will find some time for this. Will update the topic label on main page when it's "Offline".

@Martii
Copy link
Member Author

Martii commented Dec 1, 2022

Thrills: Cc: @sizzlemctwizzle

Callbacks are deprecated in the Node.js driver version 4.10 and will be removed in a future release. We recommend that you use Promises or Async/Await instead.

If your application requires the use of callbacks, you can use the MongoDB Node.js driver with optional callback support
, which wraps the Node.js driver and provides optional callback support.

Ref: https://www.mongodb.com/docs/drivers/node/current/fundamentals/promises/#callbacks--deprecated-

Pretty sure they are already eol'd as I'm getting MongoInvalidArgumentError: Argument "options" must not be function when used with sessions in the mongodb@4.x driver. This also leads heavily into #1556

Anyhow... in-place migration from MongoDB 4.x to MongoDB 6.x failed... but luckily purged it as I described above and restored. Seems to be working just like dev station.

Closing this migration issue.

@Martii Martii closed this as completed Dec 1, 2022
@Martii Martii removed their assignment Dec 1, 2022
@Martii Martii removed the expedite Immediate and on the front burner. label Dec 1, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CODE Some other Code related issue and it should clearly describe what it is affecting in a comment. enhancement Something we do have implemented already but needs improvement upon to the best of knowledge. HOST Usually the VPS. migration Use this to indicate that it may apply to an existing or announced migration.
Development

No branches or pull requests

1 participant