Created attachment 251215 [details] New port patch As mentionned on the forum : https://forums.freebsd.org/threads/mongodb-7-0-mongo-shell-mongosh-is-missing.90658/ Mongo shell has been deprecated and isn't packaged anymore. I have created a new port to build the actually supported mongosh based on NodeJS. It builds a standalone version of mongosh and provide only the binary file without the need of NodeJS after installation. ETB is approximatly 25 minutes with 10 cpus and 128 GB of ram.
Doing a test build on FreeBSD 14/aarch64.
(In reply to Ronald Klop from comment #1) Got an error. post-patch is trying to access the network " [00:00:50] ===> Applying FreeBSD patches for mongosh-2.2.5 from /usr/ports/databases/mongosh/files [00:00:51] cd /wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.2.5 && npx cross-env PUPPETEER_SKIP_DOWNLOAD=1 npm install [00:02:03] npm error code EAI_FAIL [00:02:03] npm error syscall getaddrinfo " After the fetch phase you cannot access network on the package building cluster. Use poudriere you can test this scenario yourself. Some info about poudriere is for example: https://wiki.freebsd.org/VladimirKrstulja/Guides/Poudriere Full build log: https://june24:T0nB$jEKu@jail14.thuis.klop.ws/data/freebsd14-custom/2024-06-25_09h52m00s/logs/mongosh-2.2.5.log
(In reply to Ronald Klop from comment #2) Thank you for taking the time to review my port submission. I actually know, that's why I have ALLOW_NETWORKING_PACKAGES="mongosh" in poudriere.conf. What do you suggest ? A repo with the node_modules populated or an ugly "npm install" at fetch step ? I didn't find how electron and vscode are managing this constraint.
(In reply to Fabien Amelinck from comment #3) I don’t have experience building a npm based port. So asked your question at ports@freebsd.org. This was an answer on the list by Hiroo Ono. Maybe it helps. Hi, Not a committed port, so I do not know if it is the right solution. I managed to limit the networking in fetch phase in the port below: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272180 in short, I took the following steps in fetch phase, 1. HOME=${WRKDIR} npm install --ignore-scripts 2. backup ${WRKDIR}/.npm under ${DISTDIR} in extract phase 3. extract backup .npm under ${WRKDIR} in build phase 4. HOME=${WRKDIR} npm install --offline Another solution is electron port. When I looked into in (around version 22), it archived yarn cache somewhere and fetched it.
Hi, Is this port issue still being worked on? AFAIS the only problem was downloading files after the fetch phase. So the official package builders will not be able to build a pkg for it. I don't know if it is "allowed"/preferred to add a port with an IGNORE="needs download after fetch phase" to get the port into the tree without generating pkgs.
(In reply to Ronald Klop from comment #5) No, that would be an invalid/broken port and not to be committed.
(In reply to Daniel Engberg from comment #6) Thank for the feedback Daniel. I'll wait another week for feedback of the reporter and than close the issue as "Not Accepted" with a small description to it. We can always re-open it if new development occurs in the future.
(In reply to Ronald Klop from comment #7) It's a bit tricky to handle node's packages (~1600) because some are downloaded during the build phase. I tried to add it one by one in the package.json but it's a mess. The best solution is to make an archive host on my github as "vscode" port do but it's also very ugly. Still in WIP.
(In reply to Fabien Amelinck from comment #8) I finally got it working with a cache tarball hosted on github. I haven't tried on an aarch64, feel free to try and get back to me if you need any details or changes.
Created attachment 255203 [details] Updated patch
(In reply to Fabien Amelinck from comment #10) Nice work! I tested it and got a fetch error. Does this ring a bell? https://nov24:lgxSrhwY1iGLnZUc0Vls5@pkg.thuis.klop.ws/build.html?mastername=freebsd141-custom&build=2024-11-15_20h22m08s
(In reply to Ronald Klop from comment #11) My bad, I changed the node_modules tarball's name to include mongosh version. I'm working on the 2.3.3 now but I want the 2.2.5 to come out first to be sure because we already use it now in production.
Created attachment 255218 [details] patch for 2.2.5
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=31d8a7eb3429202e96349c29c0bb240395989ec8 commit 31d8a7eb3429202e96349c29c0bb240395989ec8 Author: Fabien Amelinck <fabien.amelinck@advens.fr> AuthorDate: 2024-11-21 07:52:25 +0000 Commit: Ronald Klop <ronald@FreeBSD.org> CommitDate: 2024-11-21 08:52:59 +0000 databases/mongosh: new port Standalone MongoDB Shell replacing deprecated Mongo CLI. NodeJS doesn't need to be installed. PR: 279519 databases/Makefile | 1 + databases/mongosh/Makefile (new) | 146 +++++++++++++++++++++ databases/mongosh/distinfo (new) | 11 ++ .../patch-node__modules_kerberos_binding.gyp (new) | 32 +++++ ...__modules_kerberos_src_kerberos__common.h (new) | 11 ++ ...les_mongodb-client-encryption_binding.gyp (new) | 35 +++++ ...es_mongodb-client-encryption_package.json (new) | 11 ++ ...h-node__modules_os-dns-native_binding.gyp (new) | 13 ++ .../mongosh/files/node-patches/004-openssl3 (new) | 15 +++ .../files/node-patches/005-src_cares__wrap.h (new) | 11 ++ databases/mongosh/files/patch-package.json (new) | 36 +++++ ...ejs-patches_002-workaround-node-bug-52229 (new) | 17 +++ .../files/patch-scripts_prep-fle-addon.sh (new) | 20 +++ .../files/patch-scripts_sort-workspaces.js (new) | 11 ++ databases/mongosh/pkg-descr (new) | 5 + databases/mongosh/pkg-plist (new) | 1 + 16 files changed, 376 insertions(+)